# 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 ` | safetensors file | `trace` | | `--real-model-dir ` | ONNX bundle dir | `real-model` | | `--prompt ` | prompt string | `real-model` | | `--real-eval-mode` | `exact` \| `quantized` \| `compare` | `real-model` | | `--bits ` | integer bit width (keys) | `quantized`/`compare` | | `--value-bits ` | integer bit width (values) | `compare` | | `--real-key-strategy` | `prod` \| `mse` | `quantized`/`compare` | | `--top-k ` | integer | `compare` | | `--max-new-tokens ` | 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 ` | verified export preset | | `--model-dir ` | reuse an existing ONNX bundle | | `--bits ` | bit widths to sweep | | `--strategies ` | `prod`, `mse` | | `--prompts ` | JSONL prompt suite (default: `scripts/prompts/real_model_eval_prompts.jsonl`) | | `--max-prompts ` | limit prompts | | `--max-new-tokens ` | generation length | | `--top-k ` | 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 \ --input \ --output \ --layer \ --head ``` Output: a per-head safetensors trace consumable by the `benchmark` example with `--workload trace --trace `. ## 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