atlas

Research map / Large language models / Language, safety and interpretability

TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation

ICML 2025 · Large language models › Language, safety and interpretability · approach: Parallel and early-exit decoding · 0 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 TokenSwift, a lossless speculative-decoding framework that accelerates generation of 20K–100K token sequences using self-drafting heads, n-gram token reutilization, dynamic partial KV cache, and a contextual repetition penalty, achieving over 3x speedup.

Problem

Generating ultra-long sequences with LLMs takes hours; existing short-sequence speculative decoding methods fail to accelerate at this length due to model reloading, growing KV cache, and repetitive generation.

Approach

Use the target model itself as the draft model with only a few trained linear heads (Medusa-style, chained residually), add n-gram retrieval from generated text for extra draft candidates, maintain a dynamically updated partial KV cache ranked by query-key importance, and apply a windowed contextual penalty to reduce repetition while keeping lossless verification.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
add token reutilization (k=20) rather than disable it (k=0) (ablation)TokenSwift · LLaMA3.1-8B, ultra-long generationspeedupHelped
use dynamic partial KV cache updates instead of a one-time partial cache update (ablation)TokenSwift · LLaMA3.1-8B, 100K tokensspeedup: 1.44 -> 1.96Helped
use dynamic partial KV cache updates instead of retaining the full cache (ablation)TokenSwift · LLaMA3.1-8B, 100K tokensspeedup: 1.47 -> 1.96Helped
add contextual penalty (θ=1.2, W=1024) (ablation)TokenSwift with min-p sampling · LLaMA3.1-8B, 100K tokensaverage Distinct-n: 0.12 -> 0.69Helped
add contextual penalty (θ=1.2, W=1024) (ablation)TokenSwift with min-p sampling · LLaMA3.1-8B, 100K tokensspeedup: 3.58 -> 3.27Hurt
use tree [1,3,3,3] instead of [1,9,9,9] (ablation)TokenSwift · LLaMA3.1-8B, 100K tokens, k=0speedup: 0.96 -> 1.96Helped
use tree [1,3,3,3] instead of [3,3,3,3] (ablation)TokenSwift · LLaMA3.1-8B, 100K tokens, k=0speedup: 1.91 -> 1.96Helped
vary temperature across 0.4–1.2 (ablation)TokenSwift with top-p sampling · LLaMA3.1-8B, 100K tokensacceptance rate: 0.89, 0.90, 0.85, 0.87, 0.83Mixed
increase prefill length from 2048 to 8192 while disabling token reutilization (ablation)TokenSwift · LLaMA3.1-8B, 100K tokensspeedup: 1.87 -> 1.77Hurt
increase penalty window from W=20 to W=2048 (ablation)TokenSwift · LLaMA3.1-8B, 100K tokensspeedup: 3.58 -> 3.31Hurt
increase penalty window from W=20 to W=2048 (ablation)TokenSwift · LLaMA3.1-8B, generated sequence diversityaverage Distinct-n: 0.79 -> 0.80Mixed

Surprising findings

Limitations

Experimental setup

Datasets: PG-19 Wikipedia (20231101.en) C4-en

Benchmarks: PG-19

Metrics: acceptance rate speedup Distinct-n

Baselines: TriForce* Medusa* autoregressive decoding

Builds on: Medusa TriForce Speculative decoding SnapKV

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