VSA-Llama-3.2-1B (12 Fixed-State VSA + 4 Softmax Hybrid)
VSA-Llama-3.2-1B is a surgically transplanted hybrid language model built from meta-llama/Llama-3.2-1B. 12 of the 16 attention layers (75%) have been replaced with Fixed-State Decayed Linear Attention (VSA) layers (M_t = gamma * M_{t-1} + k_t (x) v_t), while 4 layers (blocks 3, 7, 11, 15) retain standard GQA Softmax attention.
Because 75% of the network uses a fixed 64 x 64 recurrent matrix state per head rather than a growing KV cache, VSA-Llama-3.2-1B cuts KV-cache RAM growth by 74.9% forever and decodes up to 2.43x faster than unquantized Llama-3.2-1B at long context (64k tokens), while supporting exact algebraic memory unlearning (memorize / forget).

Key Architectural Innovations
- Fixed-State VSA Recurrence (O(1) Memory on 12/16 Layers):
Each VSA head maintains a constant-size
64 x 64matrix state updated viaM_t = gamma * M_{t-1} + k_t (x) v_tand read out with(1 - gamma)convex scaling. - 32-Head GQA Un-Tying (
k_head_mix,v_head_mix):Llama-3.2-1Buses 4:1 Grouped-Query Attention (32 Query heads sharing 8 KV heads). VSA-Llama-3.2-1B introduces per-head64 x 64subspace mixers so all 32 heads maintain independent64 x 64memory states. - 8-Tap Causal Local Convolution + Positive Feature Sharpener:
Compensates for
(1 - gamma)local attenuation over the preceding 1-7 tokens and suppresses negative dot-product cancellation. - Exact Algebraic Memory Editing (
forget): Because the VSA stateMis strictly linear in the key-value outer products, a memorized document trace can be subtracted algebraically with residual error< 1e-5.
Head-to-Head Benchmark vs. Unquantized meta-llama/Llama-3.2-1B
1. Quality & Zero-Shot Benchmarks (Same Harness, bfloat16)
| Metric / Benchmark | meta-llama/Llama-3.2-1B (16 Softmax) | VSA-Llama-3.2-1B (12 VSA + 4 Softmax) | Retention / Status |
|---|---|---|---|
| 64k Contiguous FineWeb-Edu Perplexity | 12.99 (1.000x) | 15.76 (1.213x) | Passes G5 Usable Gate (<= 1.25x) |
| Top-1 Next-Token Agreement | 100.0% | 75.5% | 0.300 nats KL divergence |
| ARC-Easy (Zero-Shot) | 66.3% | 64.4% | 97.1% retained (Within 2-sigma noise) |
| PIQA (Zero-Shot) | 75.6% | 71.8% | 95.0% retained |
| HellaSwag (Zero-Shot) | 65.5% | 52.2% | 79.7% retained |
2. Decode Speed (Tokens/sec) & Cache Memory Scaling (512 to 65,536 Context)
| Context Length | Llama-3.2-1B Speed | VSA-Llama-3.2-1B Speed | Speedup | Llama-3.2-1B Cache | VSA-Llama-3.2-1B Cache | RAM Saved |
|---|---|---|---|---|---|---|
| 512 | 148.4 tok/s | 149.2 tok/s | 1.01x | 16.00 MB | 7.00 MB | 56.2% |
| 2,048 | 163.5 tok/s | 148.8 tok/s | 0.91x | 64.00 MB | 19.00 MB | 70.3% |
| 8,192 | 148.9 tok/s | 148.8 tok/s | 1.00x | 256.00 MB | 67.00 MB | 73.8% |
| 16,384 | 138.8 tok/s | 149.2 tok/s | 1.08x | 512.00 MB | 131.00 MB | 74.4% |
| 32,768 | 85.5 tok/s | 149.7 tok/s | 1.75x | 1024.00 MB | 259.00 MB | 74.7% |
| 65,536 | 51.4 tok/s | 124.7 tok/s | 2.43x | 2048.00 MB | 515.00 MB | 74.9% |
Inference Usage
Clone the main VSA-LM repository and load vsa_llama_3.2_1b.pth:
import torch
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download
from vsa_lm.surgery import LlamaVSALM
ckpt_path = hf_hub_download(repo_id="rikkathree/vsa-llama-3.2-1b", filename="vsa_llama_3.2_1b.pth")
ck = torch.load(ckpt_path, map_location="cuda", weights_only=False)
model = LlamaVSALM(**ck["config"]).cuda().to(torch.bfloat16).eval()
model.load_state_dict(ck["model"], strict=True)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")
prompt_ids = tokenizer.encode("The water cycle is a process where", return_tensors="pt").cuda()
with torch.no_grad(), torch.autocast("cuda", torch.bfloat16):
for _ in range(50):
h = model(prompt_ids[:, -1024:])
next_tok = model.lm_head(h[:, -1:, :]).argmax(dim=-1)
prompt_ids = torch.cat([prompt_ids, next_tok], dim=1)
print(tokenizer.decode(prompt_ids[0], skip_special_tokens=True))