# Karpathy's Local LLM Acceleration Tricks Finally Solved: 5x Speedup on M5

> Andrej Karpathy revealed that local LLM decoding is primarily bottlenecked by memory bandwidth. The Uzu project combines 4/8-bit quantization, Hadamard transforms, and up to 16-token speculative decoding to boost inference from 22-25 tokens/s to 92-117 tokens/s on an M5 Mac, dramatically breaking through the memory wall.

- Source: https://www.waytoagi.com/en/kb/learning-path/karpathy-local-llm-uzu-speculative-decoding
- Original (Feishu, Chinese): https://waytoagi.feishu.cn/wiki/O2tKwzw3CiH0VrkWIcUcANyKnPg
- Updated: 2026-10-23

---

> 🔗 Original source: [Karpathy’s Trick for Faster Local LLMs, finally has a proper solution](https://x.com/akshay_pachaar/status/2108252095380140203)

> Akshay 🚀 · X · @akshay_pachaar · 2026-10-09 01:44

> 📌 This article is a repost. Copyright belongs to the original author. Please refer to the original link for the authoritative version.

![](https://www.waytoagi.com/api/kb-media/QiUUb8c9KoNIj4xmEgCczuUxnQf)

In 2023, Karpathy explained why local LLMs run slowly. When a model generates text on your own computer, the chip spends most of its time waiting for weights to arrive from memory, while its compute units sit idle.

![](https://www.waytoagi.com/api/kb-media/B6JDbInE7o2Nypx4WeqcH6oFnNg)

A few weeks later, he described a way around this problem. Checking multiple tokens in a single pass costs roughly the same as checking one, so a small draft model can guess ahead, and the main model can verify those guesses together.

The first observation still sets the ceiling today. The base Apple M5 chip moves 153 GB of data per second, while the 4-bit Qwen3.5 9B model weighs in at about 5.2 GB. With one token generated per pass, that puts the chip’s maximum throughput at roughly 29 tokens per second.

llama.cpp and MLX both come in just below that ceiling, reaching 22 and 25 tokens per second, respectively, on the same coding prompt.

The second observation is where there is room for improvement, but local implementations such as llama.cpp’s MTP mode can draft only three or four tokens at a time.

Uzu, an open-source inference engine from Mirai, takes this approach further on Apple Silicon. It drafts up to 16 tokens ahead, keeps those guesses coherent with one another, and verifies them in a single pass using kernels written for the M5.

![](https://www.waytoagi.com/api/kb-media/OywObZ41BoN16pxUjDocrrJTnqh)

On the same M5, with the same model and prompt, Uzu generated 92 to 117 tokens per second.

Let’s walk through where this ceiling comes from and how Uzu breaks through it, then benchmark it against llama.cpp and MLX using a benchmark client you can point at your own prompts.


# Why batch-one decoding is memory-bound

LLM inference has two distinct stages.

![](https://www.waytoagi.com/api/kb-media/RsiobWfE1oWFROxj2PdcHH9lnVt)

- Prefill processes the prompt tokens in parallel.

- Decoding generates response tokens one at a time.

Decoding is the stage that matters here: each new token requires another pass through the model. During that pass, the runtime reads blocks of weights and computes scores for the next token.

At a batch size of one, each forward pass advances just one sequence.

The total amount of computation is small relative to the volume of weight data being moved. To produce one token, the chip streams every model weight from memory into the GPU once, performing roughly one multiply-add operation per weight.

The GPU can finish these calculations before memory delivers the next block of weights. As a result, processing speed is often limited by memory bandwidth.

This gives us a hard upper bound. The base M5 moves 153 GB of data from memory per second. The 4-bit Qwen3.5 9B checkpoint weighs in at about 5.2 GB. If each pass produces one token, the model can generate at most 153 ÷ 5.2 ≈ 29 tokens per second on that chip, no matter how fast the GPU can compute.

Real-world engines perform slightly below this ceiling because each pass also reads other data, such as the cache for earlier tokens.

Quantization is the standard technique for improving this, reducing the bytes read per pass by using smaller weight representations.

![](https://www.waytoagi.com/api/kb-media/EnbHb1ucCoZpObxGxzzcbKl5njd)

However, quantization still optimizes the same single-token loop. The main model must run again for every token it generates.

In fact, quantization is already widespread, so let’s now look at what sets Uzu apart as an inference engine.

# How Uzu optimizes bytes and tokens per pass (How Uzu optimizes bytes and tokens per pass)

Uzu optimizes two quantities in the decoding loop. It reduces the bytes transferred per pass and increases the number of tokens accepted per pass.

![](https://www.waytoagi.com/api/kb-media/PDDob5ImQoQpgnxYx7PcTUZ8n6c)

- Quantization addresses the first quantity. It stores model weights using fewer bits. Smaller checkpoints require less memory traffic and leave more unified memory available for context and application state.

- Speculative decoding addresses the second quantity. It verifies multiple candidate tokens together. If multiple candidates are accepted, the sequence advances by multiple tokens.

Many local engines already support 4-bit weights. What sets Uzu apart is the hardware path built around that format.

Mirai releases multiple optimized checkpoints for the same base model. It labels them by size tier: M stands for Medium, and L stands for Large.

These labels describe the checkpoints, not different model architectures.

![](https://www.waytoagi.com/api/kb-media/BOZfbOlkToAUlwxQjRdcCmHfnke)

- Medium checkpoints use 4-bit asymmetric integer quantization.

- Large checkpoints use 8-bit symmetric quantization.

Medium prioritizes a smaller memory footprint, while Large retains more bits per weight. Mirai’s [**Quantization Explained**](https://trymirai.com/blog/quantization) describes how it combines post-training quantization with quantization-aware distillation.

The use of integer formats is deliberate, as it benefits both hardware execution and compression.

More specifically, unlike older Apple GPUs, the M5 achieves its highest arithmetic throughput with int8.

Uzu therefore also quantizes activations—the intermediate values passed between layers—to 8 bits on the fly. When both operands of each matrix multiplication are stored as integers, the speculative verification step runs on the M5’s hardware-accelerated int8 matrix path.

![](https://www.waytoagi.com/api/kb-media/FqribbXxoobty6xezrLcxt2MntE)

Lower precision introduces another problem.

Specifically, group quantization introduces rounding errors when a group contains outliers.

Every value in a group shares a scaling factor. That scaling factor must accommodate the largest magnitude. Smaller values are then represented using fewer integer levels, resulting in greater rounding error.

Uzu applies a block-diagonal randomized Hadamard transform before quantization. A Hadamard matrix contains only +1 and -1 entries, along with an overall scaling factor.

Multiplying a block of weights by this matrix mixes each value into every position, turning one large outlier into many moderately sized values.

“Randomized” refers to random sign flips applied before mixing, while “block-diagonal” means that each block of 32 values is mixed independently. The transform is fully reversible, so apart from rounding errors, it does not change the model’s computational results.

Mirai chose 32 elements to match the SIMD width of Apple GPU kernels. SIMD means that a single instruction runs across 32 GPU threads simultaneously, allowing one group of threads to transform one block.

Transform blocks and quantization groups control different operations.

- A transform block defines which values the Hadamard matrix mixes.

- A quantization group defines which values share quantization parameters.

These sizes do not need to match.

![](https://www.waytoagi.com/api/kb-media/BRE9bl756o5UZYxUDbDcL4esnHg)

Uzu’s differentiator is the co-design of numerical formats, transforms, and runtime kernels. Quantization reduces memory traffic and computation in each model pass.

However, standard decoding still returns only one token per target-model pass. Speculative decoding is the next lever Uzu uses to address this bottleneck.

# Producing several tokens from one model pass

Speculative decoding adds a small draft model alongside the main model.

The small draft model proposes future tokens at low cost. The main model checks these positions simultaneously. It accepts the valid prefix and continues from the first rejected token.

Suppose the draft model proposes five tokens and the main model agrees with the first four. That single verification pass advances the sequence by five tokens—the four accepted draft tokens plus the main model’s own token at the fifth position.

Standard decoding would require five separate main-model passes to generate the same text.

![](https://www.waytoagi.com/api/kb-media/IUSCbLx0YobLIGxttvocbTrinae)

The main model still controls the final output. The draft model merely proposes tokens that can be checked in parallel. A correct acceptance procedure preserves the target model’s output distribution.

The verification step requires more computation than single-token decoding.

But this approach is still preferable because local inference with a batch size of one often leaves arithmetic capacity idle while weights move through memory.

Speculative decoding uses that idle arithmetic capacity to reduce the number of main-model passes.

This trade-off depends on the acceptance rate. Longer drafts produce larger verification batches, but they also create more opportunities for early errors to invalidate subsequent tokens.

![](https://www.waytoagi.com/api/kb-media/PQyRb2NLHoTqMjxV8dacZCNrnwh)

Many model-native systems draft three to four tokens. A common example is multi-token prediction (MTP), which trains additional prediction heads within the model itself to predict the next few tokens.

Uzu uses a budget of 16 to 32 tokens in its M5 execution path. The Qwen3.5 9B checkpoint used later in this article comes with a 16-token tree budget for M5-series chips.

These larger batches give the M5’s Neural Accelerators enough work to do. These matrix units are built into each GPU core, and they only pay off when matrix multiplications involve many rows. Checking 16 candidate tokens at once gives them 16 rows of work rather than one.

Longer parallel drafts introduce a coherence problem.


# Issue with parallel draft generation

A fast parallel drafter predicts multiple future positions in one go.

As expected, each position sees the existing context but not the tokens selected at earlier draft positions.

Consider a prompt ending with “She went to the store to buy.” Independent positions might favor “a,” “few,” “of,” and “milk.” Each token seems plausible on its own. Together, however, they produce “a few of milk.”

![](https://www.waytoagi.com/api/kb-media/OXvUbkKAUoliEQxdED2c9YV5nMc)

An early mismatch causes the rest of the chain to be rejected. This is why acceptance rates tend to fall as parallel drafts grow longer. More positions create more opportunities for individually plausible tokens to form an invalid sequence.

The [**Trees from Marginals paper**](https://arxiv.org/abs/2607.06763) introduces Weaver to address this weakness. Weaver is an autoregressive adapter with 56.7 million parameters in the paper’s research setup. It operates on candidate shortlists rather than projecting over the full vocabulary.

![](https://www.waytoagi.com/api/kb-media/OG3BbHgnyolgUmx154ec5R49n4f)

The parallel DFlash drafter first predicts likely candidates for each future position in one pass. Weaver then selects from those candidates sequentially. Each choice can depend on earlier choices.

The previous example can now become “a gallon of milk.” Later choices follow the path already selected.

Weaver can also retain multiple coherent paths. One branch might contain “a gallon of milk.” Another might contain “a bottle of juice.” The main model verifies the tree and accepts the longest valid path.

![](https://www.waytoagi.com/api/kb-media/GbQXbwammowMxNxql9HcjY9vnyf)

The tree’s shape can adapt to the prompt. Predictable code can support long, narrow branches. Open-ended writing may need shorter branches with more alternatives.

![](https://www.waytoagi.com/api/kb-media/SoydbmVBboRaRBxOXvIcBbM0n3f)

The paper reports a 24.7% improvement over an optimized DFlash baseline. It also reports a 4.37× speedup over autoregressive decoding. Those experiments used CUDA and SGLang. They are research results, not universally applicable Uzu measurements.

Uzu applies the same drafting idea in its Apple-focused runtime. The remaining challenge is to verify the tree efficiently with the target model.

# Verifying a draft tree without restoring model state

Some model layers maintain a persistent internal state. Each new token reads and updates that state. For a single sequence, the runtime applies these updates in order.

A draft tree produces several possible continuation sequences. Each branch updates the state differently. If the runtime updates its live state while checking one branch, it must restore the previous state before checking another. Repeating this process across a large tree adds memory operations and redundant work.

Qwen3.5 and Qwen3.6 include stateful layers called Gated DeltaNet layers. Attention layers maintain a growing cache of past tokens. Gated DeltaNet layers instead compress everything they have seen into a fixed-size state, which changes with every accepted token.

In Qwen3.5 9B, 24 of the 32 layers are of this type.

Uzu separates branch verification from committing state updates. During verification, it computes the values needed for each candidate branch without changing the live state. The main model then selects the accepted path. Uzu applies state updates only for the accepted tokens.

![](https://www.waytoagi.com/api/kb-media/Oa9gbTTU8ofrdwxMiwJcF2AFnad)

This [**Uzu implementation write-up**](https://trymirai.com/blog/speculative-decoding-in-uzu) calls this rollback-free tree verification. Its Metal kernel computes DeltaNet outputs for the entire tree in a single loop-free pass, rather than advancing token by token along each branch.

State updates are then committed only along the selected path, so there are never any incorrect updates that need to be rolled back.

This matters because speculative decoding is worthwhile only when verification costs less than conventional token-by-token decoding. Repeatedly restoring state eats into those gains.

Combining Weaver with rollback-free verification allows Uzu to propose long token sequences and verify them without repeatedly restoring model state.


# What this looks like on a base M5

To compare conventional decoding, traditional speculative decoding, and Uzu’s approach, we ran the same Qwen3.5 9B model in three configurations on a MacBook Pro with a base M5 chip and 16 GB of unified memory:

- llama.cpp, without speculative decoding

- llama.cpp, using the model’s built-in MTP head to draft 3 tokens ahead—the traditional configuration

- Uzu, with DFlash and Weaver

All three used 4-bit weights and the same prompt: “Write a Python function to merge two sorted lists.”


# Published benchmark comparisons

Several public benchmarks for Uzu are now available, measuring output speed, input speed, memory usage, and quantization quality.

The speculative decoding results below use [**Qwen3.6 27B Mirai-M**](https://trymirai.com/local-models/alibaba-qwen3-6-27b-mirai-mirai-m-4). This checkpoint occupies 15.6 GB. Mirai performed the measurements on an M5 Max with 128 GB of memory.

![](https://www.waytoagi.com/api/kb-media/IssobR5nZoLCkzxXhA9cUaGSnke)

These figures show that Uzu runs at:

- 2.1 times the speed of MTPLX

- 3.8 times the speed of llama.cpp

- 4.4 times the speed of MLX.

Uzu also reaches 35.54 tokens per second without speculation. Its speculative decoding result reaches 114 tokens per second, meaning the speculative path delivers a 3.2× speedup.

Output generation speeds are also broken down by prompt type.

![](https://www.waytoagi.com/api/kb-media/UXT4b3M1GoAkD6xQ4Sqcxle0nEG)

Code and math contain many predictable continuations. Open-ended conversation gives the drafter fewer tokens it can reliably predict. Speculative decoding speed is therefore a property of the workload, not a fixed model parameter.

# Run a model locally and inspect the runtime

The quickest way to try Uzu is through its command-line tool. It installs via Homebrew and downloads the selected model on first use.

```bash
brew install mirai

mirai --model trymirai/Qwen3.5-9B-M \
  -m "Write a python function to merge two sorted lists"
```

We tested Mirai CLI 0.6.1 on a MacBook Pro with a base M5 chip, 16 GB of unified memory, and macOS 26.6.2. The first run downloads the model.

Here it is running in real time:

After producing the answer, the CLI printed the following statistics:

```markdown
time to first token: 0.12 s
prefill speed: 161.11 t/s
generation speed: 98.10 t/s
tokens per forward pass: 8.39 t/f
memory used: 5.77 GB
total energy: 114.90 J
input energy per token: 0.11 J/tok
output energy per token: 0.16 J/tok
duration: 7.36 s
```

Here is what these numbers mean:

- Time to first token is the wait before the first token of the answer appears. Most of that time is spent processing the prompt.

- Prefill speed is how fast the engine processes the prompt, measured in prompt tokens per second. Our prompt was only about 20 tokens long—too short for this number to tell us much. Longer prompts yield higher values.

- Generation speed is how fast the answer is generated, measured in output tokens per second. This is the decoding phase mentioned earlier, which is limited by memory bandwidth.

- Tokens per forward pass is the average number of output tokens produced by each forward pass of the 9B model. With standard decoding, this is exactly 1.00.

- Memory used is the unified memory occupied by the engine, primarily the model weights, plus the drafter and caches.

The 8.39 t/f figure shows the effect of speculative decoding. On average, each forward pass of the 9B model produces about 8 tokens. This is how generation reaches 98 tok/s on a chip whose single-token decoding limit is around 29 tok/s.

> Speeds vary slightly between runs. Across our repeated runs of this command, generation speed ranged from 92 to 117 tok/s, with 7.5 to 9.6 tokens produced per forward pass.

Speculative decoding is enabled on a per-chip basis. This checkpoint’s speculator configuration lists M5, M5 Pro, and M5 Max, so on M1 through M4 Macs, the same command runs without a drafter and reports 1.00 t/f.

The CLI reports latency, throughput, memory usage, energy consumption, and speculative decoding metrics. Now we can call the same runtime from an application.


# Call Uzu through a local application endpoint

Uzu can expose an OpenAI-compatible HTTP endpoint. The model still runs on the user’s Mac, and HTTP requests travel only over the local loopback interface.

Start the server in a terminal:

```bash
mirai server --model trymirai/Qwen3.5-9B-M --port 8000 --no-prefix-cache
```

The server loads a local checkpoint and listens on 127.0.0.1, allowing processes on the same Mac to call it. This is useful for existing applications that already communicate using the OpenAI chat protocol.

By default, Uzu retains a prefix cache. It stores previously processed prefixes from earlier prompts, allowing repeated prompts to skip most of the prefill work. --no-prefix-cache disables this feature so that every test request performs the full workload, keeping repeated runs comparable.

Existing applications can switch to Uzu by pointing their OpenAI client at http://127.0.0.1:8000/v1. The next section uses a small client to benchmark Uzu, MLX, and llama.cpp in exactly the same way.

# Using the Same Client for Uzu, MLX, and llama.cpp

Below is the same prompt run through each engine on a base M5. Each engine ran independently, with no other tasks running on the machine.

Both llama.cpp and MLX fall below the limit of 29 tokens per second, consistent with generating only one token per pass. In this recording, Uzu generates tokens about 3.7 times faster than MLX on the same chip.

To make this comparison with your own prompts, launch each engine as a local server and use a single client to time all three.

Local server interfaces give us a practical way to compare them.

Uzu, MLX LM, and llama.cpp can all serve OpenAI-style chat endpoints. We can run Qwen3.5 9B on all three engines and send the same prompt to each server.

Launch Uzu with Mirai’s [4-bit Medium checkpoint](https://huggingface.co/trymirai/Qwen3.5-9B-M):

```bash
mirai server --model trymirai/Qwen3.5-9B-M --port 8000
```

Launch MLX LM with a [4-bit MLX conversion](https://huggingface.co/mlx-community/Qwen3.5-9B-4bit) of the same base model:

```bash
brew install uv
uv tool install mlx-lm
uv tool update-shell
```

**uv tool update-shell** adds the directory containing **mlx_lm.server** to your shell’s PATH.

After running it, open a new terminal and start the server:

```bash
mlx_lm.server --model mlx-community/Qwen3.5-9B-4bit --port 8001
```

Launch llama.cpp with the [Q4_K_S GGUF checkpoint](https://huggingface.co/unsloth/Qwen3.5-9B-MTP-GGUF/blob/main/Qwen3.5-9B-Q4_K_S.gguf) used in Mirai’s published comparison:

```bash
brew install llama.cpp
llama-server --version

llama-server \
  -hf unsloth/Qwen3.5-9B-MTP-GGUF:Q4_K_S \
  --alias qwen3.5-9b-q4-k-s \
  -ngl 99 -fa on -c 8192 -np 1 \
  --port 8002
```

**-c 8192** prevents llama.cpp from reserving the model’s full 262K context, which would not fit alongside the weights on a 16 GB Mac. **-np 1** runs a single slot. To enable llama.cpp’s MTP drafting as shown in the first video, add **--spec-type draft-mtp --spec-draft-n-max 3**. MTP requires **-np 1**.

Each server downloads its checkpoint on first launch. Run only one server at a time so that just one copy of Qwen3.5 9B occupies unified memory during measurement.

> These three checkpoints come from the same Qwen3.5 9B model, but they do not use the same file format or quantization recipe. Uzu uses Mirai-M, MLX uses its own 4-bit conversion, and llama.cpp uses Q4_K_S. This is therefore a comparison of the complete engine stacks developers can run, not a kernel-only test.

Run the benchmark client against ports 8000, 8001, and 8002, one server at a time.

The test harness should keep the prompt text, output limit, sampling settings, and number of runs fixed. Use comparable quantization quality, not merely similar bit widths. Record native engine metrics in addition to end-to-end client timing.

Finally, here is a standalone client. Save it as compare_client.py. It uses only Python’s standard library and sends the same deterministic prompt to any OpenAI-compatible local endpoint.

It disables thinking so that each engine answers directly, and requests token usage from each server. It reports time to first token, end-to-end time, and decoding speed.

Uzu also reports the number of target-model passes it performs, so the script prints tokens per pass for Uzu as well.

```python
import json, os, sys, time, urllib.request

PROMPT = "Write a Python function that merges two sorted lists."

body = json.dumps({
    "model": os.environ["MODEL"],
    "messages": [{"role": "user", "content": PROMPT}],
    "temperature": 0,                                    # same answer every run
    "max_tokens": 1024,
    "stream": True,                                      # tokens arrive as they are made
    "stream_options": {"include_usage": True},           # server reports token counts
    "chat_template_kwargs": {"enable_thinking": False},  # answer directly, no thinking
}).encode()
request = urllib.request.Request(os.environ["ENDPOINT"], body, {"Content-Type": "application/json"})

start = time.perf_counter()
first = last = None
usage = {}

with urllib.request.urlopen(request, timeout=600) as response:
    for line in response:
        line = line.decode().strip()
        if not line.startswith("data:"):
            continue
        data = line[5:].strip()
        if data == "[DONE]":
            break
        event = json.loads(data)
        usage = event.get("usage") or usage
        for choice in event.get("choices") or []:
            delta = choice.get("delta") or {}
            text = delta.get("content") or ""
            if text or delta.get("reasoning_content") or delta.get("reasoning"):
                last = time.perf_counter()
                first = first or last
            print(text, end="", flush=True)

if first is None:
    sys.exit("No tokens received. Check the server log.")

tokens = usage.get("completion_tokens", 0)
print(f"\n\ntime to first token: {first - start:.2f} s")
print(f"end-to-end time:     {time.perf_counter() - start:.2f} s")
if tokens > 1 and last > first:
    print(f"decode speed:        {(tokens - 1) / (last - first):.1f} tok/s")
if usage.get("spec_verify_ct"):  # only Uzu reports how many model passes it ran
    print(f"tokens per pass:     {tokens / usage['spec_verify_ct']:.2f}")
```

# Run One Engine at a Time

Run only one server at a time so that only one copy of the model resides in unified memory and the engines do not compete for memory bandwidth.

For each engine, start the server in one terminal, then run the client twice in a second terminal. The first run includes warm-up work, so discard it and keep the second run. Stop the server with Ctrl-C before moving on.

For Uzu, start the server in the first terminal:

```bash
mirai server \
  --model trymirai/Qwen3.5-9B-M \
  --port 8000 \
  --no-prefix-cache
```

Run the client from the second terminal:

```bash
ENDPOINT=http://127.0.0.1:8000/v1/chat/completions \
MODEL=trymirai/Qwen3.5-9B-M \
python3 compare_client.py
```

Run the client twice. Discard the first result because it includes warm-up work. Keep the second result along with the decoding statistics printed by the Uzu server. Then stop Uzu with Ctrl-C.

Start MLX in the first terminal:

```bash
mlx_lm.server \
  --model mlx-community/Qwen3.5-9B-4bit \
  --port 8001
```

Run the same client from the second terminal:

```bash
ENDPOINT=http://127.0.0.1:8001/v1/chat/completions \
MODEL=mlx-community/Qwen3.5-9B-4bit \
python3 compare_client.py
```

Again, discard the first run and keep the second. Stop MLX with Ctrl-C.

Start llama.cpp in the first terminal:

```bash
llama-server \
  -hf unsloth/Qwen3.5-9B-MTP-GGUF:Q4_K_S \
  --alias qwen3.5-9b-q4-k-s \
  -ngl 99 -fa on -c 8192 -np 1 \
  --port 8002
```

Run the client from the second terminal:

```bash
ENDPOINT=http://127.0.0.1:8002/v1/chat/completions \
MODEL=qwen3.5-9b-q4-k-s \
python3 compare_client.py
```

Discard the first run and keep the second. Keep the following settings fixed across comparisons:

- The Mac and its power mode

- The prompt and chat template

- The output token limit

- Temperature and sampling settings

- The number of warm-up runs

- The number of measured requests

The client's decoding speed includes HTTP streaming overhead, so expect it to be slightly lower than the speed each engine prints in its logs. Compare the client-side numbers with one another, not with CLI numbers.

The Mirai CLI has no switch to disable speculative decoding, so this procedure compares the full engine pipelines rather than isolating DFlash-Weaver.

In the first video, llama.cpp runs with and without MTP, providing the closest same-engine comparison for observing the effect of speculative decoding.

# Conclusion

Loading a quantized checkpoint is only the first step toward local inference.

The real work is keeping generation practical when every request runs on the user’s device with a batch size of one.

Uzu tackles this at several levels.

- Quantization reduces memory traffic.

- Its Metal kernels are optimized for Apple hardware.

- DFlash-Weaver proposes longer token sequences, while rollback-free verification checks them without repeatedly restoring recurrent state.

On the base M5, this combination takes a 4-bit 9B model from 22 tokens per second with standard llama.cpp to 92 tokens per second with Uzu, using the same prompt.

Acceptance rates vary by workload. Hardware, quantization quality, context length, and thermal conditions also affect the results. A proper test should use your application’s prompts and measure both quality and latency.

If you want to dive deeper, the [**Uzu repository**](https://github.com/trymirai/uzu) includes the engine, a local server, build instructions, and bindings for Rust, Swift, Python, and TypeScript.

![](https://www.waytoagi.com/api/kb-media/A1I8b3t7aoBhgnxcaVYcjmpAnad)

Start with the local server, run the benchmark client from this article, and replace the sample prompts with requests from your actual product.

```bash
git clone https://github.com/trymirai/uzu.git
```

[**Find Uzu on GitHub →**](https://github.com/trymirai/uzu)

(Don’t forget to give it a star ⭐️)

Enjoy!
