LevelUpWith

Explore / LLMOps in Production: Observe, Release, Recover, Govern / Lesson 1

Lesson 1: Why Running LLM Systems Is Different

Learn why non-deterministic, provider-hosted, token-billed systems break the usual ops assumptions, and which failure modes (silent quality loss, provider changes, runaway agent loops, cost spikes) you have to plan for.

Free to read, no account needed. Part of LLMOps in Production: Observe, Release, Recover, Govern.

By the end of this level you'll be able to

  • Sort past incidents from your own LLM feature into crash, slow, wrong-but-healthy and expensive, and say which ones standard APM would have missed
  • Run the same prompt 20 times at a fixed temperature and measure how much the outputs, token counts and latency vary
  • Write a one-page operating risk register for a shipped LLM feature, naming who owns each risk

The pager stayed green

Picture a support-ticket summariser you shipped last quarter. On a Tuesday, agents start complaining that summaries leave out refund amounts. You look at your dashboards: every request returned HTTP 200, p95 latency is flat and the error rate is zero. As far as your monitoring can tell, nothing is wrong.

It happens to the vendors too. Anthropic's September 2025 postmortem describes three infrastructure bugs that degraded Claude's responses on and off between August and early September 2025. One sent some requests to servers configured for a different context window. One corrupted output, putting Thai or Chinese characters into English replies. One was a compiler bug in token sampling. Anthropic wrote that its evaluations "simply didn't capture the degradation users were reporting". If the vendor's own evals missed it, a dashboard that counts status codes will miss it too.

This course is about closing that gap. Level 1 has no tooling. It is about changing how you think about these systems.

Four kinds of incident

Standard APM (application performance monitoring) was built for two kinds of failure. LLM features add two more.

Kind Example Does standard APM catch it?
Crash Your pinned model is retired and calls return 404 Yes. Error rate spikes
Slow Provider congestion pushes p95 latency from 3 s to 25 s Yes. Latency alert
Wrong-but-healthy Summaries drop refund amounts, with every call a 200 No
Expensive A prompt change doubles the length of answers, or an agent loops No. Requests look normal; the invoice doesn't

The bottom two rows are where the real risk is. They fail quietly and you find out from users or from the finance team.

Three assumptions that break

1. "Same input, same output." Many engineers believe temperature 0 makes a model deterministic. It doesn't. Thinking Machines Lab sent the prompt "Tell me about Richard Feynman" to Qwen3-235B 1,000 times at temperature 0 and got 80 unique completions. They traced the main cause to inference kernels whose numerical results depend on batch size. Batch size depends on server load, which means it depends on other customers' traffic. Your output can change because of someone else's workload. You can't reproduce a bug just by replaying the request.

2. "I control my dependencies." With a library, you choose when to upgrade. With a hosted model, the provider decides when the model is retired:

  • Anthropic promises at least 60 days' notice before retiring a publicly released model. After retirement, requests fail with a 404 not_found_error.
  • OpenAI promises at least 6 months for generally available models and 3 months for specialised variants. Preview models can be retired on about 2 weeks' notice.
  • Request parameters change too. Anthropic API version 2026-10-21 removed temperature, top_p and top_k, and sending them now returns a 400 error. Earlier API versions already rejected non-default values on Claude 4.7 and later models. Some OpenAI reasoning models also refuse temperature.

3. "Cost scales with requests." You pay per token, not per request, so cost per request swings with output length, retries and agent steps. Here is how an agent loop gets expensive. Each step adds about 2,000 tokens of context and sends the whole history again. Step n sends about 2,000 × n input tokens. Over 40 steps that adds up to 2,000 × (1+2+…+40) = 1,640,000 input tokens for one user request. A single call would send 2,000. Each of those 40 calls still returns a 200.

Pitfall: retries make this worse. If you retry a timeout on a long agent run, you can pay for the same work twice.

Walkthrough: measure your own variance

The numbers that matter are the ones from your own model and prompt. This script calls any OpenAI-compatible endpoint, which includes most gateways and local servers.

# variance.py  (pip install openai)
import hashlib, os, statistics, time
from openai import OpenAI

client = OpenAI(base_url=os.getenv("LLM_BASE_URL"), api_key=os.getenv("LLM_API_KEY"))
MODEL = os.environ["LLM_MODEL"]          # the exact pinned ID your feature uses
PROMPT = open("prompt.txt").read()        # a real production prompt, PII removed
TEMP = os.getenv("LLM_TEMPERATURE")       # leave unset if the model rejects it

hashes, out_tokens, latencies = [], [], []
for i in range(20):
    kwargs = {"temperature": float(TEMP)} if TEMP else {}
    t0 = time.perf_counter()
    r = client.chat.completions.create(model=MODEL,
          messages=[{"role": "user", "content": PROMPT}], **kwargs)
    latencies.append(time.perf_counter() - t0)
    text = r.choices[0].message.content or ""
    hashes.append(hashlib.sha256(text.encode()).hexdigest()[:8])  # exact-match fingerprint
    out_tokens.append(r.usage.completion_tokens)

print(f"distinct outputs: {len(set(hashes))}/20")
print(f"output tokens  min/median/max: {min(out_tokens)}/{statistics.median(out_tokens)}/{max(out_tokens)}")
q = statistics.quantiles(latencies, n=20)
print(f"latency s      p50={q[9]:.2f} p95={q[18]:.2f} max={max(latencies):.2f}")

The output looks something like this. These numbers are illustrative and yours will differ:

distinct outputs: 14/20
output tokens  min/median/max: 212/247/391
latency s      p50=2.84 p95=6.10 max=7.42

Read it like an operator:

  • Distinct outputs tells you that exact-match tests and caching by output won't work.
  • Token spread tells you how much cost per request varies. In this example the longest answer cost almost twice as much as the shortest.
  • The p95 to p50 ratio gives you a first idea of the latency budget you will need.

Gotchas: If the API returns a 400 on temperature, unset the variable and record that you ran at the provider's defaults. Run the script again at a busy hour and at a quiet hour, because batch effects change with load. Keep production prompts free of personal data when you copy them into scripts.

A one-page risk register

A risk register turns vague worry into named owners. Keep it to one page and give every row a signal that would catch the risk and a person (or role) who owns it.

Risk Kind Signal that would catch it Owner First response
Quality drops silently Wrong-but-healthy Daily sampled review; rise in thumbs-down Feature tech lead Compare against the last known-good prompt and model
Pinned model retired Crash Deprecation email or docs feed, tracked in a calendar Platform lead Run migration evals before the retirement date
Agent loops Expensive Steps per run > 25 Agent on-call Enforce the step cap; kill the run
Cost spike Expensive Daily spend per feature > 2× the 7-day average Feature PM + eng lead Find the change; cap or roll back

"Owner: the team" doesn't count. If nobody is named, nobody gets paged. Later levels build the tracing and alerting behind these signals. Today the job is to write them down.

Hands-on exercise

  1. Sort your incidents. List five past problems with your LLM feature, such as bug reports, Slack threads and bill surprises. Label each one crash, slow, wrong-but-healthy or expensive, and mark which ones your current APM caught.
  2. Measure variance. Run variance.py 20 times on one real prompt. Record the distinct outputs, the token spread and p50/p95 latency. Run it again at a different time of day and compare.
  3. Write the register. Draft a one-page risk register for the feature with at least five risks, each with a signal, a named owner and a first response. Ask one of those owners to sign it off.

Key takeaways

  • LLM features fail in four ways. Standard APM sees crash and slow, but not wrong-but-healthy or expensive.
  • Temperature 0 isn't deterministic. Server load (other customers' traffic) can change your output.
  • Providers retire models and remove parameters on their own schedule, so track their notice periods.
  • You pay per token. Agent loops that resend context can grow input tokens much faster than steps, and every call still returns a 200.
  • Measure variance on your own prompt and model before you design tests, caches or budgets.
  • Every risk needs a signal and a named owner.

A 6-question knowledge check follows this lesson in the app, free and without an account.

More like this