Tag:LLM

Articles, tutorials, and guides tagged LLM.

11 min

Your RAG Cites a Source That Does Not Say That

Your retrieval is good. The right chunks come back, the citation links resolve, and the answer reads clean. Then a user clicks the citation and the document says nothing of the kind. The model wrote a confident claim, stapled a real source to it, and shipped. A grounding gate catches that before the user does.

RAG
Hallucination
10 min

One Customer Burned Your Month of LLM Budget by 2pm

LLM spend is per request and wildly variable, so a single runaway agent or one heavy tenant can externalize its cost straight onto your margin. Cheaper models and caching lower the average, but nothing stops the bill. A per-tenant spend ledger with the cap enforced before the call does.

LLM
Agents
10 min

Your Tool Returned 40,000 Tokens. The Agent Needed 12.

A single tool call can dump a whole file, a full API response, or a thousand log lines straight into the context window. The agent needed one field. Now every turn after that re-pays for the whole blob. Offloading the payload to a store and keeping only a handle in context fixes both the cost and the window.

LLM
Agents
10 min

The Agent Is Not Confused. Its Context Is Stale.

In a long session an agent keeps every tool result it ever saw, including the three older versions of a file that has changed twice since. It then acts on the wrong one. This is agent drift, and it is a correctness bug, not a token bill. Here is how staleness-aware pruning fixes it.

LLM
Agents
10 min

Your Agent Calls One Tool, Waits, Then Calls the Next

When an agent needs three lookups that do not depend on each other, running them one at a time makes the user wait for the sum of all three. The model already tells you which calls are independent. Running that batch concurrently collapses the wait to the slowest single call.

LLM
Agents
11 min

The Agent Can Call the Tool. That Is Not the Same as Allowed.

An agent that holds a tool runs it with the whole application's credentials, not the current user's. That gap is the confused deputy problem, and it is how a support agent ends up refunding an order the user was never allowed to touch. The fix is a fail-closed authorization check on every side-effectful call.

LLM
Agents
11 min

Your Agent Cost $2 Yesterday and $40 Today and You Cannot See Why

An agent's cost is elastic and path-dependent, so the same task runs for two dollars one day and forty the next. Plain logs will not tell you which step looped. A distributed trace built on OpenTelemetry's GenAI conventions shows you exactly where the tokens went.

LLM
Agents
11 min

You Pay Full Price for the Same 8,000-Token Prompt on Every Agent Step

An agent resends the same enormous system prompt, tool list, and history on every step, and without prefix caching you pay full input price and full prefill latency each time. Structuring the prompt so the provider reuses its KV cache cuts both, and one wrong byte quietly turns it all off.

LLM
Agents
11 min

Your Agent Fans Out Faster Than Anything Downstream Can Take

An agent that spawns subtasks and fans out tool calls builds an unbounded work queue, hammers your rate limits, and burns the token budget before the run finishes. Backpressure, bounded concurrency, and circuit breakers keep the fan-out from taking down the systems it depends on.

LLM
Agents
10 min

Your Agent Dies at Step 40 and Starts Over From Zero

A long agent run that crashes halfway restarts from scratch, re-spending every token it already paid for and re-firing side effects you never wanted twice. Durable execution fixes that with checkpoints, replay-safe steps, and idempotency keys.

LLM
Agents
10 min

Your Agent Answers the Same Question Fifty Times a Day

Most of what your agent gets asked, it has already answered. A semantic cache reuses those answers on near-identical questions, cutting cost and latency, as long as you build the guardrails that stop it from serving the wrong one.

LLM
Caching
10 min

Your LLM Returns Almost Valid JSON, and Almost Is Breaking You

Once an LLM feeds a real workflow, "mostly valid" JSON is a failed handoff, not a formatting quirk. Here is how to get schema-valid output every time with a validation gateway that parses, repairs, and fails loudly.

LLM
Structured Output
10 min

LLM Evals in CI: Catch Regressions Before Your Users Do

Most teams find out a prompt change broke something from a support ticket, not from CI. Here is how to build an eval gate that scores your LLM outputs and blocks regressions before they ship.

LLM
Evals
9 min

LLM Model Routing: Cut AI Costs Without Losing Quality

Sending every request to your most expensive model is the fastest way to burn budget. Here is a practical routing and cascade pattern that sends each request to the cheapest model that can actually handle it.

LLM
Model Routing
8 min

Context Compaction for Long-Running AI Agents

Long-running AI agents fail when context grows without bound, blowing up token costs, latency, and reliability. Here is how anchored summarization and server-side compaction keep agents cheap and coherent.

AI Agents
Context Engineering