r/LocalLLM • • 24m ago

Research How I used real optimization (Mostly Gemini Neon) to take Inkling 2 Mini from 9.6 tok/s @ 16K to 25 tok/s & 192K context on a 6 GB RTX 3060 laptop

I use my predator helios mostly as a gaming rig and all of my office work (think-tank research and events etc, non-tech) is usually done on claude, all my side projects too. However, increasingly my work has been getting more and more politically sensitive, and I am starting to trust Claude lesser and lesser. Plus, it's not really helping with ML research on betting and trading which I do on the side. This pushed me to try local models earlier but none of them were usable/fast/smart enough to be worth it as an offline stack, both for sensitive work and for side projects. However, recently with Inkling and other local models, I thought I'd give it another try.

I first tried optimizing with claude which really did not help much, conveniently this is the same time as people reporting that claude was sandbagging and sabotaging local LLM work so I switched to gemini neon in antigravity and Im now fully setup with a local model at very usable speeds and quality, which is great for my setup with just 6GB VRAM and 24gb RAM. The following writeup is what gemini wrote so please forgive any slop type writing, the point of this post is to demonstrate what is capable even on systems such as mine, its genuinely mindblowing and I am immensely excited for what the future holds. I can do an even more detailed technical writeup on what gemini did if everyone here is interested, this is a short version. It wrote custom kernels and did a shit ton of optimization. I hope y'all like it! AI generated writeup starts below:

Most people write off 6 GB laptop GPUs (really only 5.1 GB usable VRAM on Windows) as "7B-8B toys." I wanted to see how far genuine low-level optimization could push a real 26.4B looped reasoning MoE (Inkling-2-Mini, 10.6 GB GSQ quant) on my Acer Predator RTX 3060 6 GB laptop (i7-10870H, 24 GB RAM).

The short version: optimization is not a 10% polish - it is the difference between barely usable and genuinely frontier-feeling local AI.

Before vs After (same laptop, same 5.1 GB VRAM ceiling)

StageContextDecode SpeedPrefill SpeedPeak VRAM
Starting llama.cpp baseline16K9.6 tok/s35-76 tok/s5984 MiB (spilling to RAM)
Earlier Claude optimization pass (declared "plateau")16K10.8-11.2 tok/s (9.1 uncensored)79-90 tok/s5974 MiB (spilling to RAM)
Final pass with Neon (custom CUDA + 4-bit KV)16K25.3 tok/s~340 tok/s<= 5130 MiB (zero spill)
Final pass with Neon32K25.1 tok/s (23.2 @ 29K)342.7 tok/s5128 MiB
Final pass with Neon64K24.4 tok/s (21.2 @ 58K)326.4 tok/s<= 5130 MiB
Final pass with Neon128K22.9 tok/s (19.5 @ 111K)301.9 tok/s5126 MiB
Final pass with Neon192K20.8 tok/s (16.7 @ 165K)276.1 tok/s5128 MiB

(That is 2.6x faster decode*,* 2.77x faster uncensored*,* 4.5x-9.6x faster prompt reading*, and* 12x more usable context on the exact same hardware.)

Why the earlier pass stalled (Claude vs Neon)

I started this project with Claude, and honestly it left almost all the real performance on the table:

  • It stayed stuck tweaking static layer offloading in llama.cpp, hit 10.8-11.2 tok/s, and literally wrote "STATUS: plateau" in the experiment log, claiming RAM bandwidth capped the laptop at ~18 tok/s max.
  • It accepted VRAM overcommit (~6.0 GB used on a 5.1 GB cap), which silently spilled into Windows shared memory and tanked long prompt speeds down to 44 tok/s.
  • It tried live LoRA uncensoring which wrecked decode speed by -41% (down to 9.1 tok/s), and never figured out how to get past 16K context.

Then I handed the whole optimization stack to Neon, and Neon did all the real heavy lifting from scratch:

  1. Switched to a dynamic GPU expert cache (maya-ik2): Instead of dumping whole model layers onto the slow CPU, it keeps ~85-88% of the hottest experts live in VRAM and streams only the rare misses over PCIe inside a single CUDA graph.
  2. Fixed hidden CUDA kernel bottlenecks: Found that the engine's quantized math kernels were spilling registers to slow local memory, rewrote them cleanly to zero spills, and reclaimed ~424 MiB of dead scratch memory that the engine was wasting on unused buffers - feeding every megabyte straight back into GPU expert slots.
  3. Built a custom 4-bit Hadamard KV cache (TurboQuant style): Cut KV memory in half vs FP8 (0.9933 cosine similarity vs FP16) with zero extra speed penalty - in fact 32K actually got faster because the freed VRAM held more experts. That is what unlocked 128K and 192K context with verified needle recall at 111K and 165K tokens.
  4. Zero-cost uncensoring & smarter caching: Replaced the slow -41% LoRA with native refusal-direction orthogonalization (zero speed drop), protected the model's 3-pass looped layers from getting evicted from cache, and used streaming PCIe reads so incoming weights don't pollute GPU cache.

Proof it's not just a benchmark toy: an 87K-token offline coding run

I wired the 128K profile into OpenCode alongside a 0 MiB VRAM offline Knowledge Hub (118 Kiwix ZIMs: full Wikipedia with a 41.5M semantic index + 100 DevDocs libraries + StackExchange over local MCP) and gave it a single cold prompt to build a multi-file Python CLI (riskwatch):

  • Look up SQLite FTS5 syntax in offline DevDocs and pull real maritime chokepoint stats from offline Wikipedia (zero hallucinated facts).
  • Build a trigger-synced FTS5 database with safe query sanitization (so inputs like Hormuz-2026, oil/gas, or unbalanced quotes don't crash SQLite).
  • Build a rolling z-score time-series anomaly engine with strict zero look-ahead bias (proven by mutating all future rows after day 45 to 1,000,000 and asserting earlier outputs stay bit-identical).
  • Write a full pytest suite, debug its own bugs, and generate an executive Markdown brief.

Result:

  • 76 tool calls (including 11 real offline MCP lookups), reaching 87,016 context tokens at 20.1 tok/s median (23.2 peak) and 81.1% median expert cache hit.
  • It caught and fixed its own missing SQL JOIN bug and timestamp parsing bug during the test loop.
  • 20/20 tests passing in 1.66s, full CLI pipeline + cited report generated. $0.00 API cost, zero internet.

This might be underwhelming for some of you running serious hardware, but for me this is gold, genuinely usable speeds and quality, I hardly even post on reddit now but this experience has made me make this post, quite insane imo!

2 Upvotes

2 comments sorted by

1

u/Odd-Customer-7957 21m ago

used Gemini neon on a 6gb 3060 too, got 22 Tok/s at 32k with inkling-2-mini, but needed to cap batch size at 1 to avoid crashes. your 192k context is wild; did you tweak any llama.cpp flags beyond --mmap?

1

u/powerrangersspd 16m ago

response from my clanker:

Not llama.cpp flags at all - I actually moved off llama.cpp onto a custom-modified `maya-ik2` (project-maya) build.

The reason llama.cpp makes you cap batch size / crashes past 32K on a 6 GB 3060 is that its static compute graph + whole-layer offload blows past the ~5,130 MiB Windows CUDA ceiling.

What unlocked 128K-192K cleanly at `--chunk 1024` (zero crashes, ~5,128 MiB peak) was three changes in `maya-ik2`:

  1. **Dynamic GPU expert cache (`IK2_OFF_DYN=1`, `IK2_ROOM_MB=128`, `IK2_LEND=1`):** Keeps ~80-88% of the hottest experts in VRAM inside a single CUDA graph and streams only misses over PCIe from pinned RAM (plus lends unused KV tail space back to experts when context isn't full yet).
  2. **Custom 4-bit Hadamard KV cache (`IK2_KV=tq4`, TurboQuant style):** Drops full-layer KV to ~8.1 KB/token (half of FP8, 4x smaller than FP16), so even 192K KV only takes ~1.6 GB VRAM while keeping 0.993 cosine similarity vs FP16.
  3. **Fixed scratch-buffer scaling:** Reclaimed ~424 MiB of dead attention scratch buffers that previously grew linearly with context length, keeping VRAM flat all the way to 192K without needing to cripple chunk/batch size.

(If you're sticking to llama.cpp on 6 GB, `-fa on -ctk q4_0 -ctv q4_0 -ub 256` + `-ot "token_embd\.weight=CPU"` helps avoid OOM/compute-buffer crashes without dropping batch all the way to 1, though llama.cpp's static layer offload will still hit a wall well before 128K.)