← Back to Leaderboard
RTencent-Hunyuan

Tencent-Hunyuan/RiRoPE

HF Paper ↗

Native RoPE reindexing for sparse attention beyond the training context

View on GitHub ↗
LLM TrainerQuickstart ↓
Engineering Health (Methodology)
B · 53/100
Maintenance Activity
● Updated today
Latest Release
Rolling commits (main)
Commercial License Check
Custom / Check Repo

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption1/25
Release Cadence11/20
License Clarity6/20
GPUCLI
Total Stars
★ 21
24h Growth
+18
7d Growth
+21
Forks
0

GitHub Star History

Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.

Tencent-Hunyuan/RiRoPE Star History (2026-11-29 - 2026-12-01) DAILY STAR HISTORY (3-DAY D1 TELEMETRY) +20 in 2d · avg +10/day 25 13 0 2026-11-29: ★ 12026-11-30: ★ 62026-12-01: ★ 21 ★ 21 11-29 11-30 12-01

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

RiRoPE changes the coordinates used by sparse global attention, not the order of selected tokens. For each query, selected keys receive consecutive indices in their original order, with unselected gaps removed. Relative distances therefore stay in [0, B−1] for attention budget B rather than growing with the full sequence. Training and inference use the same rule. The OLMo-3-7B sparse backbone combines 24 sliding-window RoPE layers (4,096 tokens) with eight global layers that select the top 16 historical blocks plus the current block, at 128 tokens per block. These layers use block-count-corrected LogGate and softmax1; the RiRoPE indexer uses NoPE.

Fused SM90 sparse-attention kernels live in focus/. The model package registers two custom model types with Transformers, while configs/ carries stage and variant configurations and third_party/olmes/ freezes the evaluation harness. The locked Python 3.11 environment couples PyTorch 2.9.1 with CUDA 12.9 and Transformers 5.2.0; the stack also includes VeOmni, FlashAttention, Triton, NVIDIA CuTe DSL and Quack. Configured model variants and Transformers registration are the documented integration points.

Key Capabilities & Differentiators

The workflow spans dense Stage-1 checkpoint conversion, 8K and 64K continued pretraining, DCP-to-HF export, and standalone Hugging Face generation. Sparse initialization derives indexer weights through grouped FP32 head averaging. The two stages budget roughly 50B tokens each; moving to Stage 3 transfers model weights but starts a fresh optimizer and LR schedule. Resuming within a stage can restore optimizer, dataloader and SkipStep state. Six training variants cover dense RoPE, sparse positional baselines, RiRoPE, and an index_nope control that can switch to RiRoPE at inference without changing weights.

After matched 64K continued pretraining, RiRoPE scored 80.24 versus sparse RoPE+YaRN's 74.10 on 64K RULER, and 72.17 versus 15.21 at 512K without further training or retuning. On HELMET it scored 47.37 at 64K and 51.13 on the 256K extension; the latter averages five categories and is not a like-for-like comparison across lengths. The CLI also covers 12 general-capability benchmarks. Evaluation uses batch size 1 and 4,096-token prefill chunks above 32,768 tokens, with options for parallel workers or layer sharding across GPUs.

Trade-offs & Limitations

The strongest evidence is the comparison with sparse RoPE+YaRN on the same backbone, which isolates the positional choice more directly than the dense RoPE+YaRN baseline does. The improvement is not uniform across alternatives: sparse NoPE scores 49.20 versus RiRoPE's 47.37 on 64K HELMET, and 70.63 versus 72.17 on 512K RULER. Reindexing preserves order but discards the original distances across skipped tokens in global layers. It changes how selected keys are positioned; it cannot recover a historical block the indexer did not select.

Operationally, native training and paper-matched evaluation come at the cost of a specialized runtime. Sparse inference requires SM90, batch size 1 and unpadded inputs. The benchmark scores establish neither latency nor throughput, and the two 50B-token stages make full replication a different undertaking from checkpoint evaluation. Measure peak VRAM and prefill time on the target context before choosing a GPU layout. The repository license is unspecified, so verify rights before commercial deployment or redistribution.

Hardware & Deployment Guide

Plan for Linux x86_64, an NVIDIA SM90 GPU (tested on H20), CUDA 12.9 with nvcc, and a C++ compiler. scripts/setup.sh runs pixi install --locked and checks the stack; FlashAttention builds from source on first install. A build or login node can use --skip-gpu-check, then run pixi run --locked check on a compute node. The documented full recipes show eight GPUs and support multi-node FSDP2 with shared access to data and outputs. A generated fixture provides a two-GPU smoke path without external data.

Model and dataset access default to offline, so stage checkpoints, training Parquet shards and evaluation assets locally; the long-length RULER and HELMET extensions have separate data layouts. Full HELMET adds a judge for LongQA and summarization and local T5 NLI for citation, whereas the documented judge-free subset runs through 128K. This is a local CLI and Transformers workflow, not a turnkey serving deployment. The manifest version is 0.1.0, and there is no GitHub release milestone to anchor an upgrade plan.

Position encoding: Query-dependent reindexing bounds relative distances to [0, B−1] during both training and inference.
Attention layout: 24 local RoPE layers use a 4,096-token window; eight sparse global layers select 16 historical 128-token blocks plus the current block.
Training recipe: Continue OLMo-3-7B at 8K and then 64K for roughly 50B tokens per stage, using FSDP2/BF16 and a fresh optimizer and LR schedule at the stage transition.
Extrapolation: RiRoPE scored 80.24 at 64K and 72.17 at 512K on RULER without further training or positional retuning.
Evaluation: Frozen OLMES harness covers general tasks, RULER through 512K and a five-category HELMET extension at 256K.
Verification: Locked Pixi environment, a generated two-GPU smoke fixture, and regression tests for model, kernels, conversion, recovery and evaluation.
Best For

Research teams with SM90 access that need controlled OLMo-3-7B comparisons of sparse positional encodings, long-context extrapolation tests, or a local checkpoint-to-evaluation workflow.

Skip If

You need a production inference server with padded multi-request batching, verified support beyond SM90, a predictable VRAM and throughput budget without profiling, or clear commercial licensing out of the box.

Reviewed on 2026-12-01 · Grounded in GitHub README, root file tree & releasesMethodologyReport inaccuracy

Quick Start & Installation

GPUCLI
curl -fsSL https://pixi.sh/install.sh | bash   # skip if Pixi is already installed
bash scripts/setup.sh

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/Tencent-Hunyuan/RiRoPE.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

Tencent-Hunyuan/RiRoPE Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about RiRoPE

How do I load RiRoPE in Transformers, and can I switch an existing checkpoint?

Import model before using Transformers Auto classes so that olmo3_msa_loggate and olmo3_dual_rope are registered, then load a compatible HF checkpoint. The weight-preserving scripts/switch_to_rirope.py path is an ablation for index_nope Stage-2 or Stage-3 checkpoints, not a general converter for dense RoPE models.

What GPU do I need, and how should I size VRAM?

The sparse path targets NVIDIA SM90 and was tested on H20. The BF16 inference example uses batch size 1 and unpadded input. There is no VRAM figure or throughput measurement to size from: test peak memory and prefill time at the intended context length, and use the evaluation harness's layer sharding if the model does not fit on one GPU. Chunked prefill is not evidence that total memory is bounded by the chunk size.

Can we self-host it for commercial use?

Training and inference can run locally with prepared assets, but self-hosting does not establish usage or redistribution rights. No repository license is specified. Before commercial use, review THIRD_PARTY_NOTICES.md and the terms for the code, dependencies, checkpoints and datasets separately. If HELMET evaluation uses an external judge, review that provider's data-handling terms as well.

Which alternatives should I benchmark before adopting RiRoPE?

Use sparse RoPE+YaRN as the positional-encoding baseline: it shares the sparse backbone, and RiRoPE scored 72.17 versus 15.21 on 512K RULER in the matched OLMo-3-7B experiment. Include sparse NoPE as a stronger control: it reached 70.63 on 512K RULER and beat RiRoPE on 64K HELMET, 49.20 versus 47.37. Neither comparison establishes a serving throughput advantage.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining Tencent-Hunyuan/RiRoPE? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature Tencent-Hunyuan/RiRoPE on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare