mlsanityData to 7 Oct 2026

Adjoint sharding for very long context training of state space models

arXiv 2501.00692 ↗First posted 1 Jan 2025cs.LG cs.AI cs.CLcited by 0

Not on the map. Why?

Abstract (arXiv)

Despite very fast progress, efficiently training large language models (LLMs) in very long contexts remains challenging. Existing methods fall back to training LLMs with short contexts (a maximum of a few thousands tokens in training) and use inference time techniques when evaluating on long contexts (above 1M tokens context window at inference). As opposed to long-context-inference, training on very long context input prompts is quickly limited by GPU memory availability and by the prohibitively long training times it requires on state-of-the-art hardware. Meanwhile, many real-life applications require not only inference but also training/fine-tuning with long context on specific tasks. Such applications include, for example, augmenting the context with various sources of raw reference information for fact extraction, fact summarization, or fact reconciliation tasks. We propose adjoint sharding, a novel technique that comprises sharding gradient calculation during training to reduce memory requirements by orders of magnitude, making training on very long context computationally tractable. Adjoint sharding is based on the adjoint method and computes equivalent gradients to backpropagation. We also propose truncated adjoint sharding to speed up the algorithm while maintaining performance. We provide a distributed version, and a paralleled version of adjoint sharding to further speed up training. Empirical results show the proposed adjoint sharding algorithm reduces memory usage by up to 3X with a 1.27B parameter large language model on 1M context length training. This allows to increase the maximum context length during training or fine-tuning of a 1.27B parameter model from 35K tokens to above 100K tokens on a training infrastructure composed of five AWS P4 instances.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 40 of its 54 references that are in the map. First posted on arXiv 1 Jan 2025.

Builds on

40 of 54 references.

References · 40

  1. 2015Deep Residual Learning for Image Recognitioncited by 51,809
  2. 2023Segment Anythingcited by 8,158
  3. 2022Scalable Diffusion Models with Transformerscited by 5,931
  4. 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,616
  5. 2018Neural Ordinary Differential Equationscited by 3,733
  6. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
  7. 2020Longformer: The Long-Document Transformercited by 3,362
  8. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
  9. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,115
  10. 2024Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Dualitycited by 1,283
  11. 2019ZeRO: Memory Optimizations Toward Training Trillion Parameter Modelscited by 1,278
  12. 2017Mixed Precision Trainingcited by 1,135
28 more
  1. 2015Automatic differentiation in machine learning: a surveycited by 846
  2. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
  3. 2021Combining Recurrent, Convolutional, and Continuous-time Models with Linear State-Space Layerscited by 607
  4. 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
  5. 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 507
  6. 2022Hungry Hungry Hippos: Towards Language Modeling with State Space Modelscited by 495
  7. 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 448
  8. 2023Resurrecting Recurrent Neural Networks for Long Sequencescited by 397
  9. 2019Augmented Neural ODEscited by 396
  10. 2021ZeRO-Offload: Democratizing Billion-Scale Model Trainingcited by 339
  11. 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 302
  12. 2021Focal Self-attention for Local-Global Interactions in Vision Transformerscited by 286
  13. 2021Attention Mechanisms in Computer Vision: A Surveycited by 232
  14. 2024World Model on Million-Length Video And Language With Blockwise RingAttentioncited by 196
  15. 2019A Survey on Distributed Machine Learningcited by 187
  16. 2024An Empirical Study of Mamba-based Language Modelscited by 177
  17. 2023Focused Transformer: Contrastive Training for Context Scalingcited by 133
  18. 2022How to Train Your HiPPO: State Space Models with Generalized Orthogonal Basis Projectionscited by 121
  19. 2022Fast Finite Width Neural Tangent Kernelcited by 62
  20. 2024MoE-Mamba: Efficient Selective State Space Models with Mixture of Expertscited by 60
  21. 2017Unbiasing Truncated Backpropagation Through Timecited by 37
  22. 2024BlackMamba: Mixture of Experts for State-Space Modelscited by 37
  23. 2024Cut Your Losses in Large-Vocabulary Language Modelscited by 35
  24. 2022Simplifying and Understanding State Space Models with Diagonal Linear RNNscited by 23
  25. 2019Optimal checkpointing for heterogeneous chains: how to train deep neural networks with limited memorycited by 22
  26. 2024Mini-Sequence Transformer: Optimizing Intermediate Memory for Long Sequences Trainingcited by 6
  27. 2021Fast Jacobian-Vector Product for Deep Networkscited by 4
  28. 2023The Backpropagation algorithm for a math studentcited by 2

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025InfiniteHiP: Extending Language Model Context Up to 3 Million Tokens on a Single GPU
  2. 2024A Little Goes a Long Way: Efficient Long Context Training and Inference with Partial Contexts
  3. 2025Generalizing From Short to Long: Effective Data Synthesis for Long-Context Instruction Tuning
  4. 2024Discovering the Gems in Early Layers: Accelerating Long-Context LLMs with 1000x Input Token Reduction
  5. 2026DepthKV: Layer-Dependent KV Cache Pruning for Long-Context LLM Inference
  6. 2025From 128K to 4M: Efficient Training of Ultra-Long Context Large Language Models
  7. 2025MOM: Memory-Efficient Offloaded Mini-Sequence Inference for Long Context Language Models
  8. 2025Pruning Laws for Large Language Models