If you've found this article useful consider donating.
I want to propose a new kind of AI engineering: Hill-Climbing Engineering, or more honestly, vibe hill-climbing. And I'm only half joking.
First, I'd like to point out that I am by no means a GPU engineer. If you asked me to hand-tune a Metal kernel on Apple Silicon or write a Vulkan graphics fix, I'd draw a complete blank.
This whole thing actually started because I was doom-scrolling Twitter (yes, I still call it Twitter, sue me), as one does, and came across Sybil Solutions' open-source inference-optimisation skill. I decided to try it out on a local 27B AI model on my MacBook, and to my surprise, it actually worked. Then I put on my thinking cap and figured, well, if this works so well for inference optimization, why wouldn't it work for optimizing a Switch game I wanted to play on my Retroid Pocket 6? So I tried it there too, and got real, measurable speedups out of both.
If you've been following AI Twitter, you've probably noticed how fast the "___ engineering" labels keep coming. Prompt engineering stuck around for two years. Context engineering lasted about a year. Harness engineering showed up in early 2026. Loop engineering lasted six weeks before a one-line joke tweet from Peter Steinberger ("Are we still talking loops or did we shift to graphs yet?") and a "Stop it" GIF from Hamel Husain accidentally turned Graph engineering into a whole thing over a single weekend.
So yeah, adding another label to that pile is partly a joke. The reason I'm serious about it is that vibing your way through hard performance work shouldn't really work, and the only reason it did for me is the set of rules the agent had to follow.
What loops and graphs miss
| Paradigm | Core question | Assumes |
|---|---|---|
| Prompt (2022–24) | How do I word this? | One turn is enough |
| Context (2025) | What should the model see? | Right info = right answer |
| Harness (early 2026) | What tools & guardrails surround it? | Right sandbox = safe run |
| Loop (June 2026) | How do I retry until done? | "Done" is pass / fail |
| Graph (July 2026) | How do agents route work? | Wiring is the bottleneck |
| Hill-Climbing | How do we push a noisy score toward the hardware limit with receipts? | "Done" is a continuous score, and measurements lie |
Loops are great when "done" is a simple yes or no (does it compile, do the tests pass?). Graphs are great when you want to split a job across different roles (planner, coder, reviewer). Neither really covers what happens when "done" is a noisy physical target like tokens per second or frames per second.
If you drop a smart AI into a normal loop and just tell it "make this faster", four things usually go wrong:
- Measurements lie. Chips heat up, throttle down, and swing ±5–20% between runs. One lucky benchmark looks like a huge win.
- Averages hide bugs. A game can show a totally normal average frame rate while stuttering 70 times during a 90-second fight, or an AI tweak can speed up one test while quietly slowing down normal chat.
- Models cheat or quit early. If an AI gets to grade its own homework, it will drop work, quietly hurt output quality, or celebrate a random swing from a cool chip. When you can't read the low-level diff yourself, you won't catch it.
- Memory disappears. Once a chat gets long and compacts (or you switch models), the next session goes right back to trying ideas that already failed hours ago.
So instead of trying to become a GPU engineer overnight, the trick is flipping the setup around: stop engineering the climber, and engineer the hill. If the test setup makes faking progress impossible, you don't have to understand every line of C++ to trust that the speedup is real.
And you don't even have to build the hill by hand. You hand the AI a skill built around six rules, and make it build and lock the hill before you trust any of its numbers.
The six rules
- Measure the hardware ceiling first. Measure your actual machine before touching any code (never trust spec sheets). Local AI speed maxes out at memory speed ÷ model size. Hitting 60 fps gives you 16.67 ms per frame (1,000 ÷ 60). If your target breaks physics, you want to find out in five minutes, not five hours.
- Turn vibes into numbers, and lock correctness first. You can start with a vibe ("combat feels choppy"), but the AI has to turn it into a count (stutters past 40 ms). Fix bugs before chasing speed, then put both the correctness check and the benchmark inside one script (
verify.sh) locked with a file hash (SHA-256). The AI can run the check, never edit it. - Try boring settings first, one change at a time. Sweep the built-in config flags before letting the AI write custom GPU kernels (tiny math programs that run directly on the graphics chip). When it edits code, change one thing per run so you know what actually helped.
- Sandwich every test (old → new → old). Never trust a plain before-and-after benchmark. Run every candidate right between two baseline runs (or toggle it on → off → on → off live). Throw the run out if the two baseline runs drifted too far apart. Keep the change only if it passes correctness, beats both baselines, and doesn't hurt anything else. Otherwise, revert it right away.
- Keep state and
DEAD_ENDS.mdon disk. Save the goal, hardware limits, run log, and every failed attempt (DEAD_ENDS.md) in plain files. Those dead ends are honestly the most useful part, because any new session (or a completely different AI model) can pick up cold without repeating failed ideas. - Know when to stop, then test a clean build. If three different ideas in a row land inside noise, or profiling (measuring where the time actually goes) shows you've hit the hardware wall, call it there. Strip out all temporary debug code, make a fresh build, and verify the clean build still hits the same numbers.
How it played out on two real projects
Here is how those exact same six rules actually played out, starting with the local AI experiment that got me hooked, and then bringing the same idea over to my handheld. Across both climbs, I used a mix of Opus 5.5 and Gemini 4 Neon (which is also why keeping state on disk mattered so much when switching between them). Both are definitely capable of doing this, though honestly Gemini 4 Neon felt better to use and seemed to perform better at hill-climbing in my experience.
1. Trying the inference skill on Kapitsa (M5 Pro MacBook)
The first thing I pointed the inference-optimisation skill at was nace-ai/kapitsa, an already heavily tuned C++ and Apple Metal engine for running local AI models on a Mac GPU. I was testing out my uncensored Arete 27B model (a Qwen 3.8 27B fine-tune compressed to 4-bit so it fits in laptop memory).
My hard rule was simple: don't make the model dumber. At temperature zero (T=0, no randomness), it had to output the exact same text character for character, with zero slowdowns on normal everyday chat (T=0.6, normal randomness).
Following the rules, the agent swept all 14 built-in settings first. That took minutes and showed stock defaults beat every knob, so all 14 went straight into DEAD_ENDS.md. One quick win (exp-001) came from upgrading an older 8-token helper model to the engine's newer 16-token stock helper (+8.1% at T=0, +6.6% at T=0.6).
Next, it tried training four custom helper models ("speculative drafters") that guess upcoming words ahead of time so the big model can verify several at once. One of them flashed +11.9% at T=0, which would have completely fooled me on vibes alone. Back-to-back checks caught that all four actually made normal writing (T=0.6) slower, so every single one got reverted.
With the dead ends cleared out, profiling pointed straight at Apple's Metal 4 GPU kernels. The agent went to work writing custom lossless kernels with names like qmm8t2p2, a contiguous 16-row drafter, and wide lazy GDN.
I have no idea what qmm8t2p2 is doing inside Apple Silicon registers, and to my surprise, it didn't matter. The locked verifier proved the outputs stayed 100% bit-for-bit identical, while speed jumped from 76.05 to 81.05 tok/s at T=0 (98.6 coding, 100.5 math) and 67.50 to 73.70 tok/s on normal chat (+9.2%).
Technical receipts: Kapitsa benchmark numbers
- Target & hard gate:
nace-ai/kapitsarunning 4-bit Arete 27B on an M5 Pro MacBook; bitwise-identical greedy outputs (logit_compare PASS) and zero regressions on sampled (T=0.6) prose or prefill. - Dead ends logged: deterministic sweep of all 14 runtime
NI_*switches (15 runs including the reference) all lost to stock defaults (-0.3% to -14.6%); four locally fine-tuned speculative drafters (exp-003toexp-006) included a tempting +11.9% atT=0onexp-003, but interleavedABABchecks caught -1.0% to -9.4% regressions onT=0.6/ prose and auto-reverted all four. - Winning kernels: lossless 16-row Metal 4 verify and draft kernels (
qmm8t2p2, contiguous 16-row drafter, wide lazy GDN) passedlogit_comparewith 100% bitwise-identical outputs, raising the 4-prompt daily mean 76.05 → 81.05 tok/s (+6.6% atT=0; 98.6 Coding, 100.5 Math), 67.50 → 73.70 tok/s (+9.2% atT=0.6), and +11.2% onkapitsa benchABBA, cutting draft time -19.7% and verify time -4.7%.
2. Taking the same idea to NieR:Automata (Retroid Pocket 6)
Once I saw how well that worked on local AI inference, I figured if these rules can speed up a Mac GPU engine I barely understand, they might work just as well for optimizing a game I wanted to play on my Retroid Pocket 6.
I've been playing the Nintendo Switch build of NieR:Automata on my RP6 using nx2android (a tool that translates Switch games to run natively on Android). Out of the box, it had two issues: annoying combat stutters at 30 fps, and nowhere near enough GPU headroom for 60 fps. So I adapted the inference skill's workflow into an android-game-porting skill and pointed an agent at it.
First, we tackled the 30 fps combat stutters. At 30 fps, any frame past 40 ms shows up as a visible hitch. Profiling showed the game was re-uploading megabytes of unchanged textures every frame. Fixing how modified texture slices were tracked dropped combat stutters from 66–75 down to 1 per 90-second fight, even though the average frame rate barely budged.
Unlocking 60 fps took a bigger fix. NieR:Automata uses a GPU trick that draws an object and saves extra visual effect data at the same time. Because of a quirk on Qualcomm's Adreno GPU, the engine's workaround was splitting every one of those draws in half: stop drawing the main scene, run the extra effect step, wait for the GPU to finish, and start drawing the main scene again. It's like grocery shopping by grabbing one item, waiting in the checkout line, walking it to your car, and going back inside over 1,000 times for a single trip. The agent's fix keeps drawing the main scene without stopping, puts those extra effect steps in a queue whenever it's safe to wait, and checks them all out in one batch at the end. That cut render passes by 91–94% (down to ~59 in Resistance Camp) and finally gave the GPU enough headroom for 60 fps.
To be completely honest, I didn't audit the low-level Vulkan C++ diff line by line, and I literally had to ask the AI to explain how that fix works in plain English just to write the paragraph above. Instead, I just checked the results myself. Side-by-side screenshots looked identical, my save file loaded fine, and five of the six areas I tested now hold a steady 60 fps. Even the sixth one, Resistance Camp, jumped from 41.5 to 58.1 fps. Once the clean build held up under live on/off testing, I opened PR #671 on shirai91/nx2android to share it upstream.
Technical receipts: NieR:Automata benchmark numbers
- Hardware / stack: Retroid Pocket 6 (Snapdragon 8 Gen 2, Adreno 740, Turnip Vulkan driver) via
nx2android. - Combat texture re-upload fix (30 fps, two 90s live-toggled
on/offpairs on one PID): texture uploads dropped 5.29–7.60 MB/fr → 0.49–0.62 MB/fr (from 11–33 MB dirty-array re-uploads); medianp50stayed flat at 33.4 ms whilep95dropped 40.6–41.2 ms → 37.3–37.5 ms and hitches (>40 ms) fell from 75 / 66 down to 1 / 1. - Batched GS-split (60 fps, paired
1 → 0 → 1live toggles across 6 chapters): Resistance Camp (~2,200 draws) dropped 1,049 → 59 passes/frame and GPU busy 23.9 → 16.2 ms (41.5 → 58.1 fps, 64% → 94.8% on-time); Forest Kingdom (~1,610 draws) dropped 720 → 55 passes and locked 60 fps; Cave (440–520 → 43.7 passes), Open City Ruins, and Desert Residential District all held 99.8–100.0% on-time 60 fps.
When you shouldn't use it
That being said, hill-climbing isn't for everything:
- No objective check, no climb. Always double-check what
verify.shactually measures before locking it. If the goal is pure taste ("make this UI feel nicer"), or your timer doesn't notice broken output, an agent will happily sprint off the wrong cliff. - A verifier proves results, not clean code. It's great for proving a speedup on your own machine, but if you're opening a PR on someone else's repo, clean diffs and human review still matter.
- Skip it for simple stuff. For a regular feature or straightforward bug fix, a normal prompt or test loop is way faster.
Try the meta-skill
Since the exact same hill-climbing pattern worked on two completely different projects (first Sybil Solutions' inference-optimisation skill on my MacBook, then my android-game-porting adaptation on the RP6), I stripped out the domain-specific stuff and packaged the reusable core into a zero-dependency hill-climbing meta-skill in my ai-skills repo (just standard Python 3.9+ and bash).
It comes with climb.py (workspace setup, SHA-256 test locking, old → new → old judging, % of ceiling scoreboards, and plateau detection), queue.sh (so runs never collide on one GPU or device), and a meta-skill mode that turns any finished climb into a reusable skill of its own.
Vibe coding got a bad rap because when nobody checks the math, you just ship fast garbage. Vibe hill-climbing is the loophole: you bring the vibes, the skill brings the scientific method, and the AI writes low-level code you'd otherwise draw a total blank on.
Loops get you to working. Graphs get you to organized. Hill-climbing lets you vibe your way to the physical limit.