atlas

Research map / Architectures and efficiency / Attention and transformers

Mini-Sequence Transformers: Optimizing Intermediate Memory for Long Sequences Training

NeurIPS 2024 · Architectures and efficiency › Attention and transformers · approach: Sparse efficient transformers for long context · 1 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes Mini-Sequence Transformer (MsT), which splits MLP and LM-Head computation into sequence-wise mini-sequences to cut intermediate activation memory, enabling 12-24x longer training contexts on a single A100 without throughput or convergence loss.

Problem

Long-sequence LLM training is limited by large intermediate activations in MLP and LM-Head blocks (e.g., logits over large vocabularies), which cap context length even with activation recomputation.

Approach

Partition each input sequence into mini-sequences processed iteratively inside the MLP and LM-Head blocks, with gradient accumulation in the backward pass, so only S/M of intermediate tensors are materialized at once; combined with activation recomputation and chunk-based sizing (C=d) to avoid throughput loss.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Apply mini-sequence processing with activation recomputationLlama3-8B-hf · single A100maximum sequence length (K): 14 -> 60Helped
Apply mini-sequence processingLlama2-7B-hf · single A100maximum sequence length (K): 45 -> 84Helped
Apply mini-sequence processingQwen2-7B · single A100maximum sequence length (K): 13 -> 74Helped
Apply mini-sequence processinggemma-2-9b · single A100maximum sequence length (K): 5 -> 36Helped
Apply MsT with activation recomputationLlama3-8B-hf · 8k sequence, batch size 2, single A100TFLOPS: 3271.42 -> 3194.90Hurt
Increase batch size to 8 using MsTLlama3-8B-hf · 8k sequence, single A100TFLOPS: 3271.42 -> 3386.13Helped
Disable activation recomputation (ablation)MsT on Llama2-7B-hf · 4k sequence, batch size 1, single A100TFLOPS: 2684.67 -> 3115.03Helped
Train with 30k rather than 8k context using MsTLlama3-8B-hf · LongAlpaca-12kperplexity: 7.41 -> 3.45Helped
Apply MsT rather than activation recomputationLlama3-8B-hf · single A100, 4k sequencepeak memory (GB): 52 -> 48Helped
Add activation recomputation (ablation)Llama3-8B-hf training · single A100, 4k sequencepeak memory (GB): 74 -> 52Helped
Add mini-sequence processing (ablation)Llama3-8B-hf with activation recomputation · single A100, 4k sequenceactivation memory overhead (GB): 7GB to 4GBHelped
Increase the number of mini-sequences (ablation)MsT · training; shorter and longer sequencesexecution timeMixed

Surprising findings

Limitations

Experimental setup

Datasets: LongAlpaca-12k

Benchmarks: LongAlpaca-12k

Metrics: maximum sequence length training throughput (TFLOPS) training time per step perplexity loss

Baselines: vanilla PyTorch / HuggingFace training activation recomputation 8-bit quantization 4-bit quantization Huggingface PEFT

Builds on: activation recomputation FlashAttention-2 DeepSpeed-Ulysses HuggingFace Transformers

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy