MOM (Memory-efficient Offloaded Mini-sequence Inference) is a novel optimization technique designed to slash the peak GPU memory required for Large Language Model (LLM) inference by over 50%. By partitioning MLP layers into "mini-sequences" and offloading the KV cache to the CPU, MOM enables a single 80GB GPU to handle up to 455,000 tokens—nearly triple the capacity of standard methods—without any loss in accuracy.
The Memory Wall in Long-Context LLMs
As LLMs move toward "infinite" context windows, they encounter a physical limitation: GPU VRAM. While attention mechanisms are often cited for memory issues due to quadratic scaling, the prefill stage presents a more immediate hurdle. During prefill, the model processes the entire input prompt simultaneously, creating a massive spike in "intermediate activations"—temporary data generated by MLP (feed-forward) layers. For long sequences, these activations can exceed the capacity of high-end GPUs, leading to Out of Memory (OOM) errors.
The MOM Approach: Mini-Sequences and Offloading
MOM addresses this bottleneck through two primary strategies:
- Mini-Sequence Partitioning: Instead of processing the entire sequence through MLP layers at once, MOM breaks the input into smaller "mini-sequences." These chunks are processed sequentially, allowing the system to free up intermediate memory after each chunk. Crucially, only the final token is processed through the last MLP and LM head, as it is the only one required to initiate text generation.
- Seamless KV Cache Offloading: MOM integrates directly with offloading mechanisms. As the prompt is processed, the resulting Key-Value (KV) cache tensors are moved to CPU memory (RAM) or disk, keeping the GPU's high-speed memory (HBM) available for active computation.
Importantly, MOM is mathematically equivalent to standard inference. Unlike quantization or pruning, it produces the exact same outputs (logits) as the original model, ensuring zero impact on accuracy.
Experimental Evaluation
The authors evaluated MOM across several state-of-the-art models, including Meta-Llama-3.2 (3B and 8B), Qwen2.5-7B, and Mistral NeMo (12B). Using the "Needle in a Haystack" benchmark, they verified that the model maintains retrieval capabilities across massive context lengths (up to 350k+ tokens).
Key results include:
- Context Extension: On a single NVIDIA A100 80GB GPU, MOM extended the maximum context of Llama-3.2-8B from 155k tokens to 455k tokens.
- VRAM Efficiency: Peak VRAM usage was reduced by over 50% on average.
- Throughput: Despite the partitioning and offloading overhead, total inference latency remained competitive with standard methods.
- Accessibility: MOM was shown to work on consumer-grade hardware, such as an RTX 4080 laptop GPU, when combined with 4-bit quantization.
Key Insights and Future Directions
A central takeaway is that for many long-context scenarios, the linear growth of MLP activations is a more significant bottleneck than the attention mechanism. By "chunking" MLP operations, MOM effectively shifts the research frontier from prefill optimization to decode-stage efficiency.
Future work involves integrating MOM into high-performance serving frameworks like vLLM or sglang. Additionally, combining MOM with KV cache compression techniques could push context limits even further, as the residual KV cache during the decoding stage becomes the next physical limit.
Summary updated