deepset-ai / deepset-ai/haystack

Add optional retrieval confidence to retriever outputs

Open
#11,177 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.