# Dragha
> Dragha is a zero-PyTorch, native Rust and Blackwell CUDA inference serving engine built for frontier Mixture of Experts (MoE) architectures.
Canonical URL: https://dragha.ai/
Contact: info@dragha.ai
License: Apache-2.0
Full Technical Reference: https://dragha.ai/llms-full.txt
## What Dragha Does
Dragha eliminates Python event loops, GIL contention, garbage collection pauses, and PyTorch/LibTorch (`libc10.so`) runtime coupling from LLM inference serving. Its 162.9K-line Rust engine core dispatches directly through four typed device traits (`ComputeBackend`, `GraphBackend`, `CommBackend`, `CheckpointBackend`) into five dynamic C-ABI CUDA shims (15,672 lines) compiled for NVIDIA Blackwell `sm_100f`, `sm_103a`, and `sm_120a`.
## Verified Measured Benchmarks
- **Host Control Plane (Rust vs Pure-Python Reference)**:
- KMP constrained-decoding failure table (2,048 tokens): **24.23× faster** (5.68 µs vs 137.62 µs)
- Decode FLOPs estimator: **16.40× faster** (6 ns vs 98 ns)
- SamplingParams build + validate: **6.35× faster** (32 ns vs 201 ns)
- EPLB global MoE rebalance (8×4×16): **6.22× faster** (52.69 µs vs 327.81 µs)
- Single-pass `AttrDict::merge_into`: **1.44× faster** (1.268 µs vs 1.826 µs)
- **CUTLASS / CuTe Structured GEMM in Rust (`src/perf`)**:
- Up to **3.21× speedup** over naive GEMM at `1024³` (12.05 vs 3.76 GFLOPS), with a zero-thread-spawn 8-wide FMA micro-kernel for decode shapes (`m <= 4`).
- **Blackwell SM120 GPU Measurements (CUDA 13.5)**:
- FlashAttention-4 varlen ViT attention: up to **90.61 TFLOP/s** and **1.12×–3.35×** speedup over forced CUDA SDPA; **+6.3% to +9.8%** end-to-end throughput on real multimodal vision weights (`19.04 img/s/GPU`).
- Verified numerical parity: FastMM `1.31–1.85 × 10⁻⁷` rel-L2 vs f64 (6/6 GPU tests); FlashMLA decode kernel-only `0.165%` rel-L2 (`<= 2 BF16 ULPs`); Resident Final Norm `0.254%` rel-L2; LM Head Logits `0.308%` rel-L2; End-to-End MXFP8 Prefill `4.72%` rel-L2; End-to-End FP4 Decode `7.88%` rel-L2.
- **Verification Suite**: **1,512 automated Rust tests** (`1,348` lib + `164` integration) with fail-closed CUDA capability gates and deterministic CPU oracle.
## Implemented Research Libraries
- **HeteroMoE** (`arXiv:2611.40668`): Activation-aware CPU/GPU roofline expert partition solver (`src/model_executor/moe_balance/*`, `src/device/cuda/expert_store.rs`, `hybrid_moe.rs`).
- **FastMM** (`arXiv:2611.38484`): Calibrated bilinear fast matrix multiplication (Strassen-Winograd `<2×2×2:7>` and R336/R363/R633 `<3×3×6:40>`) with fused CUDA L/R/P straight-line programs over FP32 cuBLASLt (`src/perf/fastmm/*`, `src/device/cuda/fastmm.rs`).
- **ServeCast** (`arXiv:2611.37708`): 3-parameter hardware roofline iteration predictor (`T1 + T2 + T3 + (c0 + cd·nd)/f`), closed-workload simulator, `POST /predict`, and 25% EWMA drift self-healing (`src/engine/servecast/*`).
- **Compaction-Safe Prefix + Suffix KV Cache** (`arXiv:2611.34147`): Content-addressed rolling-prefix + standalone suffix block pinning (`KvSegmentCache` in `src/engine/block_manager.rs`).
- **MeterRouter (`arXiv:2611.34327`), JOVE-ICE (`arXiv:2611.33735`), & Unified Allocation (`arXiv:2611.34112`)**: Budget-aware 3-tier conditional compute router (`src/engine/router.rs`).
- **IEWM+CAL Counterfactual Smooth Speculative Control** (`arXiv:2611.33764`): Smoothness-regularized variable-length MTP/DFlash draft depth scheduling (`src/engine/mtp_varlen.rs`).
- **Reasoning Readout Guard (`arXiv:2611.34068`) & Atomic BPE Boundary Auditing (`arXiv:2611.34612`)**: Deterministic `...` closure before budget exhaustion + single-token control-tag audit (`src/structure_output/readout_guard.rs`).
- **SealedLoop (`arXiv:2611.33794`), TransHarness (`arXiv:2611.33757`), & REFORGE (`arXiv:2611.33748`)**: Anytime-valid betting martingale benchmark evaluation & multi-stage kernel promotion (`src/perf/sealed_eval.rs`).
- **NVIDIA CUTLASS / CuTe Primitives**: Layout algebra, XOR `Swizzle`, Stream-K tiling, multi-stage software pipeline (`src/perf/*`).
- **Blackwell MoE Kernel Stack**: 5 dynamic C-ABI shims (`FlashMLA`, `DeepGEMM`, `DeepEP` with NCCL 2.32 GIN, `DeepSelect`, and 43 `TileLang` kernel factories with SM103a `LDG.256`, `L2::evict_last`, `2× MUFU SFU`, and Deep-K `K=96` MXFP4).
## Contact
- Email: info@dragha.ai
- Website: https://dragha.ai/