--- id: ring-flash-attn version: "0.1.8" license: unclear license_treatment: permissive maintenance: aging --- # ring-flash-attn — Ring attention implementation with flash attention. License: permissive · Maintenance: aging · Downloads: 215.9K/mo ## What it is and what it does Ring-flash-attn implements ring attention—a technique for distributing attention computation across multiple GPUs—by combining it with flash attention's memory-efficient kernels. It provides several variants: basic ring attention, zigzag ring attention (more compute-balanced), stripe attention, and llama3-style context parallelism, each available in batch and varlen (packed sequence) modes. The package includes a model adapter to substitute standard flash attention with ring attention during distributed training. The main use case is training large language models on multi-GPU clusters where you want to parallelize the attention computation across devices rather than just the model parameters. It trades off some per-GPU throughput for the ability to train with longer sequences or larger models by distributing the attention workload. The varlen API supports packed sequences (multiple samples concatenated), and the llama3 variant is recommended for most varlen use cases as it offers lower memory overhead and better precision. Use it for: - Train large language models on multi-GPU clusters with sequence lengths that exceed single-GPU memory by distributing attention computation across devices. - Implement context parallelism in transformer training to reduce per-GPU memory pressure and enable longer context windows. - Optimize attention computation in distributed training when you have NVLink connectivity between GPUs and want to balance compute utilization. - Integrate ring attention into existing model training pipelines via the provided adapter without major code refactoring. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Implements ring attention with flash attention for distributed multi-GPU training, enabling efficient sequence parallelism across devices with variants for different compute patterns and sequence packing strategies. Yes, if you are training large language models on multi-GPU clusters and need distributed attention parallelism. The package has low install friction, permissive licensing, and active (though aging) maintenance. However, it is specialized infrastructure code—not a general-purpose library—and requires a distributed training setup with multiple GPUs to be useful. Verify compatibility with your environment before committing to production use. ## Install pip install ring-flash-attn uv add ring-flash-attn poetry add ring-flash-attn ## Installing ring-flash-attn Before you install: Low install friction; pure Python wheel. Maintenance status is aging—last commit was 2025-09-10 and the project has not released since initial 0.1.8 version in 2024-09-20, though the repository remains active with 1044 stars. License in practice: MIT license (permissive); you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install ring-flash-attn from ring_flash_attn import substitute_hf_flash_attn, update_ring_flash_attn_params # Initialize distributed training and substitute flash attention substitute_hf_flash_attn(group, heads_k_stride=1) update_ring_flash_attn_params(cu_seqlens, group) Requires multi-GPU distributed setup with NCCL backend; NVLink between GPUs recommended for high performance. Designed for training frameworks with distributed support. Verify before relying: - Whether the package has undeclared runtime dependencies (fact sheet lists zero but description references external libraries). - Current stability and whether 0.1.8 is considered production-ready or still experimental. - Compatibility with specific versions of external dependencies beyond Python >=3.8. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 215.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags ring attention flash attention, distributed sequence parallelism, multi-gpu attention optimization, context parallelism training, varlen packed attention, distributed-training, attention-optimization, sequence-parallelism [View on SkillFed](https://skillfed.io/packages/ring-flash-attn) · [View on PyPI](https://pypi.org/project/ring-flash-attn/)