Build the engine: tiny-llm and learning local models from the bottom

@oliviscusAI posted about tiny-llm on Nov 4, and Ivan Fioravanti (@ivanfioravanti) passed it along the next day. It's an open-source course by Alex Chi Z (@iskyzh): github.com/skyzh/tiny-llm. The README calls it "a hands-on course for systems engineers who want to understand LLM inference end to end," the serving counterpart to CMU's Needle project.

What you build

It's a four-week path, and per the README it goes like this:

  1. Week 1. Build a Qwen3 model straight from mlx.core array operations: attention, RoPE, grouped-query attention, RMSNorm, the MLP, sampling and the autoregressive loop.
  2. Week 2. Make one request fast: a KV cache, keeping 4-bit weights packed, SIMD matrix prefill and tiled prefill.
  3. Week 3. Build a mini vLLM: continuous batching, chunked admission and a paged KV cache that attention reads directly.
  4. Week 4. Build a small coding agent: a validated agent loop with approved edits, checkpoint-and-resume and context compaction.
TINY-LLM, FOUR WEEKSWeek 1: Qwen3 from mlx.coreattention, RoPE, grouped-queryattention, RMSNorm, the MLP,sampling, the autoregressive loopWeek 2: one request, fastKV cache, packed 4-bit weights,SIMD matrix prefill, tiled prefillstatus: some chapters in progressWeek 3: mini vLLMcontinuous batching, chunkedadmission, paged KV cacheWeek 4: small coding agentvalidated agent loop with approvededits, checkpoint-and-resume,context compactionstatus: Days 1 through 9 out now
Fig. 1. The four-week path per the tiny-llm README by Alex Chi Z, with status as stated in this post. Dashed boxes are the weeks with a status note.

The rule that makes it a course and not a tutorial: when a chapter teaches an operator, you write it yourself in Python, C++ or Metal instead of calling the optimized MLX version. MLX stays around as the answer key and the speed baseline. As @oliviscusAI put it, you have to measure the improvements yourself.

YOU WRITEthe operator a chapterteachesin Python, C++ or Metal,instead of calling theoptimized MLX version MLX STAYSthe answer keyand the speed baseline
Fig. 2. The rule that makes it a course, per the tiny-llm README by Alex Chi Z: you write the operator yourself, and MLX stays as the answer key and the speed baseline.

It runs on Apple Silicon, so no NVIDIA GPU. One honest note: the README's roadmap still marks some Week 2 chapters as in progress, and Week 4 is being published one reviewed day at a time, with Days 1 through 9 out now.

Why I'd do this

A lot of what I post about local models is tok/s. I posted going from 30 to 70 TPS on Qwen 3.8 Flash Next on my M3 MacBook Pro. tiny-llm is the layer under numbers like that: what a KV cache actually saves, why packed 4-bit weights matter, what batching does to memory.

Week 4 is the part I care about most. I already wrote up a small agent running on my old Mac with LFM3 and tool calls. tiny-llm has you build that agent loop on an engine you wrote yourself, with checkpoints and context compaction as real code instead of a config flag.

I haven't taken the course yet, so this isn't a review. It's where I'd point anyone who asks how local models actually work on a Mac. Clone it, run Week 1 and see how far you get.

Credit for the course: Alex Chi Z, tiny-llm. Found via @oliviscusAI's post.

Tags: Local inference MLX Quantization

All ship logs