The SRE Guide to LLM Infrastructure: Managing the Chaos of Non-Determinism

Traditional SRE is built on the comforting lie that systems are deterministic. We spend our careers assuming that if we send the same request to a healthy service twice, we get the same result twice. We build our SLOs around this. We monitor 5xx errors and p99 latency, and we assume that as long as the HTTP response is 200 OK, the system is doing its job. But when you move into hosting Large Language Models (LLMs) and agentic workflows, those assumptions fall apart.

The real pain of LLM infrastructure isn’t just the cost of H100s or the difficulty of scaling a Kubernetes cluster. It is the fact that the failure modes are fundamentally different in kind. I’d argue that we are moving from a world of ‘hard failures’—where a service crashes or a timeout occurs—to a world of ‘soft failures,’ where the system remains perfectly healthy from a networking perspective but is hallucinating nonsense or executing the wrong tool calls.

The GPU Resource Contention Nightmare

If you have managed a standard microservices architecture, you are used to CPU and RAM being relatively fluid. You can overcommit CPU, and you can scale horizontally with a few more pods. GPUs are a different beast. VRAM is a hard limit. When you hit an Out of Memory (OOM) error on a GPU, you don’t just get a slow response; the process dies, and often, it takes the driver or the container with it.

The more interesting problem is the KV (Key-Value) cache. To avoid recomputing the entire prompt for every new token generated, we store previous computations in the KV cache. This cache consumes VRAM. As your context window grows, your memory pressure increases linearly. If you have multiple users hitting a model with massive prompts, you run into severe resource contention. You can’t just ‘add more RAM’ to a GPU mid-flight.

I have seen clusters where a few ‘power users’ with 100k token prompts effectively DOSed the entire inference engine by hogging the KV cache, leaving no room for other requests. This creates a weird kind of latency spike that doesn’t show up as a CPU bottleneck. It shows up as queuing delay. The request is accepted, but it sits in a scheduler’s queue because there isn’t enough contiguous VRAM to allocate the cache for that specific sequence.

Managing this requires a shift in how we think about capacity planning. We stop looking at average memory usage and start looking at peak memory allocation per request. If your model weights take up 40GB of an 80GB A100, you have 40GB left for activations and the KV cache. If you don’t strictly limit the maximum sequence length, a single request can theoretically push the system into an OOM state.

Latency: TTFT vs. TPOT

In a standard REST API, latency is a single number. You measure the time from request to response. In LLM infrastructure, that metric is useless. Because we stream tokens, we have to split latency into two distinct categories: Time to First Token (TTFT) and Time Per Output Token (TPOT).

TTFT is essentially the ‘prefill’ phase. The model has to process the entire input prompt before it can generate the first word. If you have a massive prompt, the TTFT will be high regardless of how fast the GPU is at generating tokens. This is where most of the ‘perceived’ lag happens. If the TTFT is too high, the user thinks the app is frozen.

TPOT, on the other hand, is the ‘decoding’ phase. This is the steady stream of tokens. If TPOT is inconsistent, the text appears to ‘stutter’ on the screen. From an SRE perspective, these two metrics require different optimization strategies. To fix TTFT, you look at prompt caching and batching strategies. To fix TPOT, you look at memory bandwidth and quantization.

The danger here is relying on average latency. A system could have a great average latency but a terrible p99 TTFT because of a few extremely long prompts. This creates a fragmented user experience where the system feels fast for some and broken for others, even though the ‘health’ dashboards are all green.

The Problem of Lateral Failures

This is where we get into the territory of agentic systems. Traditional software fails in ways we can enumerate: a 500 error, a database timeout, or a full disk. We write runbooks for these because the failure space is finite [1]. But LLM-driven systems fail laterally [1].

A lateral failure happens when the infrastructure is working perfectly, the model is returning a 200 OK, and the tool it called returned a success, but the agent decided to call the wrong tool or pursued a coherent-looking but entirely wrong subgoal [1]. This is a nightmare for an SRE because your standard monitoring doesn’t catch it. Your error rate is 0%, but your system is effectively broken.

I’d argue that the most dangerous part of this is the compounding effect. A single agent step that goes slightly sideways gets passed as context into the next step [1]. The next step, working from that bad context, produces output that is more confidently wrong [1]. By the time you reach step four or five, the agent is miles away from the original goal, but every single API call in the chain was technically ‘successful’ [1].

If you try to bolt conventional SRE tooling onto these workflows without changing your assumptions, you will end up paging at 3am because an agent made twelve API calls it shouldn’t have, and nobody noticed until a downstream system failed silently [1]. The blast radius of an agent with tool access is not bounded in the way a standard microservice’s blast radius is [1].

Rethinking Observability

Since 200 OK no longer means ‘success,’ we have to change what we observe. We can’t just monitor the transport layer; we have to monitor the semantic layer. This means moving from metrics to traces and evaluations.

The first step is implementing strict tracing for every step of the agent’s thought process. You need to see exactly what the model ‘thought’ before it decided to call a tool. If you only log the final output, you have no way to debug why the agent went off the rails. You need the intermediate steps, the prompt sent, and the raw response from the LLM before it was parsed into a tool call.

Then there is the challenge of ‘evals.’ In traditional SRE, we have integration tests. In LLM SRE, we have evaluation sets. We run a set of known inputs and compare the outputs against a ‘golden set’ of expected answers. But because LLMs are non-deterministic, you can’t do a simple string comparison. You end up using another LLM to grade the output of the first LLM. This is an absurd recursive loop, but it is currently the only way to get a quantitative measure of reliability.

The real struggle is doing this in real-time. You can’t run a full eval suite on every production request. Instead, you have to implement ‘guardrails’—small, fast models or regex patterns that check the output for common failure modes before it reaches the user or the next tool in the chain.

Practical Strategies for LLM Stability

To keep these systems from collapsing, we need to implement patterns that explicitly account for non-determinism and resource volatility. You cannot treat an LLM as a black box; you have to treat it as a flaky dependency that needs constant supervision.

One of the most effective patterns is the ‘circuit breaker’ for agentic loops. If an agent is calling the same tool repeatedly with the same arguments, or if it has exceeded a certain number of steps without reaching a goal, the system must force a hard stop. This prevents the ‘infinite loop’ scenario where an agent burns through your GPU credits and API quota while pursuing a hallucinated goal.

Another critical strategy is prompt versioning. A small change in the system prompt can completely change the model’s tendency to hallucinate or its ability to follow tool-calling schemas. You should never update a prompt in production without a canary deployment. I’ve seen cases where a ‘minor’ wording change to make the model ‘more polite’ actually broke its ability to output valid JSON, crashing the entire parsing pipeline.

We also need to address the GPU scheduling problem. Instead of simple round-robin load balancing, we need ‘context-aware’ routing. If a request comes in with a massive prompt, it should be routed to a node with more available VRAM or a specific configuration optimized for long contexts. This prevents a few heavy requests from degrading the performance for everyone else.

Here are the core components I believe every LLM reliability stack needs:

  • Semantic monitoring that tracks ‘correctness’ rather than just ‘availability.’
  • Strict VRAM limits and KV cache management to prevent OOM crashes.
  • TTFT and TPOT tracking to separate prefill lag from generation stutter.
  • Agentic loop breakers to stop compounding errors and runaway API costs.
  • Prompt versioning with canary rollouts to prevent regression in model behavior.

The Human in the Loop

Finally, we have to accept that we cannot automate away all the risk. Because the failure modes are lateral and non-deterministic, the ‘human in the loop’ is not just a UX feature; it is a reliability requirement. For high-stakes actions—like deleting a database record or sending an email to a client—the agent should never have autonomous access. It should propose an action, and a human should approve it.

This shifts the SRE’s role. We aren’t just managing servers; we are managing the interface between a non-deterministic engine and a deterministic world. The goal is no longer 100% uptime—because ‘uptime’ is a meaningless metric if the model is lying to the user—but rather ‘bounded unpredictability.’

We are essentially building a safety cage around a stochastic process. The more we rely on these systems, the more our SRE practices must evolve from monitoring pulses to monitoring meaning. It is a messy, imprecise science, but it is the only way to move LLMs from ‘cool demo’ to ‘production-grade infrastructure.’

The transition is jarring. For those of us who grew up on the reliability of a well-tuned Postgres instance, the volatility of an LLM is frustrating. But the challenge is where the interesting work is. Solving GPU contention and lateral failure is the new frontier of systems engineering.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.