# quantinfer **Repository Path**: zhuzhu-qlh/quantinfer ## Basic Information - **Project Name**: quantinfer - **Description**: No description available - **Primary Language**: Rust - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-10-31 - **Last Updated**: 2026-11-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # QuantInfer QuantInfer is a Rust-native edge LLM quantization and inference framework. The repository is organized around a backend-independent runtime, explicit model formats, an offline quantization pipeline, and optional hardware and deployment adapters. ## Workspace layers ```text quantinfer facade -> runtime / quantization / model / format -> core / kernel contracts -> CPU / WGPU / CUDA / Metal / Ascend backends ``` The default path executes Dense models on a native CPU and publishes QIF weights. GGUF remains a runtime compatibility input; SafeTensors can be converted to QIF or GGUF. WGPU, CUDA, Metal, Ascend, Candle interoperability and WASI-NN deployment are optional. Ascend's concrete F32 CANN binding and its tested boundaries are documented in the [backend README](backends/ascend/README.md). ## Checks ```bash cargo fmt --all -- --check cargo check --workspace --locked cargo test --workspace --locked ``` ## MVP flow Convert a Qwen3 SafeTensors checkpoint to the canonical QIF layout. Linear projection matrices are transposed into the runtime layout, and `--quantize q8_0` stores supported projection weights as Q8_0 blocks. Use `--output-format gguf` when a GGUF artifact is required. ```bash cargo run --locked -p quantinfer-convert -- \ --config config.json \ --weights model.safetensors \ --output model.qif \ --tokenizer tokenizer.json \ --quantize q8_0 ``` The converter also accepts `model.safetensors.index.json` with sharded weights and can emit a verified model manifest. Q4_0 uses the standard GGML block layout. ```bash cargo run --locked -p quantinfer-convert -- \ --config config.json \ --weights model.safetensors.index.json \ --output-format gguf \ --output model.gguf \ --manifest manifest.json \ --quantize q4_0 ``` Inspect the resulting metadata and tensor inventory. ```bash cargo run --locked -p quantinfer-cli -- inspect-gguf --input model.gguf ``` Run CPU Prefill and Decode from a natural-language prompt. The converter embeds the Qwen3 BPE vocabulary and merges into GGUF. ```bash cargo run --locked -p quantinfer-cli -- generate \ --input model.gguf \ --prompt "Hello, QuantInfer" \ --chat \ --max-new-tokens 16 \ --temperature 0.7 \ --seed 42 ``` The token-id form remains available for runtime smoke tests. ```bash cargo run --locked -p quantinfer-cli -- generate \ --input model.gguf \ --tokens 1,2,3 \ --max-new-tokens 16 \ --eos-token-id 2 ``` The GGUF reader accepts F32, F16, BF16, Q8_0, Q4_0, Q4_K, Q5_K, and Q6_K tensors. Linear quantized weights execute through the CPU reference kernel, while floating point tensors are normalized to F32 at load time. `--temperature` and `--seed` enable deterministic seeded sampling. `ByteTokenizer` remains a deterministic fixture for unit tests. The CPU runtime also supports Q4_0 linear weights and Llama-style Dense models with GQA. A model package directory containing `manifest.json` and its checksummed `model.gguf` can be passed directly to `quantinfer-cli`.