A failed experiment: Infini-Attention, and why we should keep trying?
A Hugging Face reproduction of Google's Infini-attention found that retrieval quality degrades as memory is compressed more times. Ring attention, YaRN and RoPE scaling remain the better ways to extend a pretrained model's context length. Infini-attention splits the sequence into segments, runs local causal attention within each segment, and folds earlier segments into a fixed-size linear-attention memory, mixing the two outputs through a learned sigmoid gate. Small 200M-parameter models trained with Nanotron on FineWeb showed some use of the memory, but continual pretraining of Llama 3 8B failed passkey retrieval when the needle sat in an earlier segment. Most of the effort went into debugging a convergence issue, and the post lays out reproduction principles: start small, train a solid baseline, and run controlled ablations.
Related posts
- Optimizing your LLM in production
Hugging Face mediumAdeptServing billion-parameter LLMs efficiently comes down to three levers: lower precision, Flash Attention, and inference-friendly architectures such as ALiBi, rotary embeddings, Multi-Query Attention and Grouped-Query Attention. Weights need roughly 2 GB of VRAM per billion parameters in bfloat16, and measurements on OctoCoder (~15B parameters) show peak memory dropping from about 29 GB in bfloat16 to 15 GB with 8-bit and 9.5 GB with 4-bit bitsandbytes quantization, with little output change but slightly slower inference. Flash Attention addresses self-attention's quadratic memory growth with sequence length by restructuring the computation to make better use of GPU memory. Code examples in Hugging Face Transformers accompany each technique.
- Improving Hugging Face Training Efficiency Through Packing with Flash Attention 2
Hugging Face hardMasterHugging Face Transformers now supports padding-free packing of instruction-tuning examples with Flash Attention 2 via the new DataCollatorWithFlattening, which concatenates sequences and passes position_ids so flash_attn_varlen_func respects example boundaries and avoids cross-example attention. On 8 A100s, throughput doubled on FLAN (short, highly variable lengths) and rose 1.4x on OrcaMath for Llama2-7B, Mistral-7B and Granite-8B-code, with peak memory down 20% and 6% respectively. Validation loss matched padded training because the number of optimization steps is unchanged. Usage requires loading the model with attn_implementation="flash_attention_2" and using the new collator, or setting padding_free=True on TRL's DataCollatorForCompletionOnlyLM. It works only for models that expose position_ids.
- Welcome Falcon Mamba: The first strong attention-free 7B model
Hugging Face mediumAdeptFalcon Mamba 7B from TII is a pure Mamba state space language model with extra RMS normalization layers for stable training at scale. Trained on roughly 5,500 GT of mostly RefinedWeb data, it matches or beats similarly sized transformers and hybrid SSM models on Open LLM Leaderboard benchmarks, averaging 15.04 on v2 and 64.09 on v1. Because an SSM keeps only a recurrent state, decoding runs at constant throughput and memory regardless of context length. Parallel prefill still makes memory grow with prompt length, but sequential or chunked prefill lets the model handle arbitrarily long prompts on a single 24GB A10. The model loads through Hugging Face transformers (>4.45.0) and supports 4-bit bitsandbytes quantization, torch.compile and an instruction-tuned variant.
- Bypassing inference bottlenecks: Accelerating complex AI search with Retrieve-for-Train
Google Research hardMasterRetrieve-for-Train replaces expensive inference-time LLM reasoning for query fan-out with a one-time offline RL stage. A 4B fan-out language model (Gemma3-4B or Qwen3-4B) is trained with Soft-GRPO on a composite set-level reward that combines groundedness to the database manifold, Vendi Score diversity and query alignment. The trained model then synthesizes query-to-target-set pairs, which are distilled into a 53.9M-parameter diffusion retriever that produces a whole slate of target embeddings in one non-autoregressive pass. On fashion (CLIP) and music playlist (MuLan) retrieval it beats zero-shot expansion and Best-of-N, with a 12–20x speedup, staying at sub-second to a few seconds where autoregressive fan-out reaches nearly 50 seconds. Ablations show that without the diversity term the policy reward-hacks into degenerate strings.
- Finally, a Replacement for BERT: Introducing ModernBERT
Hugging Face mediumAdeptModernBERT is a family of encoder-only models (149M base, 395M large) that ports recent LLM architecture and training advances back to the BERT style, raising context length to 8,192 tokens and including large amounts of code in pretraining. It is the first base-size model to beat DeBERTaV3 on GLUE while using under 1/5th of its memory, and it runs 2-4x faster, especially on mixed-length inputs. It also leads long-context ColBERT retrieval and code retrieval tasks such as StackOverflow-QA. It works as a drop-in BERT replacement in transformers, without token type IDs and with Flash Attention 2 recommended, and must be fine-tuned for downstream tasks.