GPT attention measures token compatibility through dot-product similarity. This mechanism is simple, effective, and memory-efficient. But it does not explicitly model whether strong token features should reinforce or suppress one another. We introduce Q-Interference, a fully classical quantum-inspired attention mechanism for autoregressive language modeling that augments each query and key feature with an amplitude and a learned phase. The resulting attention score is phase-aware which aligned phases contribute constructively while conflicting phases contribute destructively. Although Q-Interference yields a richer interaction rule than similarity alone, a naive implementation of Q-Interference requires a large token-pair-feature interaction tensor, making it memory-intensive and often impractical. To address this limitation, we propose an exact trigonometric factorization that computes the same score using two standard matrix multiplications avoiding materialization of the large intermediate tensor. Q-Interference fits directly into a Transformer block in GPT and leaves the remainder of the model architecture and next-token prediction objective unchanged. Experiments on public benchmark datasets and baseline models show that the proposed reformulation trains stably in a controlled GPT-style setting and provides a consistent memory advantage over naive phase-aware interference attention. These results support the specific contribution of this work: an exact memory-efficient reformulation that makes phase-aware interference attention practical within a standard GPT pipeline.
Figures & tables
Figure 1: Q-Interference methodology flowchart.
Model
Comparison role
Justification
Baseline GPT
Standard internal control
Directly controlled reference for conventional causal dot-product attention under the same GPT-style training setup.
Q-GPT baseline
Quantum-inspired reference
Provides a published quantum-inspired GPT-style architectural comparison in this setting.
OPT-125M and GPT-Neo-125M
External pretrained reference
Gives context against an open autoregressive GPT-style model family.
Table 1: Baseline selection rationale.
Figure 2: Quality-memory trade-off for the main model comparison.
Dataset
Model
Best Val Loss
Test Loss
Test PPL
Peak GPU Mem (MB)
WikiText-103
Baseline GPT
3.2036
3.2049
24.6534
8055.76
WikiText-103
Q-GPT baseline
4.1142
4.1032
60.5367
7199.26
WikiText-103
Q-Interference (ours)
3.1809
3.1852
24.1718
4227.14
TinyStories
Baseline GPT
1.7279
1.7263
5.6196
8055.76
TinyStories
Q-GPT baseline
2.7036
2.7082
15.0016
7199.26
TinyStories
Q-Interference (ours)
1.7344
1.7394
5.6941
4227.14
Table 2: Baselines vs Q-Interference comparison over benchmark dataset
Dataset
Model
Test Loss
Test PPL
Peak GPU Mem (MB)
WikiText-103
GPT-Neo-125M
2.9673
19.4386
4097.91
WikiText-103
OPT-125M
3.0169
20.4278
4213.64
WikiText-103
Q-Interference (ours)
3.1852
24.1718
4227.14
TinyStories
GPT-Neo-125M
1.5198
4.5713
9934.54
TinyStories
OPT-125M
1.4217
4.1443
6219.52
TinyStories
Q-Interference (ours)
1.7394
5.6941
4227.14
Table 3: Comparison to pre-trained reference models.
Dataset
Model
Best Val Loss
Test Loss
Test PPL
Peak GPU Mem (MB)
WikiText-103
Naive interference
OOM
OOM
OOM
OOM
WikiText-103
Q-Interference (ours)
3.1809
3.1852
24.1718
4227.14
TinyStories
Naive interference
2.2972
2.3422
10.4037
12138.34
TinyStories
Q-Interference (ours)
1.7344
1.7394
5.6941
4227.14
pile-10k
Naive interference
4.0223
5.1086
165.4355
12138.34
pile-10k
Q-Interference (ours)
4.0745
4.7616
116.9275
4227.14
Table 4: Naive phase-aware attention versus Q-Interference.
Dataset
Model
Best Val Loss
Test Loss
Test PPL
Peak GPU Mem (MB)
WikiText-103
Q-Interference (ours)
3.1809
3.1852
24.1718
4227.14
WikiText-103
Q-Interference w/o phase
3.1830
3.1879
24.2373
3993.53
TinyStories
Q-Interference (ours)
1.7344
1.7394
5.6941
4227.14
TinyStories
Q-Interference w/o phase
1.7352
1.7410
5.7030
3993.53
pile-10k
Q-Interference (ours)
4.0745
4.7616
116.9275
4227.14
pile-10k
Q-Interference w/o phase
4.0736
4.7634
117.1429
3993.53
Table 5: Phase ablation for the final Q-Interference model.
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Work
GPT-style
Quantum-inspired
Phase-aware
Memory-aware
Exact memory-efficient
QSANN
×
✓
×
×
×
QMSAN
×
✓
×
×
×
HyQuT
✓
✓
×
×
×
QISA
✓
✓
×
×
×
QubitCache
✓
✓
×
✓
×
Q-Interference (ours)
✓
✓
✓
✓
✓
Appendix
Table 6: Compact comparison of representative prior work and Q-Interference.
Symbol
Meaning
T
Sequence length.
dh
Dimension of one attention head.
aiq∈R+dh
Nonnegative query amplitude vector for token i .
ajk∈R+dh
Nonnegative key amplitude vector for token j .
ϕiq∈Rdh
Query phase vector for token i .
ϕjk∈Rdh
Key phase vector for token j .
Appendix
Table 7: Notation used in the proof appendix.
Term
Definition
Best validation loss
The lowest validation cross entropy observed during training. It is used to track model selection and training progress. Lower is better.
Test loss
The cross entropy loss measured on the held-out test split after training. It measures how well the model assigns probability to the correct next token. Lower is better.
Test perplexity
The exponential form of test loss. It can be read as the model’s effective uncertainty when predicting the next token. Lower is better.
Peak training GPU memory
The maximum GPU memory used during training under the reported batch size, context length, precision, and hardware. It measures practical training cost rather than language quality. Lower is better.
Memory reduction
The percentage decrease in peak GPU memory relative to a chosen baseline. A larger reduction means the model needs less GPU memory under the same reported setting.
Parameter matched comparison
A comparison where models have similar parameter counts. This helps reduce the chance that differences are caused only by model size.
Appendix
Table 8: Definitions of metrics and model terms used in the appendix result analysis.
Figure 3: Controlled comparison on the WikiText-103 dataset. The top ruler reports test perplexity and the bottom ruler reports peak training GPU memory. Each marker represents one internal model, and each label reports the exact value. Q-Interference achieves the best internal test perplexity and the lowest peak GPU memory in this controlled setting.
Figure 4: Peak GPU memory across the custom model family. Q-Interference consistently uses less memory than the standard GPT baseline, naive interference, and the Q-GPT baseline under the reported setting. The naive interference model highlights the cost of materializing the phase-aware interaction tensor.
Figure 5: Pretrained 125M model comparison. GPT-Neo-125M and OPT-125M are pretrained decoder-only models, while Q-Interference is trained from scratch in the controlled setup used in this work. The pretrained references obtain stronger final language-modeling quality, but Q-Interference shows a favorable memory profile and uses lower peak GPU memory on three of the four datasets. The comparison is intended to contextualize Q-Interference rather than to serve as a parameter-matched baseline.
Self-attention is central to Transformer performance and is often the most expensive part of the Transformer at long context lengths because its pairwise token interactions scale quadratically with sequence length. Standard dense attention also applies the same set of attention heads to every token regardless of token difficulty or information content. This uniform activation can waste compute, especially as sequences grow longer and attention cost increases rapidly. We propose Grouped Query Experts (GQE), a mixture-of-experts layer on top of grouped-query attention (GQA). Within each GQA group, a router selects k query-head experts per token while all key-value (KV) heads remain dense and unchanged. Thus, GQE keeps the KV cache benefits of GQA and reduces only the active query-head computation. On a fixed 30B token budget at the 250M parameter scale, GQE matches the all-active GQA baseline in downstream accuracy while activating half the query heads per token.
Proactive interference (PI) is a documented failure mode in large language models in which retrieval of a repeatedly overwritten value degrades as prior overwrites accumulate, mirroring a classical phenomenon in human working memory. Post-training quantization (PTQ) is now the default deployment path for open-weight models, yet its effect on this failure mode has not been tested. We evaluate three precision levels (FP16, INT8, INT4/NF4, via bitsandbytes) across three architecturally distinct instruction-tuned models (Qwen2.5-7B-Instruct, Mistral-7B-Instruct-v0.3, Phi-3.5-mini-instruct), holding the retrieval task fixed. INT4 quantization significantly reduces accuracy under high interference in every model (e.g., from 81.0% to 68.3% for Qwen), confirmed by paired McNemar's tests (p≤2.6×10−6) and a mixed-effects regression spanning all interference levels; INT8, often assumed safe, also carries a smaller but real penalty in two of three models. The effect is specific to semantically similar (word-type) distractors and reverses sign under a numeric control condition, and is mechanistically linked to a rise in same-key intrusion errors under INT4 (from 21.5% to 24.6% of trials, p=4.8×10−7). A follow-up ablation shows the effect originates in the quantized transformer backbone rather than the output projection layer. These results suggest that bitsandbytes 4-bit quantization can impose an additional cost on applications relying on long, updatable, semantically dense contexts, even when aggregate benchmark accuracy appears largely unaffected. We release our code and tokenizer-verified vocabulary construction method at https://github.com/ShayanShahrabi/compress-and-forget
Shayan Shahrabi-Farahani, Dara Rahmati
Shahid Beheshti University · Shahid Beheshti University, Tehran, Iran
We propose Keyless Attention, an attention mechanism that eliminates the key projection entirely, operating over queries and values only. This yields a Value-Only Cache that reduces KV cache memory and access overhead by exactly 50% over standard attention, while matching or exceeding standard attention's decode throughput. Beyond efficiency, we introduce Depth-m Attention Factorization: standard attention computes a depth-2 factorization of the attention bilinear form, while Keyless Attention realizes a depth-m instance of this family. At m=3, Keyless Attention matches the projection matrix count of standard attention via a value-space routing matrix that replaces the key projection and introduces a coupling between routing and retrieval. Experiments across five models and four architectures (GPT-2 280M, GPT-2 557M, Pythia 410M, Qwen2 1.5B, and Llama 3.2 1B) show that Keyless Attention matches or outperforms standard QKV attention on perplexity in 4 out of 5 models. On downstream zero-shot evaluation (GPT-2 557M), Keyless Attention outperforms on 4 out of 5 commonsense reasoning benchmarks, while achieving 50% KV cache reduction throughout.
Xin Gao
Department of Mathematics and Statistics York University Toronto, M3J 1P3