The gap between a working prototype and a production pipeline
Intent extraction is not optional
The latency problem is almost always in the wrong place
- Intent extraction (Gemini Flash): ~80ms
- Embedding the query (e5-base-v2): ~120ms
- pgvector retrieval: ~340ms
- LLM response generation: ~600ms (streaming, so perceived latency was lower)
Redis saved me, but not how I expected
Streaming makes latency feel irrelevant
Observability is the real infrastructure
- The raw query
- The extracted intent (structured filters)
- Which products were retrieved and their similarity scores
- The latency of each step
- Whether the user engaged with the result
RAG in production is not a hard engineering problem. It's a systems problem of latency, caching, observability, and feedback loops, wrapped around what looks like a simple search feature.
The three weeks went into caching, an index tuned for the actual query pattern, and logging that told me which fix was working and which wasn't. None of that shows up in a 60-line notebook version, and all of it turned out to be the actual job.