icml2026-submit/untied_ulysses

Python

0

1 commits

updated Jan 29, 2026

See the code

README

Untied-Ulysses

An efficient implementation of Untied Ulysses — a sequence parallelism method for training LLMs on extremely long contexts (up to 5M+ tokens).

Installation

# From repo root
uv venv && source .venv/bin/activate

cd torchtitan
uv pip install torch==2.9
uv pip install flash-attn==2.8.3 --no-build-isolation --no-cache
uv sync --no-build-isolation --active

cd ../long-context-attention
uv pip install -e .

Optional: FlashAttention 3 (Hopper GPUs)

Required to reproduce exact tokens/second numbers from the paper.

git clone https://github.com/Dao-AILab/flash-attention
cd flash-attention/hopper
uv pip install -U setuptools wheel packaging ninja
MAX_JOBS=128 uv pip install . --no-build-isolation

Usage

Scripts

Scripts to reproduce Table 3 and Figure 4 from the paper are in torchtitan/exps/llama3_8b/ and torchtitan/exps/llama3_70b/.

ModelScriptDescription
8Brun_single.shSingle experiment
8Brun_all.shFull benchmark (128K-5M)
8Brun_single_multinode.shSingle experiment (2 nodes)
8Brun_all_multinode.shFull benchmark (512K-9M, 2 nodes)
70Brun_single_70B.shSingle experiment
70Brun_all_70B.shFull benchmark (128K-1M)

Quick Start

cd torchtitan/exps/llama3_8b

# Run single experiment
CONTEXT_LENGTH=131072 bash run_single.sh

# Run all experiments
bash run_all.sh

Multinode (8B, 2 nodes)

Run the same command on both nodes simultaneously:

cd torchtitan/exps/llama3_8b

# Run single experiment
NNODES=2 RDZV_ENDPOINT="master-hostname:29500" bash run_single_multinode.sh

# Run all experiments
NNODES=2 RDZV_ENDPOINT="master-hostname:29500" bash run_all_multinode.sh

Configuration

VariableDefaultDescription
CONTEXT_LENGTH2M (8B) / 128K (70B)Sequence length
STEPS10Training steps
BATCH_SIZE1Batch size
NNODES1Number of nodes
NPROC_PER_NODE8GPUs per node
RDZV_ENDPOINTlocalhost:29500Master node (multinode only)

Attention Methods

attn_implDescription
upipe_fa2_offload_tiled_mlpUntied Ulysses (ours)
usp_fa2_offload_tiled_mlpUSP zigzag baseline
torch_ring_alltoallPyTorch baseline

For Hopper GPUs, use _fa3_ variants instead of _fa2_.

icml2026-submit/untied_ulysses

Python

0

1 commits

updated Jan 29, 2026

See the code

README

Untied-Ulysses

An efficient implementation of Untied Ulysses — a sequence parallelism method for training LLMs on extremely long contexts (up to 5M+ tokens).

Installation

# From repo root
uv venv && source .venv/bin/activate

cd torchtitan
uv pip install torch==2.9
uv pip install flash-attn==2.8.3 --no-build-isolation --no-cache
uv sync --no-build-isolation --active

cd ../long-context-attention
uv pip install -e .

Optional: FlashAttention 3 (Hopper GPUs)

Required to reproduce exact tokens/second numbers from the paper.

git clone https://github.com/Dao-AILab/flash-attention
cd flash-attention/hopper
uv pip install -U setuptools wheel packaging ninja
MAX_JOBS=128 uv pip install . --no-build-isolation

Usage

Scripts

Scripts to reproduce Table 3 and Figure 4 from the paper are in torchtitan/exps/llama3_8b/ and torchtitan/exps/llama3_70b/.

ModelScriptDescription
8Brun_single.shSingle experiment
8Brun_all.shFull benchmark (128K-5M)
8Brun_single_multinode.shSingle experiment (2 nodes)
8Brun_all_multinode.shFull benchmark (512K-9M, 2 nodes)
70Brun_single_70B.shSingle experiment
70Brun_all_70B.shFull benchmark (128K-1M)

Quick Start

cd torchtitan/exps/llama3_8b

# Run single experiment
CONTEXT_LENGTH=131072 bash run_single.sh

# Run all experiments
bash run_all.sh

Multinode (8B, 2 nodes)

Run the same command on both nodes simultaneously:

cd torchtitan/exps/llama3_8b

# Run single experiment
NNODES=2 RDZV_ENDPOINT="master-hostname:29500" bash run_single_multinode.sh

# Run all experiments
NNODES=2 RDZV_ENDPOINT="master-hostname:29500" bash run_all_multinode.sh

Configuration

VariableDefaultDescription
CONTEXT_LENGTH2M (8B) / 128K (70B)Sequence length
STEPS10Training steps
BATCH_SIZE1Batch size
NNODES1Number of nodes
NPROC_PER_NODE8GPUs per node
RDZV_ENDPOINTlocalhost:29500Master node (multinode only)

Attention Methods

attn_implDescription
upipe_fa2_offload_tiled_mlpUntied Ulysses (ours)
usp_fa2_offload_tiled_mlpUSP zigzag baseline
torch_ring_alltoallPyTorch baseline

For Hopper GPUs, use _fa3_ variants instead of _fa2_.