A prompt is a program — written in plain English, for a machine whose only instinct is to continue text. You don't change the weights; you change the context you condition them on. Done well, that's enough to steer the model completely.
01The answer, then the intuition
Because a model just predicts the next token given everything before it, the tokens you supply are the program. The frozen weights are the interpreter; your prompt is the code. This is why the same model can write poetry, extract JSON, or debug Python — you're not switching models, you're switching the context that conditions its predictions.
Three levers do most of the work. Zero-shot is just an instruction. Few-shot adds worked examples so the model infers the exact pattern you want — remarkably, with no training at all. Chain-of-thought asks it to reason step by step, spending more tokens to think before answering. Switch between them on the same task and watch the output sharpen:
Task: classify a review's sentiment and return strict JSON. Illustrative outputs; token counts are representative.
The prompt sent to the model
Illustrative output
02Mechanics
The craft is real but bounded: prompting can only elicit what's already in the weights. When the model simply lacks the knowledge or skill, no wording fixes it — that's when you reach for retrieval or fine-tuning (next chapters).
04The math
expand ▾Everything a prompt does is condition the same distribution. The model samples the answer $y$ from:
Few-shot just makes the prompt longer — the examples $\{(x_i,y_i)\}$ are extra conditioning tokens, so "in-context learning" is Bayesian conditioning, not gradient descent. Nothing in the weights changes:
Chain-of-thought factorizes the answer through an intermediate reasoning $r$, letting the model spend computation on the path before committing:
Generating $r$ token-by-token turns "think harder" into literal extra forward passes — more compute at inference time, which is why it helps on hard problems and costs more.
05The code
expand ▾Prompting is free to build, but every example and reasoning step is more tokens per call — the real tradeoff.
prompt_cost.py
instr, per_example, output = 18, 22, 12 # representative token counts
zero = instr + output # instruction only
few3 = instr + 3*per_example + output # + three worked examples
cot = instr + 45 + output # + a reasoning trace in the output
print(f"zero-shot: {zero} tokens/call")
print(f"3-shot: {few3} tokens/call ({few3/zero:.1f}x)")
print(f"CoT: {cot} tokens/call ({cot/zero:.1f}x)")
# zero-shot: 30 tokens/call
# 3-shot: 96 tokens/call (3.2x)
# CoT: 75 tokens/call (2.5x) <- better answers, more tokens, every call
06The economics
Prompting → money
Prompting is the cheapest possible way to customize a model: no training run, no data pipeline, just words — change it and redeploy in seconds. That's why most AI products start here. But the cost moves from upfront to per call: every example in a few-shot prompt and every step of chain-of-thought is more tokens, paid on every single request, forever.
At scale that arithmetic dominates. A prompt that's 3× longer is roughly 3× the inference bill across millions of calls — so serious teams trim prompts token by token, cache shared prefixes, and reserve chain-of-thought for the queries that truly need it. Prompt engineering is, underneath, cost engineering.
It also frames the build-vs-buy choice the next chapters unpack: prompting is a recurring per-token cost, while fine-tuning is an upfront cost that can shorten prompts later. For the Circuit, prompting is the demand side in miniature — the knob that turns a fixed model into useful work, one metered token at a time.
07Going deeper
expand ▾
Brown et al. (2020) — Language Models are Few-Shot Learners (GPT-3) · in-context learning.
Wei et al. (2022) — Chain-of-Thought Prompting · reasoning steps improve hard tasks.
Kojima et al. (2022) — "Let's think step by step" · zero-shot chain-of-thought.
Anthropic — Prompt Engineering Guide · practical, current techniques.
"First Principles — how AI actually works", chapter "Prompting", by The Catch. CC-BY 4.0. Hosted at TheCatch.AI / Tech Stack / AI Principles.
Strip away the narrative and all of AI's economics reduce to one unit: the token. What it costs to produce, what it sells for, and how many you must sell to repay the training bill. This is the Circuit's central question, made arithmetic.
01The answer, then the intuition
Every token has a cost and a price, and the gap between them is the entire business. But there are really two economics stacked inside it. The first is the gross one: does the revenue from a token exceed the inference cost of producing it? That depends almost entirely on utilization — a lightly-batched GPU makes every token a loss; a well-packed one makes it a profit.
The second is the fully-loaded one: even at a positive gross margin, you must sell enough tokens to repay the hundred-million-dollar training run and the hardware. Drag the batch size and watch a single token flip from a catastrophic loss to a thin profit — then see how many trillions it takes to reach the first real dollar:
70B @ 4-bit, ~$30/hr node, $3 revenue per 1M tokens, $100M training capex. Illustrative but internally consistent.
02Mechanics
So "is AI profitable?" isn't one question. A token can be gross-margin positive and the company still deeply unprofitable, because the fixed costs are gigantic and the price per token keeps sliding. Both P&Ls have to work — and they're in tension.
04The math
expand ▾Cost per token is hourly hardware cost over hourly throughput, where throughput scales with the batch:
Gross margin per token is just price minus cost; the fully-loaded break-even is the training capex divided by that margin:
The numbers are sobering. At batch 40 the margin is ~\$0.81 per million tokens — \$8.1\times10^{-7}$ each — so repaying \$100M in training takes $V^{*} \approx 1.24\times10^{14}$ tokens, 124 trillion. And $V^{*}$ moves the wrong way twice: as competition pushes $p_{\text{tok}}$ down, and as scaling pushes capex up. That widening gap between a shrinking margin and a growing fixed cost is the divergence the whole desk exists to measure.
05The code
expand ▾Utilization decides whether a token makes money — and repaying the training run is a different order of magnitude.
token_economics.py
node_cost_hr = 30.0 # $/hr, 8-GPU node
base_tps = 95.0 # tokens/sec single stream (70B @ 4-bit)
price_1M = 3.00 # $ revenue per 1M tokens
train_capex = 100e6 # $ one-time training cost
def econ(batch):
tok_per_hr = base_tps * batch * 3600
cost_1M = node_cost_hr / (tok_per_hr / 1e6)
return cost_1M, price_1M - cost_1M # cost, margin per 1M
for b in (1, 8, 40):
c, m = econ(b)
print(f"batch {b:>2}: cost ${c:6.2f}/1M margin ${m:6.2f}/1M "
f"-> {'profit' if m > 0 else 'LOSS'}")
_, m = econ(40)
print(f"tokens to clear ${train_capex:.0e} capex: {train_capex/(m/1e6):.2e}")
# batch 1: cost $ 87.72/1M margin $-84.72/1M -> LOSS
# batch 8: cost $ 10.96/1M margin $ -7.96/1M -> LOSS
# batch 40: cost $ 2.19/1M margin $ 0.81/1M -> profit
# tokens to clear $1e+08 capex: 1.24e+14 <- 124 trillion tokens
06The economics
The token → money
This chapter is the Circuit reduced to a single number you can hold. Everything upstream — the chips, the supply chain, the scaling laws, the clusters — exists to change the cost of a token. Everything downstream — the products, the agents, the enterprise deals — exists to raise the revenue from one. The business is the wedge between the two, multiplied by an almost unimaginable volume.
And the wedge is under attack from both sides. Revenue per token falls as competition and open weights commoditize intelligence; the capex per model rises as scaling demands more compute. A token that's gross-margin positive today can still leave a company far from repaying its fixed costs — and the finish line keeps moving away. That's not pessimism; it's the arithmetic.
So when someone claims AI is or isn't profitable, this is the calculation to demand. Which margin — gross or fully-loaded? At what utilization, what price, what capex? The honest answer is a spreadsheet, not a slogan — and building that spreadsheet, transparently, is precisely what an independent research desk is for.
07Going deeper
expand ▾
Sequoia — AI's $600B Question · the revenue-vs-capex gap, framed by an investor.
SemiAnalysis — inference cost economics · cost-per-token teardown from the hardware up.
Epoch AI — Training cost of frontier models · the capex side of the equation.
a16z — The Economics of Generative AI · unit economics and margin structure.
"First Principles — how AI actually works", chapter "The economics of a token", by The Catch. CC-BY 4.0. Hosted at TheCatch.AI / Tech Stack / AI Principles.
AI serving cost isn't one number to shave — it's a stack of independent levers that multiply. Each cuts cost by a factor; stacked, they compound. This is the operational discipline that turns a token that loses money into one that makes it.
01The answer, then the intuition
The reason AI costs can fall so dramatically is that the savings multiply. Caching cuts cost in half; batching cuts what's left to a quarter; quantization halves that again; routing and prompt trimming take more still. Because each lever acts on a different part of the cost, they stack — five modest wins become one enormous one.
That's why "AI is too expensive" is usually a solvable engineering problem, not a fixed fact. Toggle the levers and watch a naive $100-per-million-tokens bill collapse toward a couple of dollars:
Baseline $100 / 1M tokens (naive). Each lever's multiplier is illustrative but realistic.
02Mechanics
The discipline is to treat cost as a product of factors and attack each independently, always guarding quality with an eval so a saving doesn't quietly become a regression. Stacked carefully, order-of-magnitude reductions are routine.
04The math
expand ▾Because each lever scales a different part of the pipeline, total cost is the baseline times the product of the multipliers — not the sum:
Multiplication is what makes the effect so large. Five levers of $\{0.5, 0.25, 0.5, 0.4, 0.7\}$ give:
No single lever did that — the biggest was only 4× on its own. The compounding is the point: a stack of merely-good optimizations produces a great one. It also explains why serving prices have fallen so steeply industry-wide — providers are stacking these same factors, and the product keeps shrinking. (The multipliers aren't truly independent — caching and batching interact — but the multiplicative model is the right first-order intuition.)
05The code
expand ▾Apply each multiplier in turn and watch the running total fall.
cost_stack.py
baseline = 100.0 # $ per 1M tokens, naive setup
levers = {
"Prompt caching": 0.50, "Continuous batching": 0.25,
"Quantization (4-bit)": 0.50, "Model routing": 0.40,
"Prompt trimming": 0.70,
}
total = baseline
for name, f in levers.items():
total *= f
print(f"+ {name:22s} x{f} -> ${total:.2f}/1M")
print(f"final ${total:.2f} vs ${baseline:.0f} = {baseline/total:.0f}x cheaper")
# + Prompt caching x0.5 -> $50.00/1M
# + Continuous batching x0.25 -> $12.50/1M
# + Quantization (4-bit) x0.5 -> $6.25/1M
# + Model routing x0.4 -> $2.50/1M
# + Prompt trimming x0.7 -> $1.75/1M
# final $1.75 vs $100 = 57x cheaper
06The economics
Optimization → money
This chapter is the operational answer to Chapter 29's problem. There, a token was deeply unprofitable at low utilization; here, a stack of levers cuts its cost by ~50× — which is exactly what carries it across the line from loss to margin. Cost optimization isn't a nice-to-have; for most AI products it's the difference between a viable business and a subsidized demo.
The compounding is also why the industry's cost curve falls so fast, and why the same capability keeps getting cheaper to serve every year. Providers stack these factors continuously, so the price of a given quality of intelligence deflates — the optimistic half of the Circuit's ledger, pushing against the rising capex on the other side.
For the desk, this is a caution against static analysis. A token that looks unprofitable at today's naive cost may be comfortably profitable once optimized — and today's price may already assume optimizations a competitor hasn't made. Reading AI economics honestly means asking not just "what does it cost?" but "what could it cost, fully optimized?" — because that's the number the market is racing toward.
07Going deeper
expand ▾
Anthropic — Prompt Caching · reusing a cached prefix to cut cost and latency.
Kwon et al. (2023) — vLLM / PagedAttention · the batching engine behind the savings.
Chen et al. (2023) — FrugalGPT · routing and cascades as a cost lever.
SemiAnalysis · how inference cost is falling across the stack.
"First Principles — how AI actually works", chapter "Cost optimization", by The Catch. CC-BY 4.0. Hosted at TheCatch.AI / Tech Stack / AI Principles.