Skip to main content

Retrievers

Retrievers are responsible for finding information relevant to a query from a knowledge source. In a Retrieval-Augmented Generation (RAG) system, a retriever receives a query and returns relevant documents, chunks, or records that can then be used as context for an agent or language model. BindAI provides a retrieval layer that supports multiple retrieval strategies, including:
  • Vector retrieval
  • BM25 retrieval
  • Hybrid retrieval
  • Retrieval configuration
  • Search options
  • Metadata filtering
  • Reranking integration
  • Conversational retrieval

Retrieval Architecture

A typical BindAI Knowledge retrieval flow is:
Retrieval is separate from the language model itself. The retriever determines which information is relevant; the model uses that information when generating a response.

Retriever Responsibilities

A retriever generally performs four main tasks:
  1. Receive a query.
  2. Search available knowledge.
  3. Rank or select relevant results.
  4. Return those results to the calling application or agent.
Conceptually:
The exact behavior depends on the configured retrieval strategy.

Vector Retrieval

Vector retrieval uses embeddings to find semantically related content. The general flow is:
The query embedding is compared against vectors associated with stored knowledge. This allows retrieval to identify related information even when the query and source content use different wording. For example:
The two expressions do not use the same words, but they can still be semantically related.

BM25 Retrieval

BM25 is a lexical retrieval strategy based on term matching and relevance scoring. The general flow is:
BM25 is useful when exact terminology is important. For example, a query containing a specific API name, error code, product identifier, or technical term may benefit from lexical matching.

Hybrid Retrieval

Hybrid retrieval combines multiple retrieval signals. BindAI provides hybrid retrieval that can combine lexical and vector-oriented retrieval. A conceptual flow is:
Hybrid retrieval is useful when both exact terminology and semantic similarity matter.

Retrieval Strategy Comparison

There is no universally best strategy. Applications should select the retrieval approach according to the structure of their knowledge and expected query patterns.

Retrieval Results

A retrieval operation normally produces a collection of candidate results. Conceptually:
A result can contain relevant content along with information such as metadata, source information, or a relevance score, depending on the configured retrieval component. Applications should treat retrieved content as evidence or context rather than automatically assuming every result is equally relevant.

Top-K Retrieval

Retrieval systems commonly limit the number of returned results using a result limit or top-K style configuration. For example:
Returning fewer results can reduce unnecessary context. Returning too few can omit useful information. The appropriate limit depends on:
  • Document size
  • Query complexity
  • Retrieval quality
  • Model context capacity
  • Reranking strategy
  • Application requirements
BindAI’s retrieval/search configuration can be used to control retrieval behavior.

Metadata Filtering

Metadata can be used to restrict retrieval results. For example:
A conceptual flow is:
Filtering can be useful for:
  • Tenant isolation
  • Document categories
  • Versions
  • Content types
  • Application-defined scopes
Metadata filtering is a retrieval mechanism and should not be treated as a replacement for application-level authorization.

Search Options

BindAI provides search configuration/options that allow retrieval behavior to be controlled without coupling applications to one specific retrieval strategy. Depending on the configured retrieval implementation, search behavior can include concepts such as:
  • Result limits
  • Retrieval strategy
  • Metadata filtering
  • Similarity-based retrieval
  • Lexical retrieval
  • Hybrid retrieval
  • Reranking
The available options depend on the specific retrieval component being used.

Reranking

Retrieval and reranking solve different problems. The retriever finds candidate results. The reranker can then reorder those candidates.
BindAI provides a reranker abstraction and a lexical reranking implementation. Reranking can be combined with:
  • Vector retrieval
  • BM25 retrieval
  • Hybrid retrieval
This is useful when the initial retrieval stage produces several plausible candidates and additional relevance refinement is desirable.

Lexical Reranking

BindAI includes lexical reranking as a concrete reranking implementation. Lexical reranking uses query and result text to refine the ordering of candidate results. Conceptually:
It is particularly useful when exact words or phrases in the query should influence the final ordering.

Retrieval and Embeddings

Vector retrieval depends on embeddings. The general architecture is:
BindAI provides an embedding abstraction separately from its retrieval layer. This separation allows applications to configure embedding generation independently of retrieval behavior.

Retrieval and Documents

Documents are normally processed before retrieval. A typical Knowledge ingestion flow is:
At query time:
The retriever therefore operates on processed Knowledge rather than necessarily searching raw source documents directly.

Retrieval and Knowledge

Knowledge provides the information being searched. Retrieval provides the mechanism for selecting relevant information. Conceptually:
This separation is one of the main architectural boundaries in BindAI’s Knowledge system.

Retrieval and Agents

Retrieval can be integrated with an agent’s Knowledge configuration. The general execution flow is:
This allows an agent to use external information without requiring the application to manually insert every retrieved document into the model prompt.

Retrieval Context

Retrieved information is useful because it provides context for model generation. For example:
The retrieval layer should therefore prioritize relevance and context quality rather than simply returning the largest possible number of records.

Conversational Retrieval

Retrieval can also be used in conversational applications. A conversational retrieval system can use the current question together with relevant conversation context when constructing the retrieval query. Conceptually:
BindAI provides conversational retrieval components for this use case. Conversational retrieval should remain distinct from conversation Memory. Memory stores application-specific retained information, while Knowledge retrieval searches external/reference information.

Retrieval in Workflows

Retrieval can participate in larger workflows. For example:
Retrieval can therefore be one step within an application workflow rather than being limited to direct agent execution.

Custom Retrieval Systems

Applications may also integrate external search systems when required. Potential external systems include:
  • SQL databases
  • Search engines
  • Vector databases
  • REST APIs
  • Enterprise search systems
  • Graph databases
  • Cloud search services
BindAI’s retrieval abstractions allow applications to keep retrieval responsibilities separate from agent behavior. When integrating an external system, the application’s adapter should convert its results into the format expected by the surrounding Knowledge/retrieval pipeline.

Retrieval Quality

Retrieval quality is influenced by several stages of the Knowledge pipeline.
A retriever cannot compensate completely for poorly prepared source data. When retrieval quality is poor, inspect the entire Knowledge pipeline rather than changing only the retriever.

Choosing a Retrieval Strategy

Use BM25 when:

  • Exact terminology matters.
  • Queries contain identifiers or names.
  • Lexical matching is important.
  • Documents contain specialized vocabulary.

Use vector retrieval when:

  • Queries are naturally expressed in different wording from the source.
  • Semantic similarity is important.
  • The knowledge contains descriptive or conceptual content.

Use hybrid retrieval when:

  • Both exact terms and semantic similarity matter.
  • The knowledge contains technical terminology mixed with natural language.
  • A single retrieval strategy does not provide sufficient coverage.

Retrieval Security

Retrieval systems can expose information from private knowledge sources. Applications should consider:
  • Tenant isolation
  • Access control
  • Metadata filtering
  • Source permissions
  • Data retention
  • Secure storage
  • Query authorization
A user should only receive knowledge that they are authorized to access. Metadata filters can support retrieval boundaries, but they should not be treated as the application’s sole authorization mechanism.

Retrieval Performance

Retrieval performance depends on factors such as:
  • Knowledge size
  • Chunk count
  • Embedding dimensions
  • Vector storage
  • Query complexity
  • Retrieval strategy
  • Filtering
  • Reranking
  • Result limits
Applications should measure retrieval latency separately from model-generation latency. This makes it easier to identify whether performance problems originate in:

Testing Retrievers

Retriever testing should use representative queries and known relevant information. A useful test set can contain:
For example:
Testing retrieval independently from model generation helps determine whether poor answers originate from retrieval or generation.

Retrieval and RAG

Retrieval is a central stage of RAG. A typical BindAI-oriented RAG architecture is:
The retrieval layer determines which external information becomes available to the agent.

Current Retrieval Capabilities

The current BindAI retrieval implementation includes:
  • Retrieval abstractions
  • Vector retrieval
  • BM25 retrieval
  • Hybrid retrieval
  • Search configuration
  • Search options
  • Metadata filtering
  • Reranking abstraction
  • Lexical reranking
  • Conversational retrieval
  • Knowledge integration
  • Agent integration
These components can be combined according to the application’s retrieval requirements.

Relationship to Memory

Retrieval and Memory should not be confused.
Memory providers include implementations such as:
  • In-memory
  • SQLite
  • PostgreSQL
  • Vector memory
  • Pinecone
  • Chroma
Knowledge retrieval uses its own retrieval and Knowledge abstractions. An application can use both systems in the same agent.

Relationship to Tools

Tools perform executable operations. Retrievers search information. For example:
An agent can use tools and retrieval together. A tool may also provide live information that complements static Knowledge.

Best Practices

  • Choose retrieval strategies based on the actual query patterns.
  • Use vector retrieval for semantic similarity.
  • Use BM25 for strong lexical matching.
  • Use hybrid retrieval when both signals are valuable.
  • Keep result limits appropriate to the model context.
  • Preserve useful metadata.
  • Use metadata filtering for retrieval scope.
  • Apply reranking when additional relevance refinement is needed.
  • Test retrieval independently from generation.
  • Use representative queries when evaluating retrieval quality.
  • Monitor retrieval latency separately from model latency.
  • Keep tenant and authorization boundaries explicit.
  • Treat retrieved content as potentially untrusted external data.
  • Re-evaluate retrieval after major changes to chunking or embeddings.
  • Keep retrieval configuration separate from model-provider configuration.

Summary

Retrievers are the search layer of BindAI Knowledge. The current retrieval architecture supports multiple strategies:
BindAI provides vector, BM25, and hybrid retrieval together with search configuration, metadata filtering, reranking, conversational retrieval, and Knowledge/agent integration. Retrieval is therefore a concrete part of the current BindAI Knowledge architecture rather than a future-only feature.