ZunhaiSu/QuantStream3D
关于
Official implementation of QuantStream3D: Geometry-Aligned Low-Bit KV Cache Quantization for Streaming Visual Geometry Transformers.
人工智能与机器学习实测星标增长
- 24小时
- +1
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文QuantStream3D
Geometry-Aligned Low-Bit KV Cache Quantization
for Streaming Visual Geometry Transformers
Predominantly 2-bit geometric memory · Geometry-aligned distillation · Optimized packed inference
Zunhai Su · Keyu Fan · Ruishan Guo · Zhongzhu Zhou · Jingzehua Xu
Bohan Sun · Hansen Feng · Ruihan Hu · Yik-Chung Wu · Ngai Wong
Overview · Results · Quick Start · Checkpoints · Training · Citation

🔍 Overview
Streaming visual geometry transformers recover depth, camera motion, and 3D structure from historical cross-view KV states, but growing caches limit long-sequence inference. We systematically characterize KV quantization in streaming geometry and identify Nonuniform Geometric Sensitivity across precision choices and cache locations, together with Cache–Geometry Mismatch between quantized history and pretrained geometric computation.
We propose QuantStream3D, a geometry-aligned framework built around two core mechanisms:
- Geometry-Guided Mixed-Precision KV Quantization preserves sensitive cross-view evidence through per-channel K/V quantization, selective 2/4-bit precision, and paired Q/K rotation.
- Geometry-Aligned Quantization-Aware Distillation jointly adapts transformer blocks and geometry heads on student-generated quantized history, aligning current predictions and future cache writes with compressed memory.
We further integrate QuantStream3D with existing cache-pruning methods, pushing compression beyond pruning alone. Our optimized StreamVGGT backend fuses paired Q/K transforms, K/V encoding, and historical decoding into the attention operands to translate storage savings into measured inference gains.
📊 Results
Geometric accuracy
Across five benchmarks and two backbones, QuantStream3D maintains near-lossless geometric accuracy in most settings with predominantly 2-bit history, and many configurations outperform their unquantized counterparts.
Compared with LLM-oriented KV quantizers, it reduces TUM trajectory error and NeuralRGBD completeness error by up to 57.4% and 69.7%, respectively.
| Backbone | Method | TUM ATE ↓ | NeuralRGBD accuracy ↓ | NeuralRGBD completeness ↓ |
|---|---|---|---|---|
| StreamVGGT | Original | 0.0269 | 0.084 | 0.079 |
| KIVI | 0.0493 | 0.096 | 0.089 | |
| QuaRot | 0.0509 | 0.091 | 0.083 | |
| QuantStream3D | 0.0264 | 0.074 | 0.066 | |
| STream3R | Original | 0.0258 | 0.065 | 0.034 |
| KIVI | 0.0608 | 0.133 | 0.152 | |
| QuaRot | 0.0509 | 0.139 | 0.126 | |
| QuantStream3D | 0.0259 | 0.065 | 0.046 |
Distances are in meters. Quantized baselines use their KV-quantization components at 2 bits; QuantStream3D uses mixed 2/4-bit caching and adapted weights. Model weights and queries remain at native precision. See the paper for complete metrics, baseline settings, and post-pruning results.
Beyond pruning. On NeuralRGBD, QuantStream3D improves mean accuracy, completeness, and normal consistency for InfiniteVGGT, XStreamVGGT, and FrameVGGT, while further compressing InfiniteVGGT's retained KV by 6.27×.
Efficiency beyond nominal bit width
| Complete StreamVGGT inference on H20 | Original | QuantStream3D | Improvement |
|---|---|---|---|
| Inference time, batch 1 (720 views) | 175.73 s | 135.14 s | 23.1% lower |
| Peak allocated memory, batch 1 | 15.40 GiB | 8.26 GiB | 46.3% lower |
| Persistent KV storage, batch 1 | 8.27 GiB | 1.64 GiB | 5.05× compression |
| Maximum batch size, 120-GiB budget | 5 | 27 | 5.4× capacity |
| Peak throughput, 120-GiB budget | 4.700 frames/s | 7.835 frames/s | Up to 1.67× |
Batch-one results cover eight independent 90-view requests under a 60-GiB budget; batch scaling uses a 120-GiB budget on the same H20. Capacity and peak throughput are separate operating points. Efficiency comparisons use the same pretrained weights to isolate the backend; geometric-accuracy results use QAD weights. Timings include the backbone and prediction heads, after loading and preprocessing. Physical KV storage includes quantization parameters and padding. See profiling for the full measurement boundaries.

🛠️ Installation
Use Python 3.11+ and install PyTorch 2.5+ for your CUDA environment, then install QuantStream3D:
git clone https://github.com/ZunhaiSu/QuantStream3D.git
cd QuantStream3D
python -m venv .venv
source .venv/bin/activate
# Install the PyTorch build appropriate for your system, then:
python -m pip install -e '.[cuda,weights]'
Triton kernels require Linux and an NVIDIA CUDA GPU. Use '.[weights]' for the CPU reference implementation. Full-model execution also requires the upstream source and its dependencies:
git clone https://github.com/wzzheng/StreamVGGT.git third_party/StreamVGGT
git -C third_party/StreamVGGT checkout 05682bcb05683c4c71522e9cb618fc8ca349063c
# Install StreamVGGT's dependencies following its README.
See compatibility for supported workflows and pruning-integration scope.
🚀 Quick Start
1. Run a sequence
Download the adapted checkpoint, then pass a directory of chronologically named RGB images:
python scripts/download_checkpoint.py --model streamvggt
python examples/infer.py \
--upstream third_party/StreamVGGT \
--checkpoint checkpoints/quantstream3d_streamvggt \
--images data/my_sequence/rgb \
--mode packed --backend triton \
--output outputs/my_sequence.npz
Outputs contain camera pose, depth, depth confidence, 3D points, and point confidence. This example resizes images to a fixed patch-aligned size; use benchmark-specific preprocessing for quantitative evaluation.
Use --backend torch for the packed reference implementation. Both backends use the same quantization policy and the released QAD-adapted weights.
Run STream3R instead
git clone https://github.com/NIRVANALAN/STream3R.git third_party/STream3R
git -C third_party/STream3R checkout 7bdca8cf7ec206ff8b08c0941ad8286d72087d4f
# Install STream3R's dependencies following its README.
python scripts/download_checkpoint.py --model stream3r
python examples/infer_stream3r.py \
--upstream third_party/STream3R \
--checkpoint checkpoints/quantstream3d_stream3r \
--images data/my_sequence/rgb --backend triton \
--output outputs/my_sequence.npz
Both inference entry points work with the point-cloud export command below.
2. View the reconstructed scene
Export a colored point cloud without installing an additional visualization library:
python examples/export_pointcloud.py \
--predictions outputs/my_sequence.npz --images data/my_sequence/rgb \
--output outputs/my_sequence.ply
Open the PLY in MeshLab, CloudCompare, or your preferred 3D viewer. The helper supports both backbones; its sampling and confidence filter are for visualization.
Python API
import torch
from quantstream3d import QuantizedCache
from quantstream3d.upstream import load_images, load_model
model = load_model("third_party/StreamVGGT", "checkpoints/quantstream3d_streamvggt")
views = load_images("data/my_sequence/rgb")
with torch.no_grad(), QuantizedCache(model, mode="packed", backend="triton") as cache:
with torch.autocast("cuda", dtype=torch.bfloat16):
predictions = model.inference(views, query_points=None)
storage = cache.audit(len(views))
The adapter modifies only the selected model instance and restores its methods on exit. Start each independent sequence with a fresh cache.
🤗 Checkpoints
Both checkpoints use 2,000 QAD updates. 2/4-bit describes the runtime KV cache; model weights retain their native precision.
| Checkpoint | Weights |
|---|---|
| QuantStream3D–StreamVGGT | Hugging Face · 5.03 GB |
| QuantStream3D–STream3R | Hugging Face · 4.76 GB |
The download helper verifies pinned revisions, file sizes, and SHA256 digests. See checkpoint instructions for download and loading details.
🧠 Training
Geometry-Aligned QAD uses chronological clips from MVS-Synth and PointOdyssey-TRAIN. A frozen original-precision teacher supervises a student that creates, reads, and updates its own simulated-quantized history. Joint updates cover transformer blocks and geometry heads. Train StreamVGGT with:
torchrun --standalone --nproc_per_node=4 examples/train.py \
--upstream third_party/StreamVGGT \
--checkpoint checkpoints/streamvggt_original.pth \
--manifest data/clips/manifest.json \
--output outputs/qad --steps 2000
See training for the objective and optimizer, and data preparation for clip export. Training uses differentiable simulated quantization; inference uses physically packed INT2/INT4 storage.
⚡ Kernels and profiling
| Optimization | Fused work | Benefit |
|---|---|---|
| Paired Q/K rotation | Q and K H64 transforms in one launch | Fewer launches for the shared basis change |
| Paired K/V encoding | Group statistics, affine quantization, and byte packing | Fewer launches for cache writes |
| Historical reads | Packed decode into history-plus-current operands | Removes separate decoded-frame buffers and concatenation copies |
The fused kernels construct floating-point attention operands from physically packed KV; native SDPA performs attention.
Kernel validation and profiling commands
python -m pip install -e '.[test,eval]'
python examples/quantize_cache.py --device cpu
python -m pytest -q -m 'not cuda'
python examples/kernel_parity.py --tokens 1004
python -m pytest -q -m cuda
python examples/profile.py \
--upstream third_party/StreamVGGT \
--checkpoint checkpoints/streamvggt_original.pth \
--images data/my_sequence/rgb \
--mode packed --backend triton --warmup 1 --repeats 3 \
--output outputs/packed_profile.json
Run matched original inference with --mode native --backend torch in a separate process. See PROFILING.md for timing, memory, warmup, and tracing.
Repository guide
| Path | Contents |
|---|---|
src/quantstream3d/ |
Quantizer, packed runtime, QAD objective, and Triton kernels |
examples/ |
Inference, training, profiling, export, and evaluation |
configs/ |
Method recipes and checkpoint manifest |
docs/ |
Checkpoint, data, training, evaluation, and implementation guides |
tests/ |
Quantization, cache lifecycle, gradients, metrics, and CUDA parity |
Citation
@article{su2026quantstream3d,
title={QuantStream3D: Geometry-Aligned Low-Bit KV Cache Quantization for Streaming Visual Geometry Transformers},
author={Su, Zunhai and Fan, Keyu and Guo, Ruishan and Zhou, Zhongzhu and Xu, Jingzehua and Sun, Bohan and Feng, Hansen and Hu, Ruihan and Wu, Yik-Chung and Wong, Ngai},
journal={arXiv preprint arXiv:2611.27901},
year={2026}
}
Acknowledgments and license
We thank the authors of StreamVGGT, STream3R, and the upstream libraries for their public implementations.
This package retains CC BY-NC-SA 4.0, consistent with its StreamVGGT-derived components. See LICENSE.txt and THIRD_PARTY_NOTICES.md for attribution and component-specific terms. Upstream model and dataset terms also apply.
探索相关项目
加载中…