FlashAttention-Compatible Projections and Quantized Matrix Memory to Close the Throughput Gap
Align attention head dimensions and quantize per-token depth memory operations to unlock FlashAttention compatibility and reduce memory-bandwidth overhead during training and inference.
Time
Compute level
Resources
What the paper used
Prerequisites
Scope
The Gap
In Section 5.4 and Appendix F (Tables 3, 8, and 9), LoomFormer adds only 1.95%-3.70% analytical forward FLOPs, yet achieves 89.2%-92.4% of Transformer training throughput on TPU v5p and 83.8%-92.3% of BF16 inference throughput on an NVIDIA A800 GPU.
“the gap beyond the 2.0%–3.7% FLOPs reflects HBM I/O on M, lower arithmetic intensity of per-token M contractions, and smaller split projections and norms”
Limitation
Concatenating d/4 RoPE dimensions onto d-dimensional MRead queries and keys produces asymmetric Q/K (1.25d) versus V (d) head dimensions, preventing FlashAttention usage during GPU prefill (forcing slower cuDNN SDPA), while HBM traffic on M and low-arithmetic-intensity contractions widen the wall-clock slowdown and force 512-token cross-entropy chunking at 2.8B.
Proposed Solution
Constrict MRead Q/K reads to 3d/4 dimensions (or project concatenated 1.25d Q/K back to d) so Q, K, and V share uniform width d for FlashAttention-2/3 compatibility, and store/accumulate M in FP8 or INT8 with online per-slot scaling inside fused Triton/Pallas kernels to cut HBM footprint and memory bandwidth.
Why This Matters
Restoring FlashAttention compatibility and halving matrix-memory bandwidth should narrow the wall-clock throughput gap closer to the ~2-3% FLOP overhead and eliminate HBM activation-memory bottlenecks at scale.
How to Get Started
How to test it: Verify on an A800-80GB GPU and Medium (432M) training runs that uniform-width Q/K/V with FlashAttention plus FP8-quantized M raises relative prefill/decode throughput from 84-90% to >= 95% of Transformer++ with <= 0.005 Pile validation loss degradation; stop if FP8 quantization or 3d/4 Q/K sizing degrades validation loss by > 0.015.
- Profile the released A800 Triton kernels and cuDNN SDPA prefill pass from Table 9 using Nsight Compute to isolate time spent in SDPA versus MRead/MWrite HBM transfers.
- Train a Medium-scale (432M) variant where MRead Q/K outputs have dimension 3d/4 so concatenating d/4 RoPE yields uniform head dimension d.
- Benchmark prefill and decode throughput replacing cuDNN SDPA with FlashAttention-2/3 on A800/H100 GPUs.
- Prototype FP8 storage for M inside the fused MRead/MWrite/MShift kernel and measure both throughput gain and Pile validation loss parity.
Code linked to this paper on Hugging Face: github.com/Caiyun-AI/LoomFormer
Suggested by AI. Adapt it to your setup.
Has This Been Done?
Works like SnapMLA and FuTransformer address hardware-aware FP8/quantized pipeline optimizations for multi-head latent attention and transformer decoding, but do not specifically target FlashAttention-compatible uniform width projections combined with quantized matrix memory as proposed.
- SnapMLA: Efficient Long-Context MLA Decoding via Hardware-Aware FP8 Quantized Pipelining · 2026 · 8 citations
- FuTransformer: FP8 prefill and INT4 decode for Llama-style inference on Hopper · 2026 · 0 citations
- Hardware-Aware FP4 FlashAttention-4 · 2026 · 5 citations
We searched OpenAlex and arXiv for “FlashAttention asymmetric head dimension FP8 matrix memory kernel fusion” and “FlashAttention-Compatible Projections and Quantized Matrix Memory to Close the Throughput Gap” and an AI compared the idea with the top 10 results. A small search can miss relevant work.
Source Paper
Rewirable Circuits in Transformers with Loom AttentionDa Xiao, Qingye Meng, Shengping Li +1 more · 2026
The paper introduces loom attention and LoomFormer, a dual-stream Transformer architecture that makes inter-head circuits dynamically rewirable at every token rather than fixed by static virtual weights. By routing head outputs and inputs vertically through a shared per-token matrix memory alongside standard horizontal token attention, LoomFormer achieves the language modeling and downstream accuracy of Transformers trained with over 3x compute and recent residual-stream baselines trained with 1.7-2.8x compute at only 2.0-3.7% extra forward FLOPs.
Related Ideas
- Hardware-Accessible Autoregressive Video Generation via Mixed-Precision Quantization and PruningFastFrames: Video Generation at Interactive Latency🟠Medium
- Single-Backbone Adapter Multiplexing for Memory-Efficient Phase 2 Distribution MatchingJeveration: System One Models Now Generate🟡Fairly easy
- Quantization-Aware Low-Memory InferenceHunyuanVideo 1.5 Technical Report🟡Fairly easy
- Foveated Spatial KV Compression and Sparse Attention for Interactive 720p Video GenerationFastFrames: Video Generation at Interactive Latency🔴Hard
- Subspace-Native Periodic Low-Rank Merging for High-Rank Adaptation at Low-Rank Memory CostCurvDelta: Low-Curvature Delta Modeling For Surgical Learning and Unlearning🟡Fairly easy