Skip to content
All work
Systems/Low-level2024

ml_frame

A zero-dependency machine learning framework in roughly 2,800 lines of C11: arena allocator, reverse-mode autograd, multi-backend GEMM, and INT8 quantization.

ml_frame cover

Overview

`ml_frame` is a compact, dependency-free ML runtime built for correctness, reproducibility, and edge-oriented performance. The kind of framework you build to understand every byte and cycle.

Highlights

  • Arena-based memory with checkpoint/restore semantics and O(1) reset. No per-op heap churn, fully deterministic allocation.
  • Reverse-mode autograd over a topologically sorted graph with operator-level gradient callbacks (add, mul, matmul, relu, sigmoid, softmax, MSE, cross-entropy).
  • Runtime-dispatched GEMM across SCALAR, AVX2/FMA, ARM NEON, and optional CBLAS backends, with cache-blocked and packed-panel strategies plus optional OpenMP.
  • Full INT8 quantization surface: per-tensor and per-channel parameters, activation calibration, and integer `INT8 × INT8 → INT32 → INT8` requantization.
  • Versioned, checksummed weight I/O with strict metadata and integrity validation.

Backed by an extensive suite of validation, stability, fuzz/property, and benchmark tests.