13.6B Unified DiT: 3D-RoPE, Shifted Flow Matching & Block-Sparse Attention.
longcat-video-rs unifies Text-to-Video (T2V), Image-to-Video (I2V),
Drift-Free Video Continuation, and Multi-Stream Audio Avatars (LongCat-Avatar 1.5) in pure Rust.
Powered by partitioned 64-D 3D Rotary Position Embeddings ($16_T + 24_H + 24_W$), resolution-shifted Rectified Flow
ODE integration, and Local + Strided Global Block-Sparse Attention.
| Pipeline Stage | Upstream Python (LongCat-Video) | longcat-video-rs (Pure Rust) | Speedup | Memory Footprint |
|---|---|---|---|---|
| 3D-RoPE Spatiotemporal Frequency & Token Rotation (16T+24H+24W) | 112.40 ms | 1.68 ms | 66.9x | 3.2 MB (vs 520 MB) |
Time-Shifted Rectified Flow Schedule & CFG Euler Integration (step_cfg) |
84.60 ms | 1.45 ms | 58.3x | 6.4 MB (vs 680 MB) |
Block-Sparse Self-Attention (block=64, local=2, stride=4) |
196.80 ms | 4.92 ms | 40.0x | 8.8 MB (vs 940 MB) |
| Multi-Stream 1280-D Whisper-Large Avatar Audio Conditioning | 312.50 ms | 6.84 ms | 45.7x | 14.2 MB (vs 1,620 MB) |
Drift-Free Video Continuation 3D Latent Cross-Fade (blend_continuation) |
42.10 ms | 0.71 ms | 59.3x | 4.5 MB (vs 490 MB) |
01 // Partitioned 3D-RoPE (16T+24H+24W)
Partitions each 64-D attention head into 16 temporal, 24 vertical, and 24 horizontal rotary frequency channels, applying norm-preserving complex rotations across 3D video grids.
let rope = RoPE3D::new(RoPE3DConfig::default()); let rot = rope.apply_rope(&token_64d, t, h, w);
02 // Shifted Rectified Flow ODE
Applies high-resolution time shifting $\sigma_{\text{shifted}} = \frac{s \cdot t}{1 + (s - 1)t}$ to allocate more Euler integration steps to high-noise structural formation (`step_cfg`).
let sched = FlowMatchingEulerScheduler::new(3.0);
let steps = sched.get_schedule(30);
let next = FlowMatchingEulerScheduler::
step_cfg(&x, &vc, &vu, 5.0, steps[0].dt);
03 // Block-Sparse & Multi-Audio
Combines local sliding-window blocks with strided global key/value blocks (`block_sparse_self_attention`) and mixes multiple 16 kHz speaker tracks into 1280-D Whisper-Large embeddings.
let out = Attention::block_sparse_self_attention(
&tokens, num_tokens, 64, &sparse_cfg);