The primary obstacle to training models on extremely long sequences—whether they are 100,000-token documents or million-step reinforcement learning trajectories—is not the forward pass, but the "memory wall" of the backward pass.
In standard Backpropagation Through Time (BPTT), a model must store every intermediate hidden state generated during the forward pass to compute gradients later. This creates a memory footprint that scales linearly with the sequence length. As T. Konstantin Rusch and Siddhartha Mishra note in their work on UnICORNN, this linear scaling quickly exceeds the VRAM capacity of even the most advanced hardware, effectively capping the "context window" a model can actually learn from.
Recent research has converged on a shared goal: decoupling the ability to process long sequences from the requirement to store their entire history in memory.
The Adjoint Method and Parallel Gradients
One of the most promising directions involves replacing the sequential nature of BPTT with more efficient mathematical frameworks. In Adjoint sharding for very long context training of state space models, Xinyu Xu and colleagues introduce a parallelizable "adjoint method."
The intuition here is to treat the recurrent state evolution as a dynamical system. Instead of storing every state, the adjoint method allows for computing gradients by solving a separate "adjoint" equation. When combined with sharding across multiple GPUs, this technique reduced memory usage by 3x, enabling a 1.27B parameter State Space Model (SSM) to train on contexts exceeding 100,000 tokens. Similarly, Huachuan Wang proposed Streaming Propagation Through Time (SPTT), which uses low-rank matrix decomposition to decouple gradient computation into an optimization direction and an update magnitude, facilitating real-time online learning without the $O(L)$ memory penalty.
Segmented Recurrence and Memory Tokens
Rather than trying to optimize the gradients of a single massive sequence, another group of researchers suggests breaking the sequence into manageable segments while passing "memory" between them.
The Recurrent Memory Transformer (RMT), developed by Aydar Bulatov and Yuri Kuratov, prepends special "memory tokens" to each segment. These tokens act as a compressed representation of the past that the Transformer can read from and write to. By passing these tokens forward, Bulatov later demonstrated that models could scale to 1 million tokens and beyond with constant memory usage during inference.
However, training these recurrent mechanisms still poses a challenge. As Zifan He explains in the HMT (Hierarchical Memory Transformer) paper, one must carefully balance the "gradient depth"—how many segments back the gradients flow—to maintain stability without exploding computational costs.
Learning Long Dependencies via Truncation
If full BPTT is too expensive, can we get away with "truncated" BPTT? Normally, truncation prevents a model from learning dependencies longer than the truncation window. To fix this, researchers are adding "auxiliary signals" to the training process.
Trieu H. Trinh and Andrew M. Dai showed that adding unsupervised auxiliary losses—such as asking the model to reconstruct a past segment—allows a network to learn dependencies across 16,000 steps even when the gradient flow is truncated. This forces the hidden state to preserve relevant information for the long term, even if the "official" gradient signal doesn't reach that far back.
A similar philosophy is seen in AWESOME by Shuyang Cao and Lu Wang, which uses a "sneak peek" at global salient content to supplement truncated recurrent memory, allowing long-document summarization on consumer-grade GPUs.
Moving Beyond Step-by-Step Unrolling
Finally, some researchers argue that the bottleneck is the sequential nature of recurrence itself. Dobrik Georgiev and the team behind Deep Equilibrium Algorithmic Reasoning (DEAR) propose treating the final state of a recurrent process as an equilibrium point. By using implicit modeling and root-finding solvers, they can find the "solution" to a sequence without unrolling every intermediate step, bypassing the memory costs associated with traditional BPTT unrolling.
By combining these approaches—mathematical reformulations of the gradient, segmented memory passing, and auxiliary training signals—the field is moving toward a future where the length of the input sequence is limited only by time, not by the memory of the GPU.