Aller au contenu principal

Rerank

Category: RAG
Node id: rerank

Reranks retrieved results using cross-encoder, BM25, semantic, or hybrid methods

What it does​

  • Cross-encoder reranking for high-accuracy relevance scoring
  • BM25 term-frequency-based reranking
  • Semantic similarity reranking
  • Hybrid reranking combining multiple methods
  • Original rank tracking and comparison
  • Configurable top-K result limiting

Use cases​

  • Improving RAG retrieval quality by reranking initial results
  • Combining dense and sparse retrieval signals for hybrid search
  • Filtering and reordering search results by query relevance

Runtime​

  • Performance tier: fast

Input ports​

NameTypeRequiredDescription
querytextYesQuery text for reranking relevance
resultsjsonYesArray of results to rerank

Output ports​

NameTypeRequiredDescription
resultjsonNoMain result containing reranked results array, count, method, and total_reranked
successbooleanNoWhether the operation succeeded

Settings​

Basic​

SettingNameTypeRequiredDefaultAllowed valuesDescription
MethodmethodenumNocross-encodercross-encoder, bm25, semantic, hybridReranking method
Top Ktop_knumberNo10min 0; max 100Maximum results to return after reranking

Errors​

CodeDescription
QUERY_REQUIREDNo query text was provided for reranking
RESULTS_REQUIREDNo results array was provided to rerank
INVALID_METHODMethod must be cross-encoder, bm25, semantic, or hybrid
RERANKING_FAILEDReranking process encountered an error

Runtime notes​

  • Each result object includes both the original score and the new rerank_score for comparison
  • Results are sorted by rerank_score descending; new_rank is 1-indexed
  • top_k=0 disables limiting and returns all reranked results
  • Wire the results input from a retrieve node's result.results array

See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.

Quelque chose n'est pas clair ? Envoyez vos commentaires sur la documentation par courriel.