deepset-ai / deepset-ai/haystack
Add optional retrieval confidence to retriever outputs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 26.6k
- Forks
- 3.2k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 194
Description
Context
Opening this issue to continue the discussion from PR #11130, based on maintainer feedback to discuss the approach before implementation.
Problem
Currently, retrievers return documents with scores, but there is no standardized way to expose a retrieval confidence signal that downstream components (e.g., RAG pipelines, evaluators) can use.
Proposal
Introduce an optional "retrieval_confidence" metadata field in retriever outputs.
For example:
- Normalize scores to a [0, 1] range
- Attach confidence to each "Document.meta"
doc.meta["retrieval_confidence"] = normalized_score
This would:
- Provide a consistent confidence signal across retrievers
- Help downstream components make better decisions (filtering, ranking, fallback logic)
- Improve explainability in RAG systems
Questions
- Should this be handled at the retriever level or pipeline level?
- Is adding it to "Document.meta" the preferred approach?
- Should this be optional/configurable?
Happy to implement this once the approach is aligned.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the discussion from PR #11130 and the maintainer feedback that prompted this issue. Resolve whether confidence belongs at the retriever or pipeline level, whether Document.meta is appropriate, and how normalization and configurability should work. Done means the approach is agreed before implementation begins.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100