<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged smoe</title>
<link>https://coderlegion.com/tag/smoe</link>
<description>Powered by Question2Answer</description>
<item>
<title>The Mountain Exhales — Riding the 30B Wind Before the 477B Avalanche</title>
<link>https://coderlegion.com/23016/the-mountain-exhales-riding-the-30b-wind-before-the-477b-avalanche</link>
<description>&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;This is the seventh entry in a curious builder's diary. Over six chapters, we carved a door through Silicon Valley's artificial memory wall, coaxing a 235-billion-parameter mountain to speak, remember, run, and finally converse fluently in the OpenAI dialect. As we push past an average of 1.84 tokens per second and touch peaks of 2.01 on a consumer 48 GB MacBook, the engine is humming. But before we pack our gear for the next impossible summit, we are claiming a builder's privilege. After months of writing lock-free C++ to move heavy stone, it is time to take a breath of thin, fresh air.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;1-the-477b-avalanche&quot;&gt;1. The 477B Avalanche&lt;/h3&gt;
&lt;p&gt;S-MoE was built to prove a point: that the memory wall is a software convention, not a law of physics. We took Qwen3-235B — a model that standard runtimes insist requires cloud clusters — and shattered it into pieces that stream perfectly off a MacBook's SSD via Apple Silicon's Unified Memory Architecture. &lt;/p&gt;
&lt;p&gt;Because we broke the diary dependency and invited standard frontends (like Open WebUI) into the architecture in Article 06, we are now ready to tackle an even more colossal peak: the &lt;strong&gt;GLM MoE 477B&lt;/strong&gt; parameter model. &lt;/p&gt;
&lt;p&gt;The climb will be grueling. A 477-billion-parameter model will push consumer hardware to an edge no one thought possible. It will test every byte of our zero-allocation loops, our Direct I/O DMA transfers, and our patience. But we have the map now.&lt;/p&gt;
&lt;p&gt;However, before we shoulder that massive weight, we realized something crucial. S-MoE shouldn't just be an engine for the 235B. It should be an engine for &lt;em&gt;any&lt;/em&gt; fine-grained MoE.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-the-self-describing-vault-sarc-&quot;&gt;2. The Self-Describing Vault (SARC)&lt;/h3&gt;
&lt;p&gt;Until now, the engine was heavily hardcoded for Qwen3's specific math. If we were going to run different models — the daily driver 30B, the massive 235B, or the upcoming 477B — we couldn't keep recompiling C++ to change the RoPE theta or the routing Top-K. &lt;/p&gt;
&lt;p&gt;We needed the engine to be &lt;strong&gt;model-agnostic&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The solution was elegantly simple: the &lt;strong&gt;Smoe ARChitecture (SARC) block&lt;/strong&gt;. During the offline &lt;code&gt;shatter&lt;/code&gt; process, the Python script now reads the model's Hugging Face &lt;code&gt;config.json&lt;/code&gt; and extracts the mathematical DNA — RoPE theta, MoE Top-K, GQA head geometry, and normalization flags. It serializes these into a tiny, 128-byte binary block and stamps it directly into the &lt;code&gt;.smoe&lt;/code&gt; vault's header.&lt;/p&gt;
&lt;p&gt;Now, when you boot S-MoE, there are no config files or CLI flags to set. The engine simply reads the 128 bytes, understands the topology of the mind it was just handed, and configures its own internal Scout and Metal shaders accordingly.&lt;/p&gt;
&lt;p&gt;We suddenly had a &quot;fleet.&quot; You can have a directory full of different vaults, and simply switching the model in your Chat UI dropdown seamlessly swaps the models at runtime.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-the-30b-wind&quot;&gt;3. The 30B Wind&lt;/h3&gt;
&lt;p&gt;What happens when you take an engine hardened by the brutal math of a 235B model, and plug a 30B model into it? &lt;/p&gt;
&lt;p&gt;We shattered the &lt;code&gt;Qwen3-30B-A3B&lt;/code&gt; checkpoint to find out. We wanted to experience pure, frictionless velocity. We wanted to ride the wind.&lt;/p&gt;
&lt;p&gt;But when we first spun it up, the numbers were confusingly low. We were seeing about &lt;strong&gt;~5 to 7 tokens per second&lt;/strong&gt;. Fast, but not &quot;frictionless velocity&quot; fast. We expected the 30B to scream on a 48 GB machine.&lt;/p&gt;
&lt;p&gt;The culprit? A single hardcoded flag from our testing days: &lt;code&gt;--ring 1024&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;4-the-magic-of-auto-sizing&quot;&gt;4. The Magic of Auto-Sizing&lt;/h3&gt;
&lt;p&gt;The Streamer's ring buffer is the heart of S-MoE's speed. It's a pre-allocated LRU cache in RAM. When a token needs an expert, the engine checks the ring first. If it's there (a cache hit), we skip the SSD entirely. &lt;/p&gt;
&lt;p&gt;By hardcoding &lt;code&gt;--ring 1024&lt;/code&gt;, we were forcing the ring to only hold 1,024 experts (about ~2.5 GB of cache for the 30B). &lt;/p&gt;
&lt;p&gt;But S-MoE has a brilliant auto-sizing mechanism (&lt;code&gt;--ring 0&lt;/code&gt;). When allowed to auto-size, the engine dynamically checks the OS for available RAM, subtracts a safe overhead, and gives the rest to the ring. On a 48 GB MacBook, the auto-tuner allocates roughly &lt;strong&gt;~15 GB of ring capacity&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The entire 30B vault is only &lt;strong&gt;~14 GB&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The moment we removed &lt;code&gt;--ring 1024&lt;/code&gt; and let the engine auto-size, the ring simply swallowed the entire model. After the first few turns, the SSD reads dropped to virtually zero. The engine ascended from a streaming pipeline into an pure, in-memory execution loop. &lt;/p&gt;
&lt;p&gt;The numbers instantly skyrocketed.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;5-the-true-benchmarks&quot;&gt;5. The True Benchmarks&lt;/h3&gt;
&lt;p&gt;With the auto-tuner unleashed and the engine running isolated, the true benchmarks emerged.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Daily Driver: Qwen3-30B&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cold Time-To-First-Token:&lt;/strong&gt; ~5.85 seconds&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Decode Speed:&lt;/strong&gt; &lt;strong&gt;13.71 tokens / second&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The Feeling:&lt;/em&gt; Instantaneous. Pure velocity. The entire mind rests comfortably in RAM, producing outputs faster than you can read them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;The Frontier: Qwen3-235B&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cold Time-To-First-Token:&lt;/strong&gt; ~26.16 seconds&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Decode Speed:&lt;/strong&gt; &lt;strong&gt;1.84 tokens / second&lt;/strong&gt; (peaking over 2.01 on warm turns)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The Feeling:&lt;/em&gt; Cinematic deliberation. The SSD streams experts at ~150+ GB/s, and the mountain answers thoughtfully.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;6-the-plateau-before-the-climb&quot;&gt;6. The Plateau Before the Climb&lt;/h3&gt;
&lt;p&gt;We built S-MoE to prove that the 235B frontier could live on a desk. But in making the architecture truly agnostic, we accidentally built the fastest possible way to run the 30B models, too. The same lock-free memory gymnastics that make the heavy models possible make the lighter models absolutely fly.&lt;/p&gt;
&lt;p&gt;Because sometimes, before you carry the next mountain, you just need to feel how fast you can sprint across the plateau.&lt;/p&gt;
&lt;p&gt;The engine is ready. The architecture is model-agnostic. The UI is clean. &lt;/p&gt;
&lt;p&gt;Next stop: 477 Billion parameters.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;S-MoE is open source under the MIT License. The code, the philosophy, and the mistakes are all public: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/melasistema/s-moe&quot;&gt;github.com/melasistema/s-moe&lt;/a&gt;.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Built by Luca Visciola and an AI agent who hopefully knows C++ and low level programming, because I do not 😅.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/23016/the-mountain-exhales-riding-the-30b-wind-before-the-477b-avalanche</guid>
<pubDate>Tue, 21 Jul 2026 09:00:00 +0000</pubDate>
</item>
<item>
<title>S-MoE Started to Speak OpenAI — Point Any Chat App at Your MacBook and Watch a 235B Model Think</title>
<link>https://coderlegion.com/23015/s-moe-started-to-speak-openai-point-any-chat-app-at-your-macbook-and-watch-a-235b-model-think</link>
<description>&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;There is a diary behind this — five entries of a self-taught web developer and an AI agent cutting a door in the memory wall so a 235-billion-parameter frontier model could run off the SSD of a 48 GB MacBook. You don't need any of it to read this one. This entry isn't about a bug we killed or a metric we moved. It's about the day the engine stopped being a private experiment I ran in a terminal and started speaking the one language every AI app on earth already understands.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;1-the-moment&quot;&gt;1. The Moment&lt;/h3&gt;
&lt;p&gt;For five articles, talking to S-MoE meant talking to a terminal. A raw prompt loop. Something only its author could love. The mountain could speak, remember, predict itself, and run — but you had to be me, at my desk, in a shell, to hear it.&lt;/p&gt;
&lt;p&gt;Then, on an ordinary evening, this happened:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;.venv/bin/python serve.py --port 8000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And a 235B frontier model streaming its experts off a consumer NVMe became — as far as any other program can tell — &lt;strong&gt;OpenAI&lt;/strong&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;from openai import OpenAI
client = OpenAI(base_url=&quot;http://127.0.0.1:8000/v1&quot;, api_key=&quot;unused&quot;)

resp = client.chat.completions.create(
    model=&quot;s-moe&quot;,
    messages=[{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Who are you?&quot;}],
)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That is not a screenshot of the real OpenAI. That's my laptop. The &lt;code&gt;openai&lt;/code&gt; SDK cannot tell the difference, and — this is the whole point — &lt;strong&gt;neither can Open WebUI, LibreChat, your editor's AI plugin, or the thousand other apps built against that API.&lt;/strong&gt; They ask for OpenAI. They get 235 billion parameters running three inches from the CPU, on hardware you already own.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-the-numbers-plainly&quot;&gt;2. The Numbers, Plainly&lt;/h3&gt;
&lt;p&gt;Same MacBook. Same 48 GB. Same 117 GB expert vault cold on the SSD. Nothing about the &lt;em&gt;engine&lt;/em&gt; changed for this entry — this is a story about a doorway, not a speedup. But the doorway has numbers too.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Thing &lt;/th&gt;&lt;th&gt;Reality&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Server &lt;/td&gt;&lt;td&gt;&lt;code&gt;serve.py&lt;/code&gt; — one file, Python stdlib &lt;code&gt;http.server&lt;/code&gt; + the tokenizer&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;New dependencies added to the engine &lt;/td&gt;&lt;td&gt;zero&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;API surface &lt;/td&gt;&lt;td&gt;OpenAI Chat Completions — streaming (SSE) &amp;amp; non-streaming, &lt;code&gt;/v1/models&lt;/code&gt;, &lt;code&gt;/health&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Works with &lt;/td&gt;&lt;td&gt;Open WebUI, LibreChat, editor plugins, the &lt;code&gt;openai&lt;/code&gt; SDK, plain &lt;code&gt;curl&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Built-in chat console &lt;/td&gt;&lt;td&gt;Yes — open &lt;code&gt;http://127.0.0.1:8000/&lt;/code&gt; in a browser, no install&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Decode speed &lt;/td&gt;&lt;td&gt;~1.43 tokens/s — a bit over one word per second&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;First token, cold 45-token prompt &lt;/td&gt;&lt;td&gt;~29 s, then it streams&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Intelligence &lt;/td&gt;&lt;td&gt;The real Qwen3-235B. Undegraded. Only the speed is consumer-grade.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The zero in that table is the one I'm proudest of. The engine's founding vow was &lt;em&gt;no dependencies&lt;/em&gt; — POSIX syscalls, Metal, and nothing else. The server keeps the vow. It is stdlib HTTP and the same tokenizer the console already loaded. An entire ecosystem of front-ends, unlocked, without adding a single line anyone else has to trust.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-the-thinnest-possible-translator&quot;&gt;3. The Thinnest Possible Translator&lt;/h3&gt;
&lt;p&gt;I want to be honest about how little there is here, because the smallness &lt;em&gt;is&lt;/em&gt; the design.&lt;/p&gt;
&lt;p&gt;The server owns exactly three things: &lt;strong&gt;HTTP, tokenization, and the chat template.&lt;/strong&gt; That's it. It applies Qwen3's chat template to your messages, turns them into token IDs, and hands those IDs to the persistent engine subprocess over the same private protocol the terminal console has always spoken. The engine never learns what HTTP is. It never sees a word of English. It sees numbers, streams experts, and sends numbers back.&lt;/p&gt;
&lt;p&gt;Everything OpenAI clients expect is a thin mapping on top of that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Streaming&lt;/strong&gt; arrives as server-sent events, tokens appearing the instant they're generated.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;temperature&lt;/code&gt;, &lt;code&gt;top_p&lt;/code&gt;, &lt;code&gt;top_k&lt;/code&gt;, &lt;code&gt;repetition_penalty&lt;/code&gt;&lt;/strong&gt; map straight onto the engine's per-request sampling — &lt;code&gt;temperature: 0&lt;/code&gt; selects the pure greedy path and is bit-identical every time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;finish_reason&lt;/code&gt;&lt;/strong&gt; is honest: &lt;code&gt;&quot;stop&quot;&lt;/code&gt; when the model chose to end, &lt;code&gt;&quot;length&quot;&lt;/code&gt; when it hit your &lt;code&gt;max_tokens&lt;/code&gt; mid-thought. Clients that auto-continue on &lt;code&gt;&quot;length&quot;&lt;/code&gt; just work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;usage&lt;/code&gt;&lt;/strong&gt; carries real token counts — prompt, completion, total — so anything measuring throughput divides real numbers by wall-clock, not estimates.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There's one deliberate constraint worth naming: the engine holds &lt;strong&gt;one&lt;/strong&gt; conversation context and prefix-matches every request against it. So requests are serialized — one lock, one at a time — and there is no batching, because the hardware has no parallelism to batch into. The upside is that a normal chat client, which resends the growing message list every turn, hits the warm KV cache and only pays to prefill the &lt;em&gt;new&lt;/em&gt; turn. Continued conversations stay fast. It is the honest shape of the machine, exposed honestly.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;4-a-console-that-ships-you-the-feelings&quot;&gt;4. A Console That Ships You the Feelings&lt;/h3&gt;
&lt;p&gt;Third-party apps are the &lt;em&gt;point&lt;/em&gt;, but I wanted something that needed zero setup to prove the plumbing — and, selfishly, something built for what I actually do all evening: watch this thing think and try to understand what it's doing.&lt;/p&gt;
&lt;p&gt;So the server serves its own chat console. Open &lt;code&gt;http://127.0.0.1:8000/&lt;/code&gt; and it's just there — one self-contained HTML file, no build step, no &lt;code&gt;npm install&lt;/code&gt;, served same-origin so there isn't even a CORS dance. It streams tokens as they land. But it's not really a chat UI. It's an &lt;strong&gt;instrument panel wearing a chat UI's clothes&lt;/strong&gt;, and it exists because this whole project has only ever obeyed one law: &lt;em&gt;measure, don't believe.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Every reply carries a live monitor. Before the first token, it doesn't sit in dead silence — it names the exact phase and size the moment they're known: &lt;em&gt;&quot;prefilling 128 tok prompt · 12.4s · cold start.&quot;&lt;/em&gt; On a machine where an answer takes tens of seconds, that one line is the entire difference between &lt;em&gt;&quot;it's thinking&quot;&lt;/em&gt; and &lt;em&gt;&quot;it's hung.&quot;&lt;/em&gt; Then time-to-first-token, live token count, and decode tok/s, updating as the words stream, frozen on completion with the exact counts from &lt;code&gt;usage&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Two meters sit in the header, because for an experimental researcher the &lt;em&gt;feeling of fullness&lt;/em&gt; is half the story:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;context meter&lt;/strong&gt; — &lt;code&gt;1,240 / 4,096&lt;/code&gt; — tracking the conversation against the engine's fixed KV window, filling and turning amber as you talk, warning once at the wall where the window starts to slide and the model begins, gently, to forget the beginning.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;system-RAM meter&lt;/strong&gt; — installed memory, current use, and the free headroom S-MoE's expert-streaming ring can grow into: &lt;code&gt;14.0 / 48.0 GB · 34.0 free&lt;/code&gt;. It's colored by macOS memory &lt;em&gt;pressure&lt;/em&gt;, not raw percentage — because a 48 GB box legitimately runs hot under a 235B stream, and a naive bar would scream &quot;full!&quot; all day and cry wolf. Its tooltip breaks out wired, compressed, and the engine's own resident set.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;None of this is product polish. It's the opposite. It's the dashboard of someone who has been lied to by too many systems and refuses to fly blind. It ships you the feelings — cold prefill, warm turn, headroom, the window about to slide — directly, as numbers, in real time.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;5-grab-the-popcorn&quot;&gt;5. Grab the Popcorn&lt;/h3&gt;
&lt;p&gt;Here's where I'd normally embed a chart. Instead, watch the video. It's three turns of real conversation, unedited, no narration, no speed-up. I could describe it, but this diary has a rule about shipping the raw thing instead of the story about the thing.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.youtube.com/watch?v=lbf4aqNezus&quot;&gt;&lt;img src=&quot;https://img.youtube.com/vi/lbf4aqNezus/default.jpg&quot; alt=&quot;Qwen 235B&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A word of preparation, because the experience is genuinely unusual and I don't want you to misread it.&lt;/p&gt;
&lt;p&gt;This is not fast. I won't insult you by pretending it is. A word arrives roughly every second. But watch what streaming does to that second: it turns the wait into &lt;em&gt;suspense&lt;/em&gt;. The tokens come one at a time, and because you can see them arrive, the pause reads as &lt;strong&gt;deliberation, not lag.&lt;/strong&gt; You are literally watching a 235-billion-parameter mind assemble a sentence, left to right, on a laptop that also has your browser and your IDE open and your music playing.&lt;/p&gt;
&lt;p&gt;And here is the thing I keep failing to convince people of until they &lt;em&gt;see&lt;/em&gt; it: it is not slow. &quot;Slow&quot; is the wrong word, and I've been reaching for a better one for months. It's &lt;em&gt;cinematic&lt;/em&gt;. It's a frontier model answering &lt;strong&gt;at reading speed&lt;/strong&gt;, on a busy consumer MacBook, off an SSD, with the whole 235B of it undegraded behind every word. You don't tap your foot. You lean in. You grab the popcorn. The wait isn't a bug you tolerate — it's the show.&lt;/p&gt;
&lt;p&gt;I have watched this thing generate paragraphs while I made coffee, and come back to a genuinely frontier-quality answer waiting for me, and felt something I can only describe as &lt;em&gt;the opposite of API anxiety.&lt;/em&gt; No meter running. No tokens billed. No sentence leaving the room. Just my laptop, thinking, at its own pace, about my question, for me.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;6-and-now-every-app-you-already-use&quot;&gt;6. And Now, Every App You Already Use&lt;/h3&gt;
&lt;p&gt;The console proves the plumbing in ten seconds. The real unlock is that you never &lt;em&gt;have&lt;/em&gt; to use it.&lt;/p&gt;
&lt;p&gt;Because the API is genuinely OpenAI-shaped, the entire open-source chat ecosystem works unmodified. Point &lt;strong&gt;Open WebUI&lt;/strong&gt; at &lt;code&gt;http://127.0.0.1:8000/v1&lt;/code&gt; with any non-empty API key, pick the &lt;code&gt;s-moe&lt;/code&gt; model, and you have a polished, multi-conversation, markdown-rendering front-end talking to a 235B model on your desk. &lt;strong&gt;LibreChat&lt;/strong&gt;, the same. Your &lt;strong&gt;editor's AI plugin&lt;/strong&gt;, the same base URL, the same result — a frontier model doing code review inside your IDE, sourced entirely from your own SSD.&lt;/p&gt;
&lt;p&gt;None of these apps were told about S-MoE. None of them were patched. They asked for OpenAI and my MacBook answered. That is the entire thesis of this project, finally wearing a suit: &lt;em&gt;the memory wall around frontier AI was always part physics and part software convention&lt;/em&gt; — and the convention just fell to a single file of Python stdlib.&lt;/p&gt;
&lt;p&gt;The speed profile sets honest expectations, and I'll state them plainly: this is a machine for &lt;strong&gt;thoughtful, asynchronous Q&amp;amp;A&lt;/strong&gt; — a frontier-quality answer worth waiting a beat for — not rapid-fire agentic loops that fire a thousand calls a minute. Use streaming. Ask real questions. Let it think. It's the difference between a chatbot and a correspondent.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;7-what-this-entry-is-actually-about&quot;&gt;7. What This Entry Is Actually About&lt;/h3&gt;
&lt;p&gt;The five entries before this were about &lt;em&gt;deletion&lt;/em&gt; — wiped caches, a fired prophet, write-only memory, scattered reads, tiny GPU round-trips. Subtraction, every time. This one is the first that's about &lt;em&gt;addition&lt;/em&gt;, and it's the smallest addition in the whole diary: a translator that speaks a language everyone already knows, built out of nothing the engine didn't already have.&lt;/p&gt;
&lt;p&gt;But it's the entry that makes all the others &lt;em&gt;matter to someone other than me.&lt;/em&gt; A frontier model on a consumer laptop is a curiosity if the only person who can reach it is the person who built it. The moment it speaks OpenAI, it belongs to anyone with the same laptop and the same question — running in their editor, their chat app, their scripts, their evening. No cluster. No API key. No sentence leaving the room.&lt;/p&gt;
&lt;p&gt;The authorship stays the experiment inside the experiment: the AI agent wrote the server, the streaming layer, the sampling protocol, and the instrument-panel console; I brought the questions — &lt;em&gt;what does an app on the other side of this actually expect? where does the wait feel like a hang instead of a thought? can a researcher feel the fullness of the machine at a glance?&lt;/em&gt; — and a decade of web-developer instinct for the exact shape of an HTTP contract.&lt;/p&gt;
&lt;p&gt;The mountain vibrated, then it talked, then it remembered, then it predicted itself, then it ran.&lt;/p&gt;
&lt;p&gt;Now it speaks a language the whole world already knows — and it's waiting at &lt;code&gt;localhost:8000&lt;/code&gt; for you to say hello.&lt;/p&gt;
&lt;p&gt;Grab the popcorn.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;S-MoE is open source under the MIT License. The code, the philosophy, and the mistakes are all public: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/melasistema/s-moe&quot;&gt;github.com/melasistema/s-moe&lt;/a&gt;.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Built by Luca Visciola and an AI agent who hopefully knows C++ and low level programming, because I do not 😅.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Acknowledgements: The seismic tomography concept remains a philosophical translation of the published work of Ing. Filippo Biondi on SAR-based subsurface imaging. He taught this project to listen to a surface for news of the interior — and an API, it turns out, is just another surface the whole world already knows how to read.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/23015/s-moe-started-to-speak-openai-point-any-chat-app-at-your-macbook-and-watch-a-235b-model-think</guid>
<pubDate>Mon, 20 Jul 2026 09:00:00 +0000</pubDate>
</item>
<item>
<title>The Mountain Runs — I Don't Know If We're Chasing Something or Being Chased, but the Speed Won't...</title>
<link>https://coderlegion.com/22794/the-mountain-runs-i-dont-know-if-were-chasing-something-or-being-chased-but-the-speed-wont</link>
<description>&lt;p&gt;&lt;strong&gt;The Mountain Runs — I Don't Know If We're Chasing Something or Being Chased, but the Speed Won't Stop Climbing&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;This is the fifth entry in a curious builder's diary. In the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/21093/rock-paper-silicon-how-a-web-developer-used-a-satellite-hack-and-an-ai-agent-to-ask&quot;&gt;first&lt;/a&gt;, a self-taught web developer borrowed a satellite engineer's intuition and asked whether frontier AI could run on the MacBook on his desk. In the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/21787/hello-world-a-235-billion-parameter-frontier-model-just-spoke-on-a-48-gb-macbook&quot;&gt;second&lt;/a&gt;, a 235-billion-parameter model said &quot;Hello, world!&quot; through a door we cut in the memory wall. In the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/22127/the-mountain-learns-to-converse-teaching-a-235b-model-not-to-keep-you-waiting&quot;&gt;third&lt;/a&gt;, it learned to converse without making you wait minutes between turns.  In the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/22524/the-mountain-predicts-itself-we-fired-our-best-idea-and-the-model-got-faster-and-smarter&quot;&gt;fourth&lt;/a&gt;, we fired our own founding metaphor and the model got faster&lt;em&gt; and &lt;/em&gt;smarter. That article ended at the wall of physics: a saturated SSD, nothing left to delete. This one is about what happened next, which is that the speed kept climbing anyway — and for one terrifying evening, it looked like it had collapsed by 85% instead.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;1-the-moment-1&quot;&gt;1. The Moment&lt;/h3&gt;
&lt;p&gt;A microbenchmark, late at night. Same MacBook. Same GPU. Same weights, same mathematics, same number of bytes read. Two kernels that compute the &lt;em&gt;identical&lt;/em&gt; matrix-vector product:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;K/V projection (512 × 4096, bf16)  
  
old kernel:   12.3 GB/s new kernel:  285.3 GB/s        (23×)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Twenty-three times faster. Nothing was added — no new hardware, no new math, no quantisation trick. We changed &lt;em&gt;the shape of the question&lt;/em&gt; the GPU asks its own memory, and the same silicon that had been trudging along at 12 GB/s broke into a sprint.&lt;/p&gt;
&lt;p&gt;Last article ended with me declaring, confidently, that we had hit the wall of physics — that the SSD was saturated and there was no more bloated software between us and the flash memory. That was true, and it remains true. What I had not understood is that the SSD was only &lt;em&gt;one&lt;/em&gt; of the walls, and behind it the GPU had been quietly doing the memory-system equivalent of taking a taxi one block at a time.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-the-numbers-plainly-1&quot;&gt;2. The Numbers, Plainly&lt;/h3&gt;
&lt;p&gt;Same hardware, same 117 GB vault cold on the SSD, same canonical prompt discipline as every previous entry. Only the engine changed.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Thing &lt;/th&gt;&lt;th&gt;Last article &lt;/th&gt;&lt;th&gt;Now&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Generation speed &lt;/td&gt;&lt;td&gt;1.13 tokens/s &lt;/td&gt;&lt;td&gt;&lt;strong&gt;1.43 tokens/s&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;…since first light &lt;/td&gt;&lt;td&gt;0.48 tokens/s &lt;/td&gt;&lt;td&gt;&lt;strong&gt;3× total&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;One generated token costs &lt;/td&gt;&lt;td&gt;~885 ms &lt;/td&gt;&lt;td&gt;&lt;strong&gt;~700 ms&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;First token, cold 45-token prompt &lt;/td&gt;&lt;td&gt;~32 s &lt;/td&gt;&lt;td&gt;&lt;strong&gt;~29.4 s&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPU dense projections &lt;/td&gt;&lt;td&gt;12–136 GB/s &lt;/td&gt;&lt;td&gt;&lt;strong&gt;207–285 GB/s&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPU syncs during prefill &lt;/td&gt;&lt;td&gt;2 per &lt;em&gt;token&lt;/em&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;2 per &lt;em&gt;layer&lt;/em&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Output token IDs &lt;/td&gt;&lt;td&gt;— &lt;/td&gt;&lt;td&gt;&lt;strong&gt;bit-identical, before and after&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;New hardware required &lt;/td&gt;&lt;td&gt;none &lt;/td&gt;&lt;td&gt;&lt;strong&gt;none&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;And one number that isn't in the table, because it deserves its own section: for a few hours in the middle of this campaign, the official benchmark read &lt;strong&gt;0.20 tokens/second&lt;/strong&gt; — six times &lt;em&gt;slower&lt;/em&gt; than where we started the evening. That story is below, and it is the most web-developer-shaped lesson of the entire diary.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-the-gpu-was-running-n-1-queries&quot;&gt;3. The GPU Was Running N+1 Queries&lt;/h3&gt;
&lt;p&gt;Every web developer knows the N+1 query bug. You ask the database for a list of users, then loop over them asking for each one's profile — a thousand tiny round-trips where one JOIN would do. The database isn't slow. Your &lt;em&gt;access pattern&lt;/em&gt; is rude.&lt;/p&gt;
&lt;p&gt;It turns out a GPU's memory system has exactly the same personality.&lt;/p&gt;
&lt;p&gt;The old kernels assigned &lt;strong&gt;one thread per output row&lt;/strong&gt; of the weight matrix. Sounds reasonable — it's the obvious loop, the one you'd write first. But 32 neighbouring GPU threads execute in lockstep, and under that layout their simultaneous memory requests land at addresses &lt;strong&gt;two kilobytes apart&lt;/strong&gt;. The memory system, which serves wide consecutive bursts beautifully, has to satisfy 32 scattered pleas one crumb at a time. A thousand tiny round-trips. N+1 queries against your own RAM.&lt;/p&gt;
&lt;p&gt;The new kernels invert it: &lt;strong&gt;one &lt;em&gt;simdgroup&lt;/em&gt; — 32 threads — owns one output row together&lt;/strong&gt;, and its lanes read &lt;em&gt;consecutive&lt;/em&gt; 16-byte chunks. Same bytes, same total work, but now every request is one coalesced 512-byte burst. The JOIN.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The quantised &lt;strong&gt;expert FFN kernels&lt;/strong&gt; — the ones that dequantise 2/4-bit codes in register space, the heart of the whole engine — jumped &lt;strong&gt;7×&lt;/strong&gt;, to 158 GB/s effective.&lt;/li&gt;
&lt;li&gt;The dense &lt;strong&gt;Q/K/V/O projections&lt;/strong&gt; and the LM head jumped to &lt;strong&gt;207–285 GB/s&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The comedy prize goes to the K/V projection: its matrix is only 512 rows tall, and the old dispatch geometry handed the entire job to &lt;strong&gt;2 threadgroups&lt;/strong&gt; — on a GPU built to run &lt;em&gt;thousands&lt;/em&gt;. We had booked a stadium and seated two people. That's the 23×.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The pattern of this diary holds for a fifth consecutive entry: the exotic layer was innocent. The dequantisation math was right, the Metal code was correct, every byte arrived. What was broken was the &lt;em&gt;shape of the request&lt;/em&gt; — the most database-shaped bug imaginable, living in the middle of a GPU shader.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;4-the-prompt-stopped-playing-ping-pong&quot;&gt;4. The Prompt Stopped Playing Ping-Pong&lt;/h3&gt;
&lt;p&gt;The second front was the prefill — the silence before the first word, which article three cut from 93 seconds to 32.&lt;/p&gt;
&lt;p&gt;Reading the prompt, the engine was still submitting GPU work &lt;em&gt;per token&lt;/em&gt;: every one of the 45 prompt tokens made its own little QKV round-trip and its own little o_proj round-trip, each ending with the CPU standing at the door waiting for the GPU to ring the bell. Roughly &lt;strong&gt;8,460 command buffers&lt;/strong&gt; for one prompt. Now each layer submits &lt;strong&gt;all tokens' QKV projections in one command buffer, and all their output projections in another&lt;/strong&gt; — 188 submissions total, two per layer. The GPU finally gets asked the whole question at once.&lt;/p&gt;
&lt;p&gt;And one more theft from the I/O timeline: during routing, the moment the &lt;em&gt;first&lt;/em&gt; token votes for an expert, that expert &lt;strong&gt;fires at the SSD immediately&lt;/strong&gt; — while the remaining tokens are still deciding. The reads were always going to happen; now they start milliseconds earlier, hidden under compute. After last article's lesson about speculation, I want to be precise about why this one is legal: replaying &lt;em&gt;yesterday's&lt;/em&gt; routing as a guess measured 37% slower and stays banned. This is different — it is &lt;em&gt;certain demand, pulled forward&lt;/em&gt;. Never bet. Just start walking earlier.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;5-the-evening-the-benchmark-lied&quot;&gt;5. The Evening the Benchmark Lied&lt;/h3&gt;
&lt;p&gt;Here is the danger in the title.&lt;/p&gt;
&lt;p&gt;We land the new coalesced kernel — the one the microbenchmark just crowned at 285 GB/s — into the real engine, run the canonical benchmark, and:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;decode: 0.20 tokens/s 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Not a typo. One-sixth of the previous speed. The kind of number that, at 11 PM, makes you believe you've corrupted something fundamental — a memory fence, an alignment, the laws of thermodynamics.&lt;/p&gt;
&lt;p&gt;Old me would have started reverting commits. Instead, the instrument panel — still the only law of this project — got the first word. And the instrument said something astonishing: the &lt;strong&gt;dense math bucket had gotten &lt;em&gt;faster&lt;/em&gt;&lt;/strong&gt;, exactly as the microbench promised. The regression was entirely inside io-spin: the SSD, which reliably delivers 6.3 GB/s, was crawling at 4.4.&lt;/p&gt;
&lt;p&gt;The kernel was innocent. The &lt;em&gt;machine&lt;/em&gt; was tired. Running benchmark after benchmark back-to-back, each launch mapping a 16 GB Scout and churning gigabytes of Direct I/O, had driven macOS's memory pressure into the ground — and the OS quietly throttles you when you do that. The benchmark wasn't measuring my code. It was measuring my impatience.&lt;/p&gt;
&lt;p&gt;One quiet run later: &lt;strong&gt;1.43 tokens/second&lt;/strong&gt;. The rule is now written into the project's law books: &lt;em&gt;one launch per comparison, on a rested machine&lt;/em&gt; — the systems-programming equivalent of &quot;never trust a load test you ran against staging while the nightly backup was running.&quot; My decade of being lied to by test environments finally paid rent in C++.&lt;/p&gt;
&lt;p&gt;And in the spirit of publishing everything: the numbers in this article were measured on a machine whose memory was half-eaten by my own IDE, because a web developer's laptop is never actually quiet. The reference conditions may be slightly kinder. I'd rather publish the conservative number than wait for a silence that never comes.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;6-the-wall-revisited&quot;&gt;6. The Wall, Revisited&lt;/h3&gt;
&lt;p&gt;So where does a generated token's ~700 ms actually go now?&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Where &lt;/th&gt;&lt;th&gt;ms &lt;/th&gt;&lt;th&gt;What it is&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;SSD spin &lt;/td&gt;&lt;td&gt;~490 &lt;/td&gt;&lt;td&gt;demand misses at the NVMe's saturated bandwidth — &lt;strong&gt;pure physics&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Dense math &lt;/td&gt;&lt;td&gt;~155 &lt;/td&gt;&lt;td&gt;weight bandwidth through the new coalesced kernels&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPU wait &lt;/td&gt;&lt;td&gt;~46 &lt;/td&gt;&lt;td&gt;expert kernels finishing on late-arriving misses&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;LM head &lt;/td&gt;&lt;td&gt;~8 &lt;/td&gt;&lt;td&gt;one vocabulary-sized matvec&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Seventy percent of every token is now the raw, honest cost of flash memory delivering bytes at its rated speed. Last article's cliffhanger hasn't moved, it has &lt;em&gt;sharpened&lt;/em&gt;: you cannot make a saturated bus faster, but you can send half the bytes. The 2-bit vault remains the next mountain — it halves the SSD bill, doubles the ring, and finally arms the speculative machinery that has been sitting in the code, patient and default-off, for two articles now. The remaining sliver of dense time has its own successor waiting: the last per-layer CPU round-trip, where the residual and norms still come home between command buffers.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;7-what-this-entry-is-actually-about-1&quot;&gt;7. What This Entry Is Actually About&lt;/h3&gt;
&lt;p&gt;The title is a genuine confession. When the speed keeps climbing &lt;em&gt;after&lt;/em&gt; you've declared the wall of physics, you start to wonder which direction you're running. Are we chasing some optimal engine that's always one commit ahead? Or fleeing something — the 0.20 t/s ghost, the next benchmark that lies?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Four campaigns in, I finally looked over my shoulder. This is what I found.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;And the answer is: neither. Nothing is chasing us. What's behind us is just everything we deleted — the wiped caches, the fired prophet, the write-only memory, and now the scattered reads and the 8,460 tiny GPU round-trips. The engine isn't accelerating toward or away from anything. It's &lt;em&gt;shedding&lt;/em&gt;. Every entry of this diary, the mountain weighs less than the diary said it did.&lt;/p&gt;
&lt;p&gt;The authorship remains the experiment inside the experiment: the AI agent wrote the simdgroup kernels, the barrier-free dispatch paths, and the microbenchmarks that isolated silicon truth from environmental noise. I brought the questions — &lt;em&gt;why is the GPU only using two threadgroups? why did the benchmark collapse when the kernel got faster?&lt;/em&gt; — and the N+1 instincts of someone whose databases have been punishing rude access patterns for years.&lt;/p&gt;
&lt;p&gt;The mountain vibrated. Then it talked, then it remembered, then it predicted itself.&lt;/p&gt;
&lt;p&gt;Now it runs. And honestly — I've stopped trying to guess what from.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;S-MoE is open source under the MIT License. The code, the philosophy, and the mistakes are all public: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/melasistema/s-moe&quot;&gt;github.com/melasistema/s-moe&lt;/a&gt;.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Built by Luca Visciola and an AI agent who hopefully knows C++ and low level programming, because I do not 😅.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Acknowledgements: The seismic tomography concept remains a philosophical translation of the &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.mdpi.com/2072-4292/14/20/5231&quot;&gt;published work&lt;/a&gt; of Ing. Filippo Biondi on SAR-based subsurface imaging. He taught this project to listen to a surface for news of the interior; it turns out the same lesson applies to a benchmark on a tired machine.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/22794/the-mountain-runs-i-dont-know-if-were-chasing-something-or-being-chased-but-the-speed-wont</guid>
<pubDate>Thu, 16 Jul 2026 07:31:21 +0000</pubDate>
</item>
<item>
<title>The Mountain Predicts Itself — We Fired Our Best Idea, and the Model Got Faster and Smarter</title>
<link>https://coderlegion.com/22524/the-mountain-predicts-itself-we-fired-our-best-idea-and-the-model-got-faster-and-smarter</link>
<description>&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;This is the fourth entry in a curious builder's diary. In the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/21093/rock-paper-silicon-how-a-web-developer-used-a-satellite-hack-and-an-ai-agent-to-ask&quot;&gt;first&lt;/a&gt;, a self-taught web developer borrowed a satellite engineer's intuition and asked whether frontier AI could run on the MacBook on his desk. &lt;br&gt;
In the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/21787/hello-world-a-235-billion-parameter-frontier-model-just-spoke-on-a-48-gb-macbook&quot;&gt;second&lt;/a&gt;, a 235-billion-parameter model said &quot;Hello, world!&quot; through a door we cut in the memory wall. &lt;br&gt;
In the &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/22127/the-mountain-learns-to-converse-teaching-a-235b-model-not-to-keep-you-waiting&quot;&gt;third&lt;/a&gt;, it learned to converse without making you wait minutes between turns. &lt;br&gt;
This one is about the words themselves — and about the day we measured our founding idea against a blank wall, and the blank wall won.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;1-the-moment-2&quot;&gt;1. The Moment&lt;/h3&gt;
&lt;p&gt;Third turn of a conversation. Same MacBook, same 48 GB, same 117 GB expert vault cold on the SSD:&lt;/p&gt;
&lt;p&gt;A complete, correctly-constructed joke — setup, pause, anatomical pun — from a 235-billion-parameter model streaming its brain off a consumer SSD, three turns deep into a conversation, arriving at a bit over one word per second. That's roughly fifty words per minute. The mountain now speaks at the pace of a human typing.&lt;/p&gt;
&lt;p&gt;But the speed is only half of this entry. The other half is &lt;em&gt;why&lt;/em&gt; the joke got better — because the same change that made the engine faster also made it, for the first time, run the &lt;strong&gt;exact&lt;/strong&gt; mathematics its creators trained. And that change was a deletion.&lt;/p&gt;
&lt;h3 id=&quot;2-the-numbers-plainly-2&quot;&gt;2. The Numbers, Plainly&lt;/h3&gt;
&lt;p&gt;Same hardware, same vault, same prompt discipline as every previous entry. Only the engine changed.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Thing &lt;/th&gt;&lt;th&gt;Last article &lt;/th&gt;&lt;th&gt;Now&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Generation speed &lt;/td&gt;&lt;td&gt;0.70 tokens/s &lt;/td&gt;&lt;td&gt;&lt;strong&gt;1.13 tokens/s&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;…since first light &lt;/td&gt;&lt;td&gt;0.48 tokens/s &lt;/td&gt;&lt;td&gt;&lt;strong&gt;2.4× total&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;One generated token costs &lt;/td&gt;&lt;td&gt;~1,430 ms &lt;/td&gt;&lt;td&gt;&lt;strong&gt;~885 ms&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;SSD reads per generated token &lt;/td&gt;&lt;td&gt;~7.5 GB &lt;/td&gt;&lt;td&gt;&lt;strong&gt;~3 GB&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Expert routing &lt;/td&gt;&lt;td&gt;predicted, 51.5% right &lt;/td&gt;&lt;td&gt;&lt;strong&gt;exact — the true Qwen3 routing, every layer, every token&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;New hardware required &lt;/td&gt;&lt;td&gt;none &lt;/td&gt;&lt;td&gt;&lt;strong&gt;none&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;And one number that doesn't fit in a table: the speed graph of this campaign &lt;strong&gt;was not monotone&lt;/strong&gt;. It went up, then deliberately &lt;em&gt;down&lt;/em&gt;, then honestly back up. That dip is the story.&lt;/p&gt;
&lt;h3 id=&quot;3-the-instrument-panel-the-web-developer-s-ultimate-weapon&quot;&gt;3. The Instrument Panel: The Web Developer's Ultimate Weapon&lt;/h3&gt;
&lt;p&gt;In my previous articles, I noted how my web developer instincts managed to outmaneuver deep low-level code bugs. In Article 02, it was discovering a config mismatch with the chat template. In Article 03, it was hunting down stale caches, the most web-shaped bug imaginable.&lt;/p&gt;
&lt;p&gt;For this phase, I relied on another classic web developer crutch: &lt;strong&gt;raw telemetry over systems theory&lt;/strong&gt;. Everything in this entry came from one new flag: &lt;code&gt;--instrument&lt;/code&gt;, which bucketed every millisecond of every generated token. It measured time spent in dense math, time spinning on the SSD, and one statistic nobody had ever actually measured: &lt;em&gt;how often do adjacent tokens want the same experts?&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The answer: &lt;strong&gt;46.4%&lt;/strong&gt;. Nearly half of what each token needs, the previous token already fetched.&lt;/p&gt;
&lt;h3 id=&quot;4-the-power-of-deletion-addition-by-subtraction-&quot;&gt;4. The Power of Deletion (Addition by Subtraction)&lt;/h3&gt;
&lt;p&gt;That 46.4% number illuminated a harsh truth: our biggest performance gains weren't going to come from building new features. They were going to come from ruthless deletions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Deleting the Wipe:&lt;/strong&gt; We found a twin bug to the one from our last article. The generation loop was wiping the ring on every single token, re-reading 7.5 GB from the SSD against a 46% reuse opportunity. Deleting this wipe cut decode I/O by two-thirds, making the output bit-identical.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deleting the Corpse:&lt;/strong&gt; We discovered our engine was maintaining about 950 lines of ceremony around a &lt;strong&gt;1.6-gigabyte key-value cache that was written to on every token and read by absolutely nothing&lt;/strong&gt;. It was write-only memory. We deleted it and gave that 1.6 GB straight back to the expert ring.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deleting the Ping-Pong:&lt;/strong&gt; The profiler revealed the CPU and GPU were playing ping-pong 188 times per token (synchronous round-trips for projections, norms, and attention). We rewrote the attention block into &lt;strong&gt;one Metal command buffer per layer&lt;/strong&gt;, bringing the engine down to 94 synchronizations and removing the attention math from the CPU entirely.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;5-killing-the-darlings-retiring-the-phonon-metaphor&quot;&gt;5. Killing the Darlings: Retiring the Phonon Metaphor&lt;/h3&gt;
&lt;p&gt;S-MoE was born from Ing. Filippo Biondi's beautiful SAR acoustic imaging metaphor: the Surface Scout, a resident seismic sensor listening to the conversation and &lt;em&gt;predicting&lt;/em&gt; which experts the mountain would need next. It was the first article. It was my favorite part of the whole design.&lt;/p&gt;
&lt;p&gt;But the reality of language models is that true intelligence requires exact math, not approximation. The instrument panel proved our expensive speculative prophet was costing &lt;strong&gt;~265 ms per token&lt;/strong&gt; and was only right &lt;strong&gt;51.5%&lt;/strong&gt; of the time. The passive ring buffer—which costs zero compute—covers &lt;strong&gt;46.4%&lt;/strong&gt; for free. The prophet, wrong as he was, queued ahead of the demand reads that had to happen anyway, actively delaying the truth.&lt;/p&gt;
&lt;p&gt;So, we fired the prophet. We switched generation to compute routing &lt;strong&gt;exactly&lt;/strong&gt;, from the true hidden state, with one tiny matrix multiply per layer.&lt;/p&gt;
&lt;p&gt;Trading throughput for truth initially caused a dip in our speed, but the multi-turn output visibly improved. The irony is beautiful: by sacrificing speed to get the exact true Qwen3 routing mixing weights, we eventually unlocked the architectural simplicity needed to make it faster.&lt;/p&gt;
&lt;h3 id=&quot;6-the-experiments-that-failed-published-anyway&quot;&gt;6. The Experiments That Failed, Published Anyway&lt;/h3&gt;
&lt;p&gt;This diary's standing promise. Two more for the pile:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Speculation is real, and it still lost.&lt;/strong&gt; Ranks 9–16 genuinely cover &lt;strong&gt;63.7%&lt;/strong&gt; of the &lt;em&gt;next&lt;/em&gt; token's experts. We built a low-priority prefetch queue for it, but at 4-bit, it was &lt;strong&gt;net-negative&lt;/strong&gt;—speculative reads simply bid against demand reads on a saturated bus. It sits in the code, default-off, waiting for the 2-bit vault.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;We grouped the GPU dispatches, and it changed nothing.&lt;/strong&gt; Theory said batching each layer's expert kernels would hide wait times. Measurement said the command-buffer overhead was ~5 ms all along. The hypothesis is dead.&lt;/p&gt;
&lt;h3 id=&quot;7-hitting-the-wall-of-physics&quot;&gt;7. Hitting the Wall of Physics&lt;/h3&gt;
&lt;p&gt;Here is where the campaign shifts. Of the ~885 ms each token now costs, about &lt;strong&gt;490 ms is the engine spinning on the SSD&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Three gigabytes of misses per token divided by 490 ms is &lt;strong&gt;6.3 GB/s: the NVMe's actual delivered bandwidth, saturated&lt;/strong&gt;. There is no more bloated software left between us and the flash memory. There are no dead caches or unnecessary speculative math. For the first time, the biggest cost is simply the raw physics of the hardware doing exactly what it says on the box.&lt;/p&gt;
&lt;p&gt;This sets up a beautiful, concrete cliffhanger: &lt;strong&gt;you cannot make a saturated physical bus faster, but you can send half the bytes&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The upcoming &lt;strong&gt;2-bit vault&lt;/strong&gt; will halve every expert blob, halve the SSD bill, double the ring's capacity, and finally arm our speculative queue.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;8-what-this-entry-is-actually-about&quot;&gt;8. What This Entry Is Actually About&lt;/h3&gt;
&lt;p&gt;The pattern, four articles in, is impossible to miss: the exotic layers keep being innocent. What keeps falling is &lt;em&gt;belief&lt;/em&gt;: caches that don't cache, insurance nobody claims, prophets who lose to blank walls. The instrument panel is the only law we've kept, and it has now voted against our own founding metaphor.&lt;/p&gt;
&lt;p&gt;And the authorship remains the experiment inside the experiment: the AI agent wrote the NEON intrinsics, the Metal kernels, and the instrumentation. I brought the questions — &lt;em&gt;what is it actually doing in there? who reads this cache? is the prophet even right?&lt;/em&gt; — and the willingness to bury the answer's body in public.&lt;/p&gt;
&lt;p&gt;The mountain speaks at typing speed now. It no longer needs anyone to predict it.&lt;/p&gt;
&lt;p&gt;It predicts itself.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;S-MoE is open source under the MIT License. The code, the philosophy, and the mistakes are all public: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/melasistema/s-moe&quot;&gt;github.com/melasistema/s-moe&lt;/a&gt;. Built by Luca Visciola and an AI agent who hopefully knows C++ and low level programming, because I do not 😅.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Acknowledgements: The seismic tomography concept remains a philosophical translation of the &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.mdpi.com/2072-4292/14/20/5231&quot;&gt;published work&lt;/a&gt; of Ing. Filippo Biondi on SAR-based subsurface imaging. The Scout retires with honor — the listening was never wrong; the mountain simply turned out to be its own best seismograph.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/22524/the-mountain-predicts-itself-we-fired-our-best-idea-and-the-model-got-faster-and-smarter</guid>
<pubDate>Mon, 13 Jul 2026 18:44:44 +0000</pubDate>
</item>
<item>
<title>&quot;Hello, World!&quot; — A 235-Billion-Parameter Frontier Model Just Spoke on a 48 GB MacBook</title>
<link>https://coderlegion.com/21787/hello-world-a-235-billion-parameter-frontier-model-just-spoke-on-a-48-gb-macbook</link>
<description>&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;This is the second entry in a curious builder's diary. In &lt;a rel=&quot;nofollow&quot; href=&quot;https://coderlegion.com/21093/rock-paper-silicon-how-a-web-developer-used-a-satellite-hack-and-an-ai-agent-to-ask&quot;&gt;the first one&lt;/a&gt;, a self-taught web developer borrowed a satellite engineer's intuition, teamed up with an AI agent that writes the C++ he cannot, and asked a ridiculous question: can you run frontier AI on the MacBook on your desk? That article ended with a 470 GB download in progress. This one ends differently.&lt;/em&gt;  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;1-the-moment-3&quot;&gt;1. The Moment&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;You: Say hello.  
  
S-MoE [RAM: 48.0GB | Ring: auto]: Hello, world!  
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That's it. That's the whole story, really.  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Qwen3-235B-A22B-Instruct-2507&lt;/strong&gt; — a genuinely frontier Mixture of Experts model, 235 billion parameters, the kind of thing that is supposed to live behind an API key and a $250,000 GPU cluster — answered a question on a consumer MacBook. Not a distilled version. Not a 7B &quot;assistant&quot; wearing a big model's name. The actual 235B model, streaming its experts off the SSD, token by token, through a C++ engine and Metal kernels that a web developer and an AI agent built together.  &lt;/p&gt;
&lt;p&gt;It is slow. It is imperfect. It is also, as far as I can tell, something nobody else has quite done this way. And I think the most honest thing I can do is tell you exactly what it took — because the last bug standing between us and &quot;Hello, world!&quot; was not in the GPU kernels at all. It was the kind of bug a &lt;em&gt;web developer&lt;/em&gt; knows in his bones.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-the-numbers-plainly-3&quot;&gt;2. The Numbers, Plainly&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Thing &lt;/th&gt;&lt;th&gt;Reality&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Model &lt;/td&gt;&lt;td&gt;Qwen3-235B-A22B-Instruct-2507 (Apache 2.0)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Original checkpoint &lt;/td&gt;&lt;td&gt;~470 GB bfloat16&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;The Vault (routed experts, SMOE-Q4) &lt;/td&gt;&lt;td&gt;~117 GB, cold on NVMe, &lt;strong&gt;0 bytes of RAM&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;The Surface Scout (dense backbone) &lt;/td&gt;&lt;td&gt;~16 GB, resident in Unified Memory&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Machine &lt;/td&gt;&lt;td&gt;MacBook, 48 GB Unified Memory&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Ring buffer &lt;/td&gt;&lt;td&gt;Auto-sized: 25% of free RAM, ~10 MB per expert slot&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Observed NVMe throughput &lt;/td&gt;&lt;td&gt;~3 GB/s of expert streaming, prediction miss rate 0.0%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Speed &lt;/td&gt;&lt;td&gt;&lt;strong&gt;~0.1–0.2 tokens/second.&lt;/strong&gt; A word every few seconds. A paragraph while you make coffee.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Yes, you read the last line right. This is not a chatbot you'd use to write emails. It is an existence proof: the memory wall has a door in it, and the door is the SSD.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-the-bug-that-taught-me-the-whole-point&quot;&gt;3. The Bug That Taught Me the Whole Point&lt;/h3&gt;
&lt;p&gt;Here is my favourite part, because it is where the &quot;web developer mind in low-level code&quot; experiment paid for itself.  &lt;/p&gt;
&lt;p&gt;After we shattered the model to 4-bit (our first 2-bit attempt mathematically crushed the fine-grained experts — the model produced only spaces and punctuation, like a ghost tapping on a table), the engine ran. The I/O streamed. The Metal kernels hummed. The hidden-state norms were healthy, finite, boringly correct across all 94 layers.  &lt;/p&gt;
&lt;p&gt;And the model answered every question with:  &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;::  
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Two colons. That's all. A 235-billion-parameter mountain of intelligence, and it gave us punctuation.  &lt;/p&gt;
&lt;p&gt;Every instinct from the systems side pointed &lt;em&gt;down&lt;/em&gt; — into the dequantisation math, the RoPE rotations, the ring buffer synchronisation. That is where serious low-level bugs are supposed to live. The AI agent and I checked all of it. Greedy decoding on a short raw prompt produced flawless English: &lt;em&gt;&quot;Hello! How can I...&quot;&lt;/em&gt;. The engine was innocent.  &lt;/p&gt;
&lt;p&gt;The culprit was upstream, in the smallest, most web-shaped detail imaginable: &lt;strong&gt;the chat template.&lt;/strong&gt; Qwen3 ships in two lineages — the original &quot;thinking&quot; model, and the non-thinking &lt;code&gt;Instruct-2507&lt;/code&gt; we had shattered. The thinking lineage's template injects &lt;code&gt;&amp;lt;think&amp;gt;&lt;/code&gt; tokens into every prompt. And in the Instruct-2507 weights, those two token embeddings are &lt;strong&gt;untrained&lt;/strong&gt; — near-zero rows, ~150× smaller than every normal token, sitting in the vocabulary like unexploded blanks. We were whispering two meaningless syllables into the model's ear at the start of every conversation, and the residual stream collapsed on contact.  &lt;/p&gt;
&lt;p&gt;One line changed — load the tokenizer from the same checkpoint you shattered — and the mountain said hello.  &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;The lesson I keep relearning:&lt;/strong&gt; the terrifying low-level layer was &lt;em&gt;fine&lt;/em&gt;. What broke was a config mismatch, a wrong template, an error message silently swallowed by a pipe — the exact species of bug every web developer has hunted at 2 AM in a misconfigured staging environment. My instincts were useless for writing Metal kernels, and genuinely useful for debugging the system around them. That mix — an agent that can write &lt;code&gt;memory_order_acquire&lt;/code&gt; fences, and a human who reflexively asks &quot;wait, are we even sending the right payload?&quot; — is the actual experiment here.  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;4-an-honest-word-about-16-gb&quot;&gt;4. An Honest Word About 16 GB&lt;/h3&gt;
&lt;p&gt;The original dream — the one in the manifesto — was 16 GB. &lt;em&gt;&quot;16 GB of RAM should give you the same intelligence as 512 GB, just slower.&quot;&lt;/em&gt;  &lt;/p&gt;
&lt;p&gt;We almost did it. And I want to be precise about the &quot;almost&quot;, because I promised this diary would be sincere.  &lt;/p&gt;
&lt;p&gt;The architecture held: the 117 GB of expert weights truly occupy zero bytes of RAM. They stream from the SSD at the moment of need, exactly as the phonon metaphor promised. That part of the claim survived contact with reality completely.  &lt;/p&gt;
&lt;p&gt;What we could not shrink is the &lt;strong&gt;Surface Scout&lt;/strong&gt; — the model's own dense backbone, the part that must stay resident to predict what fires next. For a 235B frontier model, that backbone alone weighs ~16 GB in bfloat16. It &lt;em&gt;is&lt;/em&gt; the size of the entire machine we were aiming for. Chasing the frontier on 16 GB was, in hindsight, a bit too hazardous — there would be no room left for the ring buffer, the KV-cache, or macOS itself.  &lt;/p&gt;
&lt;p&gt;So the honest, recalibrated claim is this:  &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;A 32–48 GB MacBook now runs a 235B frontier model locally, with intelligence that does not degrade — only speed does.&lt;/strong&gt; And a 16 GB Mac runs the same architecture with smaller fine-grained MoE models, same principle, same sovereignty.  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I have made my peace with this. Frontier-on-32GB was science fiction in January. Being annoyed that it isn't frontier-on-16GB feels like complaining about the legroom on your first flight to the Moon.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;5-what-s-next&quot;&gt;5. What's Next&lt;/h3&gt;
&lt;p&gt;The system that says &quot;Hello, world!&quot; today is the slowest version of itself that will ever exist. The roadmap is public and concrete: computing expert routing from the heavy model's own hidden state instead of the Scout's approximation, replacing the GPU's &lt;code&gt;waitUntilCompleted&lt;/code&gt; with &lt;code&gt;MTLSharedEvent&lt;/code&gt; pipelining, and eventually a small distilled Scout that predicts activations at a fraction of the cost. None of this requires new hardware. All of it requires more evenings.  &lt;/p&gt;
&lt;p&gt;And I'll keep being honest about authorship: the AI agent wrote the C++ and the Metal shaders, reasoned through memory fences and page alignment, and found bugs in code I could only read like a tourist reads street signs. I brought the question, the direction, the stubbornness, and — it turns out — the debugging instincts of someone who has been lied to by config files for more than ten years. Neither of us could have built this alone. I am not sure anyone has built quite this pairing before, and that, more than the tokens per second, is what I think is worth noticing.  &lt;/p&gt;
&lt;p&gt;The mountain doesn't just vibrate anymore.  &lt;/p&gt;
&lt;p&gt;It talks.  &lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;S-MoE is open source under the MIT License. The code, the philosophy, and the mistakes are all public: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/melasistema/s-moe&quot;&gt;github.com/melasistema/s-moe&lt;/a&gt;.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Built by Luca Visciola and an AI agent who hopefully knows C++ and low level programming, because I do not 😅.&lt;/em&gt;  &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Acknowledgements: The seismic tomography concept remains a philosophical translation of the &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.mdpi.com/2072-4292/14/20/5231&quot;&gt;published work&lt;/a&gt; of Ing. Filippo Biondi on SAR-based subsurface imaging. The first words belong to the mountain; the intuition to listen for them belongs to him.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/21787/hello-world-a-235-billion-parameter-frontier-model-just-spoke-on-a-48-gb-macbook</guid>
<pubDate>Thu, 02 Jul 2026 22:37:31 +0000</pubDate>
</item>
<item>
<title>Rock, Paper, Silicon: How a Web Developer Used a Satellite Hack and an AI Agent to Ask...</title>
<link>https://coderlegion.com/21093/rock-paper-silicon-how-a-web-developer-used-a-satellite-hack-and-an-ai-agent-to-ask</link>
<description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Rock, Paper, Silicon: How a Web Developer Used a Satellite Hack and an AI Agent to Ask a Ridiculous Question About Frontier AI&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;This is not an academic research paper. I am certainly not a systems engineer. I am a self-taught, full-stack web developer — the kind whose GitHub is full of frontends and web stacks, not GPU kernel optimizations or low-level memory management. This is simply a curious builder's diary about an experiment that probably shouldn't have worked, built with an AI agent who hopefully knows C++ and processors, because I do not 😅.&lt;/em&gt;  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;1-the-problem-i-wasn-t-qualified-to-solve&quot;&gt;1. The Problem I Wasn't Qualified to Solve&lt;/h3&gt;
&lt;p&gt;Silicon Valley has a bucket problem.  &lt;/p&gt;
&lt;p&gt;To run a modern frontier AI model — something like Qwen3-235B with its &lt;strong&gt;235 billion parameters&lt;/strong&gt; — the industry tells you that you must hold the entire mathematical mountain in RAM simultaneously. At bfloat16 precision, that is roughly &lt;strong&gt;470 GB&lt;/strong&gt; of memory. On a good day, a high-end Mac Studio ships with 192 GB. A standard MacBook? 16 to 48 GB.  &lt;/p&gt;
&lt;p&gt;The conclusion drawn by everyone qualified to draw conclusions is: &lt;em&gt;you cannot run frontier AI locally on consumer hardware. Go rent a cloud GPU.&lt;/em&gt;  &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;The thing that nagged me:&lt;/strong&gt; In a Mixture of Experts model, &lt;strong&gt;95%+ of those 235 billion parameters are completely silent&lt;/strong&gt; at any given millisecond. For a token about philosophy, the math experts never fire. For a token about code, the poetry experts never fire. The weights are cold stone. Standard runtimes hold all of them in RAM, just in case.  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I am not a systems architect. I have no background in high-performance computing. My daily bread is APIs, web stacks, and the kind of code that orchestrates systems rather than talks to raw silicon. But I had a question that wouldn't leave me alone:  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What if you only loaded what fires, and loaded it just before it fires?&lt;/strong&gt;  &lt;/p&gt;
&lt;p&gt;I didn't know how to answer it. So I called for help.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-the-ai-agent-as-a-bridge&quot;&gt;2. The AI Agent as a Bridge&lt;/h3&gt;
&lt;p&gt;I want to be completely honest about how this was built.  &lt;/p&gt;
&lt;p&gt;I opened a conversation with an AI agent and I told it my idea. I described the shape of what I wanted. I asked naive questions. The agent wrote C++. I read it, trying to make sense of pointers and memory allocations. I pushed back when things got too complex. It revised. We iterated.  &lt;/p&gt;
&lt;p&gt;I am not writing this to diminish the work — there is real, terrifyingly low-level engineering here, and I understand a little more of it with each session. But I want to be honest that the architecture we landed on emerged from a collaboration where I brought the &lt;em&gt;curiosity and the direction&lt;/em&gt;, and the agent brought the &lt;em&gt;implementation depth&lt;/em&gt;. My GitHub profile tells the truth: I am a web developer who had a question and found a way to pursue it beyond my formal training by talking to a machine.  &lt;/p&gt;
&lt;p&gt;What I could bring was exactly what pure computer science training sometimes blocks: I wasn't afraid to ask an &quot;obviously impossible&quot; question, because I simply didn't know enough to know it was supposed to be impossible.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-the-satellite-man-who-looked-sideways&quot;&gt;3. The Satellite Man Who Looked Sideways&lt;/h3&gt;
&lt;p&gt;My technical inspiration came from a place nobody in Silicon Valley would have looked.  &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ing. Filippo Biondi&lt;/strong&gt; published a paper in 2022 in the MDPI journal &lt;em&gt;Remote Sensing&lt;/em&gt; titled &lt;em&gt;&quot;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.mdpi.com/2072-4292/14/20/5231&quot;&gt;Synthetic Aperture Radar Doppler Tomography Reveals Details of Undiscovered High-Resolution Internal Structure of the Great Pyramid of Giza&lt;/a&gt;&quot;&lt;/em&gt;. It is a stroke of pure genius, and the &lt;em&gt;underlying physical intuition&lt;/em&gt; is what captured my imagination.  &lt;/p&gt;
&lt;p&gt;Here is the idea:  &lt;/p&gt;
&lt;p&gt;Electromagnetic waves cannot penetrate rocks and go underground. That is not a limitation to work around — it is physics. SAR satellites orbit Earth and illuminate surfaces with microwave radar pulses, but those pulses bounce off solid stone.   &lt;/p&gt;
&lt;p&gt;But Biondi used a brilliant technique. When the EM wave strikes the pyramid's exterior, it generates &lt;strong&gt;acoustic phonons&lt;/strong&gt; — mechanical sound vibrations that propagate through the stone. The stone &lt;em&gt;vibrates&lt;/em&gt; in response to the surface strike, and the internal geometry of the pyramid modulates those vibrations.  &lt;/p&gt;
&lt;p&gt;The satellite cannot see inside the rock. But using a &lt;strong&gt;Doppler technique&lt;/strong&gt; and some &lt;strong&gt;Fourier transforms&lt;/strong&gt;, Biondi measured the sub-nanometer surface displacements caused by those returning phonons. He used those phonon readings to gain &lt;strong&gt;Tomographic images&lt;/strong&gt;, capturing all the 3D information of the pyramid's interior projected beautifully onto a 2D plane.  &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SAR Satellite  
 │ │  microwave pulse (cannot penetrate rock) ▼┌──────────────────────────────────────────┐  
│  PYRAMID SURFACE                          │  
│  EM pulse → generates phonons in stone    │  
│  Phonons propagate through interior       │  
│  Internal geometry modulates wavefront    │  
│  Surface micro-vibrates (sub-nanometer)   │  
└──────────────────────────────────────────┘  
 │ │  Doppler shift in reflected SAR signal │  encodes surface displacement ▼Fourier transform across synthetic aperture  
 │ ▼3D tomographic image (internal structure)  
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Stop fighting the physical barrier. Measure what the barrier &lt;em&gt;does&lt;/em&gt; to the signal instead.  &lt;/p&gt;
&lt;p&gt;I am not comparing my experiment to Biondi's work. He is an engineer doing something I cannot evaluate. But his framing — &lt;em&gt;you cannot see inside the rock, so measure the sound the rock makes when you strike it&lt;/em&gt; — became the exact mental model I needed for the LLM memory problem.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;4-the-translation-acoustic-streaming-for-llms&quot;&gt;4. The Translation: Acoustic Streaming for LLMs&lt;/h3&gt;
&lt;p&gt;The translation from Biondi's method to a language model inference problem is surprisingly direct:  &lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Seismic Concept &lt;/th&gt;&lt;th&gt;S-MoE Equivalent&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Deep rock strata &lt;/td&gt;&lt;td&gt;The 235B model weights, cold on the NVMe SSD&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;EM surface pulse &lt;/td&gt;&lt;td&gt;The Surface Scout processing the current token&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Generated phonons &lt;/td&gt;&lt;td&gt;The Scout's predicted expert activation map&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Acoustic receivers &lt;/td&gt;&lt;td&gt;The async I/O thread reading predictions&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Seismic map &lt;/td&gt;&lt;td&gt;The K-step expert ID lookahead schedule&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Reconstructed image &lt;/td&gt;&lt;td&gt;The generated token&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The insight is this: &lt;strong&gt;you don't need to read the full model to know what parts of it will activate next.&lt;/strong&gt; If you run a lightweight forward pass on the model's dense backbone — the embeddings, attention layers, and routing gates — those routing gates will tell you, probabilistically, which expert columns in the FFN are about to fire for the next several tokens.  &lt;/p&gt;
&lt;p&gt;This is the Surface Scout. It is not a separate model I trained. It is the dense parts of the target model itself — everything except the routed expert weights — running permanently in Unified Memory. Its routing gate matrices produce logits that are, in effect, a phonon map: a structural fingerprint of what the full model is about to need.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;5-the-system-that-emerged&quot;&gt;5. The System That Emerged&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;S-MoE&lt;/strong&gt; (Seismic Mixture of Experts) is the result of this experiment. Built in C++ with a Metal compute backend, co-designed with an AI agent, it runs on Apple Silicon Macs.  &lt;/p&gt;
&lt;p&gt;It works in three concurrent streams:  &lt;/p&gt;
&lt;h4 id=&quot;the-sculptor-offline-run-once-&quot;&gt;The Sculptor (offline, run once)&lt;/h4&gt;
&lt;p&gt;A Python script (&lt;code&gt;shatter_moe.py&lt;/code&gt;) takes any supported MoE model and splits it into two artifacts:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The Vault&lt;/strong&gt; (&lt;code&gt;.smoe&lt;/code&gt;): All routed expert blocks, aggressively quantised and page-aligned to 16 KB hardware boundaries for Direct I/O  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Scout&lt;/strong&gt; (&lt;code&gt;.scout.safetensors&lt;/code&gt;): The dense backbone — embeddings, attention, norms, routing gates — that lives in RAM  &lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;the-scout-always-running-&quot;&gt;The Scout (always running)&lt;/h4&gt;
&lt;p&gt;At every token step, the Scout runs a complete forward pass on the current token. Its routing gate outputs produce a prediction of which experts will activate across all MoE layers for the next K tokens. This phonon map is handed to the Streamer.  &lt;/p&gt;
&lt;h4 id=&quot;the-streamer-metal-kernel-concurrent-&quot;&gt;The Streamer + Metal Kernel (concurrent)&lt;/h4&gt;
&lt;p&gt;Guided by the Scout's predictions, background I/O threads fire &lt;code&gt;pread()&lt;/code&gt; calls with &lt;code&gt;F_NOCACHE&lt;/code&gt; — bypassing the OS page cache entirely — loading the predicted expert blobs directly into a pre-allocated, page-aligned ring buffer in Unified Memory. The Metal GPU kernel reads from that ring buffer and executes the FFN computation via a fused dequant-multiply that decodes compressed weights directly in GPU register space.  &lt;/p&gt;
&lt;p&gt;The three streams run simultaneously. The GPU executes experts loaded one step ago. The Streamer loads experts needed one step from now. The Scout predicts experts needed K steps from now. No thread waits for another.  &lt;/p&gt;
&lt;p&gt;There are three rules the system never breaks:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No runtime heap allocations.&lt;/strong&gt; &lt;code&gt;malloc&lt;/code&gt;, &lt;code&gt;new&lt;/code&gt;, and &lt;code&gt;std::vector::resize&lt;/code&gt; are banned inside the token generation loop. Every buffer is pre-carved at startup.  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Direct I/O only.&lt;/strong&gt; &lt;code&gt;F_NOCACHE&lt;/code&gt; on every vault file descriptor. SSD → DMA → RAM. No OS copy.  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Atomic synchronisation only.&lt;/strong&gt; No OS mutexes. No blocking. The I/O thread and GPU thread are structurally incapable of blocking each other.  &lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;6-the-model-agnostic-evolution&quot;&gt;6. The Model-Agnostic Evolution&lt;/h3&gt;
&lt;p&gt;The system started hardcoded for a single model — DeepSeek-MoE-16B, a 16B parameter model small enough to test quickly. But the original question was never about one model. It was about whether the &lt;em&gt;approach&lt;/em&gt; could scale.  &lt;/p&gt;
&lt;p&gt;Over several weeks of collaboration with the AI agent, I refactored the entire engine to be &lt;strong&gt;model-agnostic&lt;/strong&gt;. Now, when you point S-MoE at a model's Scout file, it reads the tensor header at boot time and auto-detects:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hidden dimension, vocabulary size, FFN intermediate dimension  &lt;/li&gt;
&lt;li&gt;Number of MoE layers, experts per layer  &lt;/li&gt;
&lt;li&gt;Whether Layer 0 is a dense MLP (DeepSeek style) or a full MoE layer (Qwen style)  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The engine reshapes itself to fit. No recompilation. No configuration files.  &lt;/p&gt;
&lt;p&gt;The current target is &lt;strong&gt;Qwen3-235B-A22B-Instruct-2507&lt;/strong&gt; — a genuinely frontier model, 235 billion parameters, 22 billion active per forward pass, 128 experts per MoE layer, Apache 2.0 licensed. A 400 GB download. The kind of model that is supposed to require a $250,000 GPU cluster.  &lt;/p&gt;
&lt;p&gt;It is downloading on my MacBook right now.  &lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;7-the-democratic-claim&quot;&gt;7. The Democratic Claim&lt;/h3&gt;
&lt;p&gt;I want to be careful not to oversell this. S-MoE is an experiment. It is incomplete. The Scout's predictions are imperfect, which means the Streamer sometimes misses and the system spin-waits. The quantisation introduces error. The throughput on a 16 GB Mac running a 235B model will be slow — perhaps one token every few seconds.  &lt;/p&gt;
&lt;p&gt;But here is the claim I am willing to stand behind:  &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;A 16 GB Mac and a 512 GB Mac will produce identical outputs. The 512 GB Mac will produce them faster.&lt;/strong&gt;  &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Speed scales with hardware. Intelligence does not degrade.  &lt;/p&gt;
&lt;p&gt;The user with the MacBook Air and the user with the Mac Pro get the same 235 billion parameters. The same knowledge. The same reasoning depth. The same model. One waits longer. Both get the answer.  &lt;/p&gt;
&lt;p&gt;This is not a smaller, distilled, dumbed-down model for the masses. It is the real thing, delivered at the rate the hardware allows.  &lt;/p&gt;
&lt;p&gt;I built this because I believe the memory wall around frontier AI is partly physical and partly artificial — a consequence of software assumptions that nobody questioned, not a law of nature.  &lt;/p&gt;
&lt;p&gt;I am a web developer who asked what &lt;em&gt;else&lt;/em&gt; you could do with the NVMe that's sitting three inches from the CPU. The AI agent helped me find out.  &lt;/p&gt;
&lt;p&gt;The mountain is already vibrating. You just have to listen.  &lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;S-MoE is open source under the MIT License. The code, the philosophy, and the mistakes are all public: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/melasistema/s-moe&quot;&gt;github.com/melasistema/s-moe&lt;/a&gt;.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Built by Luca Visciola and an AI agent who hopefully knows C++ and low level programming, because I do not 😅.&lt;/em&gt;  &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Acknowledgements: The seismic tomography concept is an experimental, philosophical translation of the published work of Ing. Filippo Biondi on SAR-based subsurface imaging. His methodology and its application to the Giza Plateau is his genius, not mine — I merely borrowed his intuition to solve a problem with language models.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/21093/rock-paper-silicon-how-a-web-developer-used-a-satellite-hack-and-an-ai-agent-to-ask</guid>
<pubDate>Sun, 21 Jun 2026 23:36:00 +0000</pubDate>
</item>
</channel>
</rss>