Skip to content
AI-generated research idea🟠Medium💡Moderate InnovationRelated work found

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

several weeks

Compute level

Multiple GPUs

Resources

NVIDIA A800/H100 GPU for Triton kernel benchmarking and multi-GPU node (or TPU v5p-16) for Medium-scale quality verification

What the paper used

JAX/MaxText pretraining on TPU v5p pods (v5p-16 for 432M/7B tokens, v5p-32 for 778M/14B and 1.4B/26B tokens, v5p-128 for 2.8B/300B tokens) on The Pile, plus single NVIDIA A800-80GB inference benchmarks.

Prerequisites

CUDA/Triton kernel engineering, FlashAttention internals, low-precision FP8/BF16 quantization

Scope

modify existing code

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”
From the paper, Section 5.4, page 8. Matched against the PDF text.

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.

  1. 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.
  2. 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.
  3. Benchmark prefill and decode throughput replacing cuDNN SDPA with FlashAttention-2/3 on A800/H100 GPUs.
  4. 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?

Related work found

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.

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 Attention

Da 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

Is this a good idea?

Share onXLinkedIn