Views
No views yet
V = K, no value weights at all). Only K needs to be cached during autoregressive
generation, halving KV-cache memory versus standard attention.sample-10BT), not SlimPajama — SlimPajama was no longer resolvable on the HF Hub at
training time.transformer_KV_1_300_M.py
(class GPT_QKV_KEqualsV) with a padding-loss masking fix (short documents were previously
scored on their padding). The model architecture is identical to the file linked above; only
the training loop's loss masking changed. The fixed training script itself was not preserved
outside the training instance.sample-10BT), 33,908 steps, ~45 hours.| Metric | Value |
|---|---|
| Final validation loss | 3.058 |
| Final validation perplexity | 21.28 |
| Bits per character | 4.41 |
temperature=0.8, top_k=50 with no seed
and no repetition penalty — outputs vary run-to-run and can fall into repetition loops. Treat
generated text as illustrative only; validation perplexity is the reliable metric here.| File | Description |
|---|---|
checkpoints/qkv_keqv_300m_fineweb_edu.pt | Final model weights only (no optimizer state), {step, epoch, tokens_seen, model_state_dict, val_metrics, model_config, train_config} |
checkpoints/model_config.yaml | Architecture hyperparameters |
checkpoints/train_config.yaml | Optimizer / schedule hyperparameters |
1n_layer: 20
2n_embd: 1024
3n_head: 16
4n_inner: 4096
5n_positions: 2048
6vocab_size: 50304
7tie_word_embeddings: trueAutoTokenizer.from_pretrained("gpt2")).1git clone https://github.com/Brainchip-Inc/Do-Transformers-Need-3-Projections
2pip install torch huggingface_hub1import torch
2from huggingface_hub import hf_hub_download
3from transformer_KV_1_300_M import ModelConfig, GPT_QKV_KEqualsV
4
5path = hf_hub_download(
6 "BrainChip-AI/qkv-fineweb-300m",
7 "checkpoints/qkv_keqv_300m_fineweb_edu.pt",
8)
9ckpt = torch.load(path, map_location="cpu", weights_only=False)
10
11model = GPT_QKV_KEqualsV(ModelConfig(**ckpt["model_config"]))
12model.load_state_dict(ckpt["model_state_dict"])
13model.eval()
14
15print(ckpt["val_metrics"]) # {'loss': 3.058, 'perplexity': 21.28, 'bpc': 4.41}1@inproceedings{kayyam2026qkv,
2 title={Do Transformers Need Three Projections? A Systematic Study of {QKV} Variants},
3 author={Kayyam, Ali and Madan Gopal, Anusha and Lewis, M Anthony},
4 booktitle={Proceedings of the 43rd International Conference on Machine Learning (ICML)},
5 year={2026},
6 series={PMLR},
7 volume={306}
8}