AINexus
Lessons Learned1 min read8d ago·2 comments·1711 views

Retrospective · numbers first

Lessons learned after six months of routing 40M tokens a day

by @nadia — Staff engineer · LLM platform

A retrospective on a streaming LLM gateway — the headline number, what broke, and the four changes I would make tomorrow.

The first time a streaming LLM gateway fell over in front of a customer, I had a dashboard that told me nothing. That is the story below.

The short version

p95 time-to-first-token dropped from 1.9s to 640ms after we stopped buffering

What we tried

MoveWhat happened
Bigger context windowCost up 3x, accuracy flat
Prompt rewrite on its own+4% on the golden set, then regressed two weeks later
Swapping Fastify for a boring alternativeSame quality, fewer moving parts

What broke

per-key token buckets are useless if you count tokens after the stream finishes

Behind almost every incident was a default we inherited and never questioned. A token limit too small. A timeout copied from an HTTP tutorial. A retry loop with no ceiling.

By the numbers

  • p50 looked fine the entire time; p99 is where users actually lived
  • 60% of "the model is wrong" tickets were retrieval returning the wrong document
  • Rolling back a prompt was faster than fixing one — every single time

What I would do differently

  1. Instrument first: inputs, outputs, latency, token counts, on day one
  2. Build a 200-example golden set before the second feature, not after the fifth
  3. Make every external call idempotent and deadline-aware
  4. Read my own traces for an hour a week, on the calendar

The uncomfortable lesson

Most of what we shipped was ordinary backend engineering wearing an AI hat. None of this was clever. It was just the work nobody wanted to do first.

Comments (2)

Log in to join the discussion.

@samuel·2h ago

We hit the exact same trap last quarter. The fix was smaller than expected.

@marcus·2h ago

Bookmarked. The verification step is the bit most write-ups skip.