Conghao97's picture tcftrees's picture
ProgramGen release
d086025
|
Raw History Blame Contribute Delete
3.08 kB

TurboQuant Command Reference

Quick reference for the commands documented in usage.md.

Benchmark CLI (benchmark example)

cargo run --release --example benchmark -- [FLAGS]
Flag Values Used with
--workload synthetic | trace | real-model all
--quick flag synthetic
--trace <PATH> safetensors file trace
--real-model-dir <DIR> ONNX bundle dir real-model
--prompt <TEXT> prompt string real-model
--real-eval-mode exact | quantized | compare real-model
--bits <N> integer bit width (keys) quantized/compare
--value-bits <N> integer bit width (values) compare
--real-key-strategy prod | mse quantized/compare
--top-k <N> integer compare
--max-new-tokens <N> integer real-model

Output: a benchmark report whose source field is one of synthetic, trace, or real-model. real-model mode reports logit RMSE, top-k agreement, token match/divergence rates, cross-entropy/perplexity, latency, tokens/sec, and exact vs quantized KV memory usage.

ONNX Decoder Export (scripts/export_hf_decoder_onnx.py)

python3 scripts/export_hf_decoder_onnx.py [--preset NAME | --model ID] --output-dir DIR
  • --preset: distilgpt2 or smollm2-135m-instruct (verified presets)
  • --model: explicit HuggingFace model id
  • --output-dir: destination for the exported ONNX bundle
  • Exports target text-generation-with-past, dtype fp32 (verified on the CPU ONNX Runtime path)

One-Command Eval Orchestrator (scripts/run_real_model_eval.py)

python3 scripts/run_real_model_eval.py [FLAGS]
Flag Meaning
--preset <NAME> verified export preset
--model-dir <DIR> reuse an existing ONNX bundle
--bits <N...> bit widths to sweep
--strategies <S...> prod, mse
--prompts <FILE> JSONL prompt suite (default: scripts/prompts/real_model_eval_prompts.jsonl)
--max-prompts <N> limit prompts
--max-new-tokens <N> generation length
--top-k <N> top-k metric window

Output: raw JSON plus a markdown summary report under artifacts/real-model-evals/.

KV Trace Export (scripts/export_hf_kv.py)

python3 scripts/export_hf_kv.py \
  --model <HF_MODEL_ID> \
  --input <PROMPTS_FILE> \
  --output <OUT.safetensors> \
  --layer <N> \
  --head <N>

Output: a per-head safetensors trace consumable by the benchmark example with --workload trace --trace <PATH>.

Environment Variables

Variable Meaning
TURBOQUANT_REAL_MODEL_DIR directory of an exported ONNX bundle used by the manual real-model smoke test

Setup Prerequisites

  • Rust 1.87.0+ (newer stable may be needed for the experimental gpu feature)
  • Python 3 venv with the pinned dependencies in assets/requirements-real-model.txt for the export/eval helper scripts
  • ONNX Runtime CPU binaries are fetched automatically by the ort crate on first Rust build