kossisoroyce/timber
Ollama for classical ML models. AOT compiler that turns XGBoost, LightGBM, scikit-learn, CatBoost & ONNX models into native C99 inference code. One command to load, one command to serve. 336x faster than Python inference.
What it solves
Timber eliminates the performance overhead and runtime dependencies of Python-based machine learning model serving. It allows developers to take trained classical ML models and convert them into highly optimized, standalone C99 binaries that can run in microseconds, making them suitable for high-frequency trading, edge devices, and safety-critical embedded systems.
How it works
Timber uses a multi-pass optimizing compiler pipeline:
- Parse: It reads models from various formats (XGBoost, LightGBM, scikit-learn, CatBoost, ONNX, or URDF robot descriptions) into a framework-agnostic Intermediate Representation (IR).
- Optimize: It applies passes like dead-leaf elimination, threshold quantization, and branch sorting to reduce the model's footprint and increase speed.
- Emit: It generates deterministic C99 code with no dynamic allocation or recursion.
- Compile: The generated code is compiled via
gccorclanginto a shared library. - Serve: A built-in HTTP server (Ollama-compatible) wraps the binary for immediate deployment.
Who it’s for
- Fraud and risk teams needing sub-millisecond transaction processing.
- Edge and IoT developers deploying to microcontrollers (e.g., ARM Cortex-M, ESP32, STM32) or gateways.
- Regulated industries (finance, healthcare, automotive) requiring deterministic, auditable, and certified inference artifacts.
- Infrastructure teams looking to remove the Python runtime from the critical path of their production stack.
Highlights
- Extreme Performance: Achieves single-sample latency of ~2 µs, which is over 300x faster than Python XGBoost.
- Broad Compatibility: Supports a wide range of frameworks including scikit-learn, XGBoost, LightGBM, CatBoost, and ONNX.
- Hardware Acceleration: The
timber accelbackend supports SIMD (AVX, NEON), GPUs (CUDA, Metal, OpenCL), and FPGAs. - Safety-Critical Tooling: Includes heuristic WCET (Worst-Case Execution Time) analysis and certification reports for DO-178C, ISO 26262, and IEC 62304.
- Zero Dependencies: Produces self-contained C artifacts (~48 KB) with no runtime requirements.