---
title: "A failed experiment: Infini-Attention, and why we should keep trying?"
description: "A Hugging Face reproduction of Google's Infini-attention found that retrieval quality degrades as memory is compressed more times."
url: "https://swe.quest/articles/a-failed-experiment-infini-attention-and-why-we-should-keep-trying-49bb19744a04d6da"
canonical: "https://huggingface.co/blog/infini-attention"
source: "Hugging Face"
published: "2024-08-14"
difficulty: "hard"
kind: "Research"
reading_minutes: 16
tags: ["llms","model-training","evals"]
---

# A failed experiment: Infini-Attention, and why we should keep trying?

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-08-14, 16 min read, Research. Original: [https://huggingface.co/blog/infini-attention](https://huggingface.co/blog/infini-attention)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)

## Prerequisites

- transformer self-attention
- linear attention
- LLM pretraining ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- positional encodings like RoPE

## Keywords

Infini-attention, Ring Attention, Llama 3 8B, Nanotron, FineWeb, YaRN, passkey retrieval, RoPE scaling

## Related posts

- [Optimizing your LLM in production](https://swe.quest/articles/optimizing-your-llm-in-production-aa5bbb901928fa57.md): Hugging Face · 2023-09-15 · Medium · 31 min read · Inference & serving, LLMs, Performance engineering, Python
  Serving 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.
- [Improving Hugging Face Training Efficiency Through Packing with Flash Attention 2](https://swe.quest/articles/improving-hugging-face-training-efficiency-through-packing-with-flash-attention-0e7b5058677254df.md): Hugging Face · 2024-08-21 · Hard · 5 min read · Model training, LLMs, Performance engineering, Python
  Hugging 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.
- [Welcome Falcon Mamba: The first strong attention-free 7B model](https://swe.quest/articles/welcome-falcon-mamba-the-first-strong-attention-free-7b-model-207d13ee4cb1b108.md): Hugging Face · 2024-08-12 · Medium · 8 min read · LLMs, Inference & serving, Evaluation, Model training
  Falcon Mamba 7B from TII is a pure Mamba state space language model with extra RMS normalization layers for stable training at scale.
- [Bypassing inference bottlenecks: Accelerating complex AI search with Retrieve-for-Train](https://swe.quest/articles/bypassing-inference-bottlenecks-accelerating-complex-ai-search-with-retrieve-95676e43f1ce9cc3.md): Google Research · 2026-09-15 · Hard · 8 min read · Search, Model training, Inference & serving, LLMs, Recommendations & ranking
  Retrieve-for-Train replaces expensive inference-time LLM reasoning for query fan-out with a one-time offline RL stage.
- [Finally, a Replacement for BERT: Introducing ModernBERT](https://swe.quest/articles/finally-a-replacement-for-bert-introducing-modernbert-95bd85fcbbb49537.md): Hugging Face · 2024-12-19 · Medium · 23 min read · Machine learning, Model training, Inference & serving, RAG & retrieval, LLMs
  ModernBERT 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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
