Bina 0.4 Koochik β ONNX-INT4
Calibration-aware 4-bit derivative of Reza2kn/Bina-0.4-Koochik, using checkpoint 18,404. The architecture and 630,800,496 unique parameters are unchanged. Original training was not modified.
170 linear weight matrices use symmetric GPTQ codes with group size 32 and FP32 group scales, calibrated on 64 approved training-only regions with fresh 18,404 source sequences. Tied input/output embeddings, convolutions, positions, norms, biases and unused auxiliary heads keep higher precision. β4-bitβ describes those linear codes, not every stored parameter or activation. The canonical packed candidate is 533,891,055 bytes, about 6.771 effective bits per original parameter including higher precision exceptions and serialization; this runtime package has a different footprint, including separate components and any duplicated tables. No native BitNet or universal speed claim is made.
Validation
Actual target-runtime results on the frozen 64-image / 14,127-source-character qualification set, using the included pixel-layout-v2 pipeline:
| Runtime | Corrected source character parity | Original whole-page parity | New caps / repetition flags |
|---|---|---|---|
| ONNX CPU (Apple M2) | 98.9028% | 97.4063% | 0 / 0 |
| ONNX auto β CUDA (RTX 5080 Laptop) | 98.9028% | 97.4063% | 0 / 0 |
Character agreement is 1 - pooled NFC Levenshtein edits / pooled NFC source characters, unclipped. The corrected source is the immutable uncompressed BF16 cast of the original checkpoint, run on the same pixel regions with source decoding. Original whole-page results are reported separately. These are source agreement measurements, not human-annotated OCR accuracy, per-image guarantees, or an independent unseen OCR benchmark. The final set was used for runtime qualification, not quant fitting or candidate selection. Calibration and final source groups are disjoint.
Greedy decoding uses repetition penalty 1.1, at most 2,048 tokens per region and the source's at-most-one resolution retry. No passage-stopping guard, no-repeat constraint, output deduplication or hidden truncation improves these scores. Token caps and repetition are audited. The pixel-only layout covers all original pixels once. Small decorative text, logos, handwriting and complex layouts can still differ. Markup mode is available but was not separately corpus-qualified.
Tested with ONNX Runtime 1.31.0 CPUExecutionProvider on Apple M2 and CUDAExecutionProvider on an NVIDIA RTX 5080 Laptop GPU (16 GB), Python 3.13.11 / CUDA 13. The automatic CUDA run completed all 64 images and 71 regions with no whole-model CPU fallback. Startup profiling executed 410 CUDA MatMulNBits kernels plus CUDA convolution, attention and other operations; CPU shape/control nodes remain allowed. TF32 is disabled and decoder keys/values stay on CUDA between steps. This repo uses custom split com.microsoft.MatMulNBits graphs and the included runner. Vision attention tiles queries while preserving all keys. Prefill and decode share one external weight file.
--device auto selects CUDA only after provider initialization, deterministic synthetic component/prefill/cached-decode checks and evidence that actual quantized kernels ran on GPU. It uses CPU when CUDA is unavailable or fails those checks. ONNX CoreML EP failed capability checks for these graphs and is excluded: ONNX auto on macOS currently uses CPU. Use the Tract Metal derivative or native CoreML derivative for validated Apple GPU paths. DirectML, ROCm, TensorRT, arbitrary GPUs, phone runtimes and sherpa-onnx are not qualified by these results.
Use
The complete runtime download is approximately 739.9 MB (decimal), including higher precision exceptions, split components, tokenizer/position assets and runtime files. INT4 does not mean every parameter or activation is four bits.
Download the complete repo, including external model data and runtime-probe/. In a fresh environment, choose one ONNX Runtime package:
# CPU installation (also the ONNX path on macOS)
python -m pip install -r requirements.txt
python run_ocr.py --format onnx --device auto --image examples/demo.png --output result.json
# NVIDIA CUDA 13 installation, in a separate fresh environment
python -m pip install -r requirements-cuda.txt
python run_ocr.py --format onnx --device auto --image examples/demo.png --output result.json
requirements-cuda.txt uses onnxruntime-gpu[cuda,cudnn]==1.31.0 and the tested Linux Torch stack. Use a compatible NVIDIA driver. Do not install the CPU and GPU ORT wheels together. Inference does not install packages or alter global CUDA configuration; it discovers installed NVIDIA library directories for its isolated worker.
Pass --device cpu to force CPU, or --device cuda / --device gpu for strict GPU execution that raises on GPU failure. The default auto recovers from failed initialization, worker exit, nonfinite logits or a timed-out GPU transaction by restarting the entire current region on CPU with fresh prefill/KV. It records the reason and failed partial token IDs, commits only the fresh CPU result, and stays on CPU for subsequent regions. Four GPU sessions remain loaded for the lifetime of the model. Startup probes add cold-start work; reuse the model instance for multiple requests.
result.json records the actual selected backend, kernel probe and fallback events. Corpus validation in that report is selected for the backend actually used; it does not assert parity for the new input. See validation/automatic-backends.json for full64 GPU results and fault-injection recovery checks.
The demo is newly authored synthetic text. Its independent-folder installation smoke reached natural EOS and transcribed both lines exactly. The private user letter, training examples and protected qualification images/transcriptions are not included. validation/character-parity.json contains aggregate evidence. artifact-manifest.json lists release hashes.
Source and license
The standalone parent contains the original FP32 checkpoint weights and complete upstream provenance. This derivative inherits OpenMDW 1.1; preserve LICENSE and third-party notices. See quantization.json for source/candidate hashes. Parent architecture: NVIDIA Nemotron-3.5-Parse. The binary/runtime versions and arithmetic profiles are part of the qualification; changing them requires another check.
Local latency diagnostic
On the same newly authored 400Γ104 PNG (34 generated tokens) on an Apple M2 Mac, the supplied loader settings produced warm median end-to-end times of onnx: 1.076 s across three real repeated generations. Only one inference process was active; normal desktop apps and the idle resident browser could remain present. These historical manual-loader measurements predate the automatic startup probes and are not current automatic cold-start timings, corpus throughput, mobile measurements or a universal speed claim. See validation/latency-demo-*.json.