Tencent Hunyuan open-sources FlashTopK, a fast fused top-k kernel for sparse attention
Tencent Hunyuan released FlashTopK, an open-source fused top-k selection kernel for learned sparse attention. It is 1.7-3.3x faster than dense scoring plus FlashInfer top-k on trained indexers and 1.2-2.0x faster on untrained indexers. The repository is available on GitHub under Apache License 2.0.
China context
- Original name
- 腾讯混元
- Outside China
- Open weights · github.com
- Claims
- Company-reported; not yet independently evaluated
- For builders
- Developers outside China can integrate FlashTopK into their sparse attention pipelines to speed up top-k selection on NVIDIA Hopper GPUs. The Apache 2.0 license permits commercial use.
- For investors
- Tencent Hunyuan's release of a high-performance kernel for sparse attention signals its investment in efficient training and inference infrastructure, which could reduce costs for its own models and attract ecosystem adoption.
FlashTopK is a fast, exact, and deterministic fused top-k selection kernel for learned sparse attention in both training and inference. It supports token-level selection as in DeepSeek Sparse Attention (DSA) and models such as GLM-5.1, GLM-5.2, GLM-5.3, GLM-5.3-Flash, and Hy4-preview with indexers of 32 heads × 128. The kernel is tuned for NVIDIA Hopper GPUs (H800, H20, H100, H200) with FP8 or BF16 operands and topk up to 4096. It requires Python 3.10+, PyTorch 2.6+, Triton 3.3+, and CuTe DSL 4.5+. The repository includes performance reports, reproduction scripts, and a roadmap for block-level sparse attention, paged KV cache, and other head counts.
FlashTopK achieves speedups by fusing top-k selection and using adaptive key pruning with a score bound, rescoring rows that miss the sampled threshold on the GPU. It is deterministic, with ties at the k-th score keeping the smallest key indices, and is compatible with context parallelism because each row's threshold comes from a strided sample of its own window. The kernel is optimized for NVIDIA Hopper GPUs and supports FP8 or BF16 operands.
Developers working on sparse attention models can now use a faster open-source top-k kernel, reducing training and inference time on Hopper GPUs. This may lower compute costs for teams using models like DeepSeek Sparse Attention or GLM-5.x, and puts pressure on other top-k implementations to match its speed and determinism.
FlashTopK is released under Apache License 2.0, allowing commercial use and modification. Its speed improvements can reduce infrastructure costs for companies deploying sparse attention models, and its compatibility with popular models may accelerate adoption.
The roadmap indicates upcoming support for block-level learned sparse attention (e.g., CSA in DeepSeek-V4, QSA in Qwen3.8-Flash-Next), paged KV cache, and indexers with other head counts such as 64 heads. Watch for commits or releases addressing these items in the GitHub repository.