Tie-breaking when graph and vector disagree
Hybrid retrieval looks magical until the two retrievers return conflicting facts. The graph says Acme is owned by Globex. A vector chunk says Acme is owned by Initech. The synthesis LLM will pick one and sound confident. The fix is a deliberate tie-breaking rule baked into the prompt.
Conflict resolution flow
Default to the graph for structured facts. Default to vector for narrative context.
graph_rag.py
python
SYNTHESIS_TEMPLATE = """
You are answering: {question}
Graph evidence:
{graph_context}
Vector evidence:
{vector_context}
Rules:
- For structured facts (ownership, employment, dates), prefer the graph.
- For descriptions or quotes, prefer the vector context.
- If they disagree, surface both and tag the source: [graph] or [vector].
- Never silently pick one without saying so.
"""Add the tie-breaking rule as part of the synthesis prompt template. This is the entire fix.
Quiz: Quiz
Loading practice…