LLMs, Python, and CPUs: Why GPUs Aren’t the Only Game in Town
From the publisher’s feed, collected in the ZeroLabs newsroom.
When you fire off a prompt to a modern LLM, you sometimes catch it muttering to itself — “thinking,” “planning tasks,” or that oddly specific “generating Python code.” This article is about that last phrase. We spend an inordinate amount of time obsessing over GPUs, trillion-parameter models, and colossal matrix multiplications. But the reality of how AI actually serves you an answer is more nuanced — and it leans on the humble CPU and a language called Python.Here is why the AI industry relies on Python to bridge the gap between probabilistic guessing and deterministic truth, and why the future of AI hardware may look less like a GPU monoculture and more like a balanced ecosystem.1. Quick Refresher: How Does an LLM Actually Work?Before we wade into the weeds, let’s trace the pipeline using a simple prompt: “What is the capital of France?”1. Tokenizer: Turns the string (“What is the capital of France?”) into numerical IDs.2. Embedding: Gives those IDs geographic, semantic, or conceptual meaning.3. Positional Encoding: Marks the order of words so the model understands sentence structure.4. Attention: Dynamically links “capital” to “France,” grasping the relationship.5. Feedforward: Accesses the model’s internal “database” of learned knowledge.6. Softmax: Determines among the various responses there is a 78% chance the first response word is “Paris,” and outputs it.Under the hood, every single step of this pipeline is driven by massive mathematical operations called matrix multiplications. GPUs are essentially giant calculators fine-tuned to perform these at blistering speed. This architecture is incredible for semantic mapping and predicting language. But what happens when you ask the LLM to do actual math?2. The Mathematical Limits of Matrix MultiplicationsAsk an LLM to multiply 45,183 by 9,281, and it won’t “calculate” the answer the way a calculator does. At its core, the raw LLM flow is just a massive sequence of matrix multiplications. These matrices are designed for pattern recognition and probabilistic prediction, not exact calculation.There are three fundamental reasons why pure matrix math struggles with deterministic tasks:Softmax and Loss of Precision: During self-attention, outputs are passed through a softmax function, converting raw scores into probabilities. The network is fundamentally guessing the most statistically likely next token. If you ask it to multiply large numbers, it will output the number that looks most plausible based on its training data — hence the hallucinations.The “One-Pass” Bottleneck: An LLM processes tokens step-by-step. For each token, the input undergoes a fixed number of layers. If a problem requires 100 iterative loops to solve, the LLM cannot “pause” and run extra internal matrix multiplications. It has a constant depth of computation per token.Lack of Working Memory: Matrix multiplications transform vectors in place. An LLM has no physical RAM or CPU registers to store intermediate variables. If it makes a tiny arithmetic mistake early in a chain of thought, that error gets baked into its context window and cascades into total failure.How a Vector ‘Holds’ a Math Concept?But wait, if matrices are so bad at math, how does the LLM do the math it is good at? You have to stop thinking of numbers as text symbols and start thinking of them as geometric locations.Imagine a simplified 3D vector space where the axes represent abstract properties:* X-Axis: Magnitude (How big is it?)* Y-Axis: Parity (Is it even or odd?)* Z-Axis: Prime Status (Is it prime?)In this space, the number “4” isn’t a text character; it’s a spatial coordinate: `[Magnitude: 4.0, Parity: 1.0 (Even), Prime: -1.0 (No)]`.When the LLM processes 4 + 3, its internal patterns perform a geometric transformation. The vector shifts along the X-axis by the magnitude of the second number, and the Y-axis flips (because Even + Odd = Odd). The resulting coordinate lands near [Magnitude: 7.0, Parity: -1.0 (Odd)], which the model then translates back into the text token “7.”This geometric intuition works beautifully for simple concepts, but it breaks down under the weight of complex, multi-step arithmetic. For that, we need a different tool.3. Why We Delegate to PythonTo solve the limitations of pure matrix math, modern AI uses a paradigm called Program-Aided Language Models (PAL). Instead of forcing the LLM to be the computer, we use the LLM as a translator that writes instructions for an actual computer.Think of it as a division of labor:The LLM (Matrix Multiplications): Acts as the brain. It is creative, understands natural language, and knows how to solve a problem conceptually.The Python Interpreter (Symbolic Executor): Acts as the calculator. It executes instructions with perfect, cold, mathematical precision.Inside the LLM, specialized attention mechanisms learn to bind entities to attributes — linking variable “x” to “number of grapes” from a word problem, for instance — without needing physical RAM. Once the model has mapped the logic, it outputs the syntax as a Python script and hands off the execution.4. How is Python Code Generated by an LLM?An LLM doesn’t just guess when to run Python. It executes a highly engineered process:1. The Setup:The host platform registers a “Tool Box” definition via a silent JSON schema, telling the LLM it has access to a secure Python sandbox.2. Tool-Call Fine-Tuning: Models undergo training where they learn to recognize intent. If you ask for a poem, it uses standard generation. If you ask it to plot a bar chart from a CSV, it recognizes this requires deterministic execution.3. The Trigger:If a tool is needed, the LLM halts text generation and outputs a specialized system token, like “print(45183 * 9281)”.4. The Execution Loop: The host platform intercepts this token, sends the code to a secure Docker container, runs it, and feeds the exact output back to the LLM. The LLM then wakes up to format the final answer for the user.5. Was the Python Sandbox Always There?Before mid-2023, LLMs were purely “minds in a jar” — all matrix multiplication, with no physical hands to touch the outside world. Today’s hybrid sandbox systems bridged that gap.Setting up a Python sandbox is a security and operational nightmare. Without rigorous sandboxing — using isolated virtualization layers with zero network access and strict CPU limits — a malicious user could trick the AI into hosting a botnet or attacking the host server. Furthermore, keeping millions of virtual environments spun up and ready for real-time execution is a massive cloud infrastructure challenge. It took providers like OpenAI and Google significant engineering to make these environments fast, safe, and scalable.6. Why Python and Not Some Other Language?If we just need a deterministic calculator, why not delegate to C++, Rust, or JavaScript?The industry selected Python for a combination of practical, historical, and technical reasons:The Lingua Franca of AI: Python is the native language of data science. Libraries like NumPy, Pandas, and Matplotlib are already baked into the ecosystem. If an LLM needs to analyze data or draw a chart, Python is the obvious choice.Training Data Abundance: LLMs are trained on the internet, and the internet is overflowing with Python code from GitHub, Stack Overflow, and tutorials. Because the model has seen millions of Python examples, its “Syntax Circuits” are incredibly reliable at generating valid Python without compilation errors.Readability: Python’s indentation-based, highly readable syntax makes it structurally easier for a next-token predictor to generate correctly compared to the bracket-heavy, verbose syntax of languages like Java or C++.But how often are we actually asking these models to write Python versus, say, a sonnet? Let’s look at how this division of labor translates to real-world cloud traffic.7. The Great Compute Divide: How Much Work Goes Where?While AI companies keep exact telemetry close to their chest, industry analyses reveal a fascinating computational paradox. Today, roughly 20–30% of prompts are strictly CPU-centric, 60–70% are GPU-native, and about 5–10% are hybrid — where a GPU generates code that a CPU then executes.The “CPU-Capable” Overkill (20–30%):Extracting emails from text, converting CSVs to JSON, or sorting lists. A CPU could process 100,000 of these a second. Instead, we fire up billion-dollar GPU clusters to figure out if a user wants a comma removed.The True “GPU-Native” Tasks (60–70%):Summarizing legal PDFs, drafting polite emails, or brainstorming. You cannot write a Python `if/then` statement for “politeness.” This strictly requires high-dimensional reasoning.The Hybrid / Tool-Use (5–10%): “Analyze this spreadsheet and find the standard deviation.” The GPU understands the request and writes the code; the CPU crunches the numbers.If we look at the actual latency telemetry for a modern “hybrid” prompt — say, asking an AI to analyze a CSV and calculate the standard deviation — the time split is staggering. The LLM running on the GPU takes roughly 4 to 6 seconds just to reason through the request and generate the Python code token-by-token. The CPU then takes about 50 milliseconds to actually execute the code and crunch the numbers. Today, the GPU does 90% of the “thinking time,” while the CPU does 10% of the work but delivers 100% of the mathematical accuracy.Using a 100-billion-parameter GPU cluster to write a script that a CPU executes in a fraction of a second is, frankly, an economic dead end. The industry is acutely aware of this latency bottleneck, which is why architectures are shifting toward semantic routing and code caching — bypassing the GPU generation step for routine tasks.8. Speculating the Future: A Tiered Compute EcosystemToday, roughly 70% of AI tasks require true, GPU-native reasoning. But in the future, that 70% will not all be routed to expensive cloud data centers. Instead, workloads will fragment through smart routing, edge migration, and semantic caching.This shift isn’t just a neat architectural trick; it is an absolute necessity driven by physical infrastructure limits. Data center GPU racks can demand upwards of 60kW of power — nearly ten times the draw of a standard CPU rack — and generate immense heat that strains local power grids. Consequently, new data center construction is facing heavy environmental pushback from municipalities. While GPUs are highly efficient at parallel matrix math, using them to execute sequential control logic or basic Python scripts wastes massive amounts of electricity. CPUs, built specifically for sequential tasks, handle deterministic code execution with vastly less energy.Furthermore, we will see the rise of Semantic Code Caching. Right now, every time a user asks for a specific data transformation, the GPU generates the Python code from scratch. In the near future, user prompts will go through an initial semantic search phase. If an LLM has already written a successful script to extract specific metrics from a standard sales report, that code will be sanitized and stored in a central library. Instead of regenerating the code, the LLM simply selects the pre-generated Python script and runs it. This bypasses the expensive GPU generation step entirely for routine tasks, shifting the load to the CPU for retrieval and execution.If we model how today’s traffic will distribute across a tiered hardware ecosystem in the coming years, a plausible, balanced split emerges:Tier 1: Cloud GPUs (Frontier Models) — ~30% of Traffic: This handles the hardest puzzles. Complex multi-step reasoning, deep “System 2” thinking, and continuous Reinforcement Learning training. A portion of today’s 70% GPU-native workload will stay here, but cloud GPUs will transition from basic chatbot hosts into specialized reasoning engines that spend minutes or hours thinking through novel, complex problems (like discovering a new drug for cancer) or writing code for a task that has never been attempted before.Tier 2: Local GPUs & NPUs (Edge Devices) — ~30% of Traffic: Another large chunk of today’s 70% GPU-native workload will move to the edge. Chips like Apple’s M-series and mobile Neural Processing Units (NPUs) have enough unified memory to run highly capable Small Language Models (SLMs) locally. This handles routine semantic tasks, like drafting an email or summarizing a webpage, without ever hitting the cloud.Tier 3: Cloud CPUs (Execution & Retrieval) — ~20% of Traffic: This absorbs the 5–10% of today’s hybrid tool-use tasks, supercharged by caching. Running millions of concurrent, sandboxed Python environments — whether executing newly generated code or retrieving and running cached scripts — requires cloud CPU clusters. The semantic search phase used to find cached scripts relies on vector databases, which are CPU-bound for fast retrieval.Tier 4: Local/Desktop CPUs — ~20% of Traffic: Handling deterministic, rule-based tasks that don’t even need a neural network — like extracting text via regex, sorting local files, or basic arithmetic — will be routed directly to the user’s local CPU in milliseconds.In this new paradigm, GPUs aren’t going away; their role is just maturing. By combining smart semantic routing, localized edge inference, and code caching, the industry will move to an optimized, balanced compute architecture.SummaryThe LLM acts as the creative brain, parsing messy human intent and formulating a plan, while the traditional CPU acts as the executor, running deterministic Python code with absolute precision. As we look to a future where AI is woven into the fabric of our daily computing, the harmony between the probabilistic GPU and the deterministic CPU will be our guiding principle. Isaac Asimov once said“Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.”The LLM may be brilliantly creative, but when we need the absolute truth, Asimov reminds us that we still rely on the cold, completely honest precision of the CPU.LLMs, Python, and CPUs: Why GPUs Aren’t the Only Game in Town was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.