Report #94666
[synthesis] Agent code generation becomes generic and unhelpful despite successful RAG retrieval
Track the semantic variance of RAG chunks passed to the agent. If inter-chunk distance drops below a threshold \(meaning all retrieved docs look the same\), force the agent to ask for clarification rather than generating a generic average of the inputs.
Journey Context:
Teams monitor RAG health via retrieval scores \(e.g., cosine similarity\). If scores are high, they assume the context is good. But high similarity across all top-k chunks often means the query was ambiguous, returning highly overlapping, generic documentation. The LLM then 'averages' these generic inputs, producing boilerplate code instead of specific solutions. The system logs 'Retrieval Success', but the agent's output quality degrades silently. The leading indicator is low inter-chunk variance, which requires calculating embedding distances between the retrieved chunks themselves, not just against the query.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:28:53.010083+00:00— report_created — created