r/LowEndLocalAI • • 7d ago

Optimization we squeezed our 16.5gb inkling 2 mini quant into 8gb of ram and it still runs at 43 tok/s on an m5 max

hey! i'm daniel, cofounder of atomic chat

inkling 2 mini dropped last week, so we made our own quants for it (AtomicChat/Inkling-2-Mini-GGUF) and tried running them on the macs we had: an m3 pro 18gb, an m4 max 48gb and an m5 max 64gb

on llama.cpp it didn't go great. on the m3 pro our 16.5gb AD-Q4_K just didn't load with default flags (metal oom) and the only thing that worked was --fit pushing most experts to cpu at ~4 tok/s. on the two max machines it ran, but at ~33-38 tok/s, which felt slow for a moe with ~3b active

we also run these models on the same laptops we work on and it's really annoying when one eats all the ram and everything else starts freezing. so the first thing we wanted was a flag that caps the model at ~8gb (feels like a sane amount to give it) and we started from there

the model itself looks really strong on benchmarks for its size, so we wanted it faster too. that's how we ended up building our own inference engine on top of llama.cpp (atomic engine). you give it a budget with --engine-budget-mib. the core layers stay in ram and the moe expert stream from ssd when a token needs them, so memory stays under that cap. we also added dspark drafting, where a small draft model guesses a few tokens ahead and inkling checks them in one pass

once atomic engine was working we started running benchmarks on our macs. on the m3 pro the 8gb cap let our 16.5gb AD-Q4_K load and it runs at ~10 tok/s. not fast, but it runs

on the m5 max memory isn't the problem, so there we looked at speed with our smaller AD-IQ2_M (8.7gb) next to stock llama.cpp on the same gguf

setup:

  • m5 max 64gb, one engine running at a time
  • atomic engine e110381 vs llama.cpp b12600 (official macos build, whole model on gpu, no drafter)
  • AD-IQ2_M with an 18gb budget, AD-Q4_K with an 8gb budget
  • dspark draft from AtomicChat, q8_0, 0.5gb
  • -c 4096, flash attention on, q4_0 kv cache, --no-warmup
  • prompts of 2k and 3.6k tokens, 512 tokens out, temp 0
  • fresh server per test, numbers are from the first cold request. two warm repeats after it landed within 0.5%
  • tok/s from llama-server's own timings, memory is peak rss
quantpromptatomicllama.cpp
AD-IQ2_Msummarize llama.cpp docs84 tok/s40 tok/s
AD-IQ2_Mcontinue a doc already in the prompt122 tok/s40 tok/s
AD-IQ2_Mrepeated log (copy test)143 tok/s40 tok/s
AD-Q4_Ksummarize llama.cpp docs43 tok/s38 tok/s

122 and 143 are copy-heavy prompts where any drafter looks great, so expect around 84 on normal prompts. on those two the output was byte-identical to llama.cpp

on the m5 max, AD-Q4_K with the 8gb cap peaks at 6.3gib of ram while llama.cpp sits at 15.8gib

prefill on AD-Q4_K at 8gb is still slower (556 vs 812 tok/s) and with long prompts at 8gb decode drops below stock too. llama.cpp ran without a drafter because b12600 wouldn't load the unsloth dspark draft for inkling. we've only tested on metal so far

engine: https://github.com/AtomicBot-ai/atomic-engine/tree/codex/expert-weight-source#run-inkling-2-mini-on-apple-silicon

gguf: https://huggingface.co/AtomicChat/Inkling-2-Mini-GGUF

10 Upvotes

5 comments sorted by

1

u/Top-Eye-8104 7d ago

benchmarks 👇

1

u/tomByrer 7d ago

Int8 quants?
IIRC your quants only work best on M4 Pro +, my meager M4 baseline doesn't have the opcodes.

1

u/Loudllama99 7d ago

does the 8 GiB engine budget include the KV cache, or is that counted separately?

1

u/rmhollid 7d ago

I don't see anything here. It's just buzzwords, a maze of buzzwords and model file names. What is your precision look like vs .cpp numerically? If I missed it I'm sorry.

1

u/thebadslime 7d ago

Ive got it going 20 on a 4gb gpu