Jet-Long: Efficient Long-Context Extension with Dynamic Bifocal RoPE
Summary
Jet-Long is a tuning-free, zero-shot method designed to efficiently extend the context window of large language models (LLMs) for applications like retrieval-augmented generation and agentic workflows. It employs a bifocal approach, combining a local RoPE-faithful window with a long-range window whose rescaling factor dynamically adapts to the current sequence length. This ensures the base model's performance is preserved at short inputs while enabling clean extrapolation at long ones, addressing position out-of-distribution issues. The method's construction, including an inclusion–exclusion attention merge and on-the-fly RoPE correction rotation, is optimized for inference. Fused into a single CuTe kernel, Jet-Long achieves up to 1.39x FlashAttention-2 throughput on H100 for long-context prefill and incurs ≤ 4% overhead for single-batch generation. It demonstrates superior performance on Qwen3-1.7B/4B/8B models up to 128K context, leading RULER by +4.79/+2.18/+2.03 pp over baselines, achieving best overall accuracy on HELMET-RAG, and lowest PG-19 perplexity. Jet-Long also generalizes to hybrid attention architectures such as Jet-Nemotron.
Key takeaway
For machine learning engineers deploying open-weight LLMs in long-context applications, Jet-Long offers a robust, tuning-free solution to extend context up to 128K tokens without sacrificing short-context performance or incurring significant inference overhead. You can adopt this method to improve RAG, coding, and agentic workflows, benefiting from its superior accuracy on benchmarks like RULER and HELMET-RAG, while maintaining near FlashAttention-2 throughput on H100 GPUs.
Key insights
Jet-Long dynamically adapts RoPE scaling for efficient, tuning-free LLM context extension, preserving short-context fidelity.
Principles
- Dynamic RoPE factor adapts to sequence length.
- Bifocal attention combines local and remote windows.
Method
Jet-Long uses a dynamic group size G for remote position mapping f(x)=⌊ x/G⌋, maintains an uncompressed KV cache with on-the-fly correction rotations, and merges three FlashAttention passes via inclusion–exclusion for prefill.
In practice
- Achieves 1.39x FA2 prefill throughput on H100.
- Generalizes to hybrid attention architectures.
Topics
- Long-Context LLMs
- Rotary Position Embedding
- Zero-Shot Context Extension
- FlashAttention
- Inference Optimization
- Qwen3
Best for: Research Scientist, AI Engineer, AI Scientist, Machine Learning Engineer, NLP Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by cs.AI updates on arXiv.org.