Skip to content
farzad.fm
AI & Automation

Why SpaceX Rebuilt Grok On Starlink Code

SpaceX dumped the standard AI software and rewrote Grok's RL and inference stack in C and C++ using Starlink's habits. Memory claimed at startup, its own packet headers, its own leap-second clock. Here's why that discipline matters when one late chip can idle a whole building.

Loads from YouTube only after you press play.

Watch on YouTube

Why would a rocket company use satellite internet code to build an AI? Elon Musk raised it himself in a string of posts on X. SpaceX threw out its existing AI software and rebuilt the engine behind Grok on the same code design that runs Starlink satellites in orbit.

Musk put it plainly. "Turns out that the Starlink software, built for managing the movement of vast amounts of data through space and to the ground, is also very well suited to training super intelligence."

On the surface those belong to different worlds. One is a swarm of satellites beaming internet to rooftops and airplanes. The other is an AI in a warehouse learning to write code. But I think the link is real, and it comes down to two things almost nobody in AI talks about. Who controls the memory, and who controls the clock.

One company, one codebase

Why is SpaceX writing Grok's software at all? Because in February 2026 SpaceX completed its acquisition of xAI, the AI company that had already absorbed the social platform the year before. Then in October 2026 Musk confirmed the AI division's new name, SpaceXSI, short for SpaceX Super Intelligence.

So the engineers who wrote flight and networking code for Starlink got handed the keys to how Grok learns and runs. In a November 10th update on the upcoming Grok 4.8, Musk wrote, "We have dumped JAX/SGLang and rewritten the entire RL and inference stack from scratch in C/C++, which took some extra time."

That reads like alphabet soup. Underneath it sits the biggest bottleneck in the whole AI race.

Half the silicon waits

According to SpaceX's third quarter 2026 report, its AI segment alone logged about $16.4 billion of capital spending in a single quarter. But even well-run training jobs can leave more than half of the raw math power inside those chips unused, as Meta's Llama 3 numbers below show. The chips sit idle, waiting for data to travel across cables from other chips.

So fix the software that moves data between chips and you get a big jump in useful computing without buying a single extra silicon wafer. That's the prize hiding inside Musk's alphabet soup.

Where Grok 4.8 stands

Right after the rewrite news, Musk laid out the schedule. "Training (aka pre-training) is done," he wrote. He said a lot of cleanup was needed on the SFT data to get it mostly right, that the evals were starting to climb, and that SpaceX would do a soft rollout to bot users later that week.

Each term is a stage. Pre-training is the model reading trillions of words of books, articles and code. SFT, supervised fine-tuning, is a study guide of practice questions paired with ideal answers. RL, reinforcement learning, takes the answer key away. The model attempts thousands of hard coding and math problems, a grader scores whether the code works, and the model rewires itself when it finds a smarter path. That's the stage Grok 4.8 has moved into. Evals are the standardized exams that track the progress.

It ran late. In September 2026, Musk posted that Grok 4.8, which he described then as a 2.5 trillion parameter model, would finish pre-training that week. Finishing that run and rebuilding the software around it took nearly two more months.

One engine, two jobs

Why rewrite RL and inference together? Because during RL the model has to generate millions of practice answers using the inference engine before any of them get graded. After launch, that same engine runs every second a customer uses the model. So a slow serving engine drags down practice and daily work at the same time. Fix one and you fix both.

Firing the middle managers

So what did SpaceX throw out? JAX is a framework built at Google that lets researchers write math recipes in Python, then uses an automatic compiler to turn that recipe into instructions for the GPU. SGLang is a popular open-source serving engine, also built around Python, that manages how a model generates answers for users and spits out practice attempts during RL.

Think of them as translators and kitchen managers in a huge restaurant. The head chef calls an order in plain English, and layers of managers translate it before the line cooks ever touch a pan. That's great when a small research team wants to test recipes fast. At the scale SpaceX is running, every hand-off costs time.

xAI started as that small team. When it released open weights for its first Grok model in March 2024, the company's blog post said the model was trained with a custom training stack on top of JAX and Rust. Even in September 2026, when Musk posted that the Starlink software team had written a new C and C++ stack for pre-training, he admitted the RL stack was still a legacy pile of many different third-party software systems. Now that whole pile is gone.

Who sweeps the workbench

When a user on X asked whether the old code was written in Rust and why SpaceX switched to C and C++, Musk replied with a one-liner about managing memory. In other posts he called the new code "C with a little C++, but not too much," and added, "There's even some assembly." He said super intelligence will one day write a better software stack, but that day hasn't come. "This is tight code," he wrote.

Picture a chip's memory as a workbench where numbers sit during a job. Python uses a garbage collector, a cleanup crew that periodically freezes work to sweep away old numbers. Rust skips the crew and puts a strict safety inspector in the compiler that won't let a program run unless every piece of memory follows rigid ownership rules. Hand-managed C drops both and gives the engineer direct control over the bench. Assembly goes one level deeper, to the raw instructions the silicon speaks.

Why take the slower, harder road? Because Starlink already proved the point. In a May 2021 article on the Stack Overflow blog, a Starlink software engineer explained that SpaceX built its core satellite infrastructure to allocate all of its memory at startup. A satellite computer that grabs memory on the fly in orbit risks a tiny delay or fault that knocks it out of sync with its partner computers.

An AI supercomputer has the same weakness at a much bigger size. Tens of thousands of chips have to finish each math step at the same split second, so one chip pausing for a memory cleanup holds up the whole building. The rewrite cost extra months of engineering. It bought direct control over the memory and every tick of the chip.

Your own shipping labels

Musk's strangest post tied all this to the spin of the Earth. "At SpaceX, we write our own headers and calculate our own time," he wrote, noting that includes leap seconds. "Not many people will know what this means, but those that do will appreciate it." He said the new Grok training and inference stack is derived from work done by the engineers who created Starlink.

Start with headers. When a computer sends data across a cable or a laser beam, it chops the data into packets. The front of each packet carries a header, a shipping label saying where it came from and where it's going. Standard internet headers were designed decades ago for general web traffic over fixed phone and fiber lines, so they carry extra baggage. For satellites at orbital speed, or a warehouse of chips passing trillions of numbers a second, that label is bloated. So SpaceX designed its own stripped-down label for its own hardware and shaves bytes and delay off every packet.

The second that crashes servers

Now the clock. Why would an AI lab care about leap seconds? Because computers don't actually agree on what time it is. International atomic time ticks at a perfectly steady rate. Civil time, called UTC, gets adjusted to match the Earth's slightly uneven spin. Since 1972, timekeepers have inserted 27 extra seconds into civil clocks. So civil time sits 37 seconds behind atomic time, while GPS satellite clocks ignore leap seconds and run 18 seconds ahead of civil time.

Standard operating systems expect every minute to have 60 seconds and every day to have 86,400. When a leap second hits at midnight, the clock either repeats a second or jumps backward. Software that subtracts two timestamps gets a negative number and panics. When a leap second was added at the end of June 2012, a glitch confused Linux timers and crashed servers at Reddit. In January 2017 another one made Cloudflare's routing software panic on a negative time calculation.

Big tech companies usually dodge this with a leap smear, slowing their servers' clocks over many hours to absorb the extra second. For SpaceX, I think that's unacceptable, because a smeared clock is deliberately wrong. At Starlink's orbital speed, one millisecond of clock error puts a satellite 25 feet from where the network thinks it is.

Chips have the same problem. Inside an AI cluster, every chip runs tight timeouts to check whether its neighbor is still alive. Let the clocks drift or smear and healthy chips get falsely declared dead, or the whole run stalls waiting on a ghost. So SpaceX calculates continuous time inside its own code with the leap seconds built in. That keeps a tiny timing hiccup from being mistaken for a crashed machine.

Servers that orbit

Look at what Starlink software actually runs. The satellites fly in shells roughly 340 miles up at about 17,000 miles per hour, lapping the Earth every 95 minutes. As a Starlink network software manager explained in a Stack Overflow written report, one satellite stays over a rooftop dish for only a few minutes before handing the connection to the next one in line.

In a June 2020 Reddit Q&A, Matt Monson, who then led Starlink software, explained the philosophy. SpaceX thinks of its satellites more like servers in a data center, updating the software on all of them about once a week, with the option to pause or roll back.

The late chip problem

Here's where it clicks. An AI training cluster is a data routing problem in disguise. In pipeline parallelism, early layers of the model live on one group of chips and later layers on the next, like stations on an assembly line. After every training step, the chips combine what they learned and send fresh numbers back to every chip before the next step can begin.

What happens when you keep that many chips in lockstep? Meta published the numbers in its July 2024 technical paper for Llama 3, trained on up to 16,384 Nvidia H100 GPUs. In a 54-day stretch of pre-training, the job suffered 419 unexpected interruptions, about one every three hours, and nearly three-fifths traced to GPU problems, including high bandwidth memory faults. Even when the cluster ran smoothly, Meta measured model flops utilization, the share of peak chip math actually used, at only 38 to 43%.

Worse than a crash is a straggler. One hot chip or one congested cable finishes its step a fraction of a second late, and 100,000 other chips sit idle waiting for it. In orbit, Starlink satellites form about 266,000 new laser links a day, per a January 2024 SpaceX presentation, and the software keeps rerouting traffic as links change. Starlink's engineers spent years routing data around fast-moving satellites and dropped links without pausing the network. I think that's exactly the skill a giant AI cluster is missing.

Conceding the scoreboard

So why did Musk openly admit Grok 4.8 trails its biggest rival? He wrote that Grok 4.8 "will bear no resemblance to 4.7 (thankfully). It is not yet incredible, but, this time, the foundations are built right." Asked how it compares with Anthropic's Claude Opus 5.5, he answered, "Not as good. Opus 5.5 is a masterpiece," and said Grok 5 should exceed Opus 5.5, maybe in two or three months.

SpaceXSI released Grok 4.7 in September 2026, and on the company's own benchmark tables, rival frontier models beat it on several coding and terminal tests. Musk is conceding today's scoreboard because his bet is on the foundation.

Here's a hypothetical to show why. If a standard stack uses 40% of a chip's peak math and a custom C and C++ stack lifts that to 50%, the 10-point gain delivers 25% more useful training every day on the same chips. SpaceX hasn't published an outside measurement of its utilization. An xAI engineer did post in September 2026, "We've built the fastest training stack in the world." Treat that as a company claim until someone measures it.

One clock, ground to orbit

First in line for Grok 4.8 are Grok Bot users. Grok Bot is SpaceXSI's persistent AI agent product, and on SpaceX's October 20th earnings call, Gwynne Shotwell said it had 800,000 paid weekly users in early October after an August launch. Agents work for hours in the background, so the inference engine runs around the clock, and tighter code means every token takes less memory, latency and electricity.

Then there's a SpaceX job listing first posted in October 2026, titled Software Engineer, Supercomputer Network (Starlink), to maintain a single lean Linux-based operating system under both the supercomputer network fabric and the Starlink laser mesh.

So whether a GPU rack is bolted to a concrete floor in Tennessee or flying above the Earth, SpaceX wants the network to see the same node, the same clock and the same code. Leap seconds sound like trivia. At the scale SpaceX is building, I think the company that keeps its own time keeps its chips busy.

Watch

Prefer the tape?

Open the source video on YouTube if you want the full cut.

Digest

Prefer the daily pulse?

Short breakdowns of what actually moved, every day.