All nodes/AI/RAG

Rerank

Re-ranks a list of chunks by relevance to the query via a cross-encoder reranker. Universal: composes with RAG Query, RRF Fusion, or any chunk source.

Rerank
ChunksContext
Query
Reranker

Type in the graph: rerank

Exec

An error branch can be enabled (expose_error_output) to handle failures on their own path.

Ports can be split into separate execution and data handles.

Try it

Minimal working workflow

Entry
Rerank
Reranker
Exit
  • Execute + Data
  • Reranker
Press “Copy nodes”, open the editor and hit Ctrl+V on the canvas.

Runs as pasted

When to use it

Vector search ranks by embedding proximity and stops there. A reranker is a cross-encoder: it reads the query and each document together and scores the match far more precisely, at the price of a separate call. Hence the working pair: raise Top K on RAG Query to 15–20 and set Top N here to 5 — the model then gets a short and noticeably cleaner context.

The node is easy to confuse with RRF Fusion: that one merges several lists by position and without a model, this one re-scores one list with a model. They compose: fuse the branches first, then rerank the result.

How it works

The Chunks port carries both the trigger and the candidates. It accepts the whole output of RAG Query or RRF Fusion, a bare list of chunks, and even a single chunk; anything that does not look like chunks turns into an empty list.

The query comes from the Query port or from the Query field. The model and Top N arrive through the Reranker port from a Reranker node and override the fields in the form.

The output has the same shape as RAG Query: context (the joined texts, or the serialised array with the json format), chunks and query. The score of each chunk is replaced by the reranker’s score, and Flow applies the sort and the Top N cut itself, after the provider replies — vendors name that parameter differently, and a self-hosted reranker may have no cap at all.

Billing is by tokens, and the cross-encoder reads the query together with every candidate. The cost therefore grows with how many chunks you sent, not with how many you kept.

Common mistakes

  • An empty query. That is an error, not a silent pass-through: ranking by nothing is not ranking. The default template {{ inputs.query }} reads the Query port; if nothing is connected there, supply the query explicitly, e.g. {{ nodes.<id>.output.query }} from the retrieval node above.
  • An empty candidate list. The opposite: not an error. Retrieval found nothing, the node returns an empty context and leaves a warning in the run log.
  • Expecting the node to find documents. It only reorders what arrived: how many candidates to fetch is Top K on the retrieval node.
  • Looking for the model in the LLM list. Rerankers are a separate catalog; only they, and the models of your connections whose purpose is Rerank, appear here.

Inputs

PortWirePayloadNotes
ChunkschunksExecute + Dataexecute_data

Candidate chunks to reorder (rag_query / rrf_fusion output)

QueryqueryDatadata

Relevance criterion; replaces the Query template when connected

Rerankerrerank_configRerankerlink_rerank

Reranker node config; its model and top_n override the fields here

Outputs

PortWirePayloadNotes
ContextoutputExecute + Dataexecute_dataobject

Configuration

FieldTypeDefaultDescription
Queryquery_templatestring{{inputs.query}}

Query used for relevance scoring. Supports {{inputs.query}}.

supports templates

Rerank Modelmodelstring""

Cross-encoder model used for scoring. A connected Reranker config node supplies this value and wins over the field.

overridden by port: rerank_config

Top Ntop_ninteger5

Number of top results to keep after reranking. A connected Reranker config node supplies this value and wins over the field.

overridden by port: rerank_config

Output Formatformatstringtext

text: concatenated chunks separated by ---. json: array with metadata.

Options: text — Text, json — JSON

Shared fields

Every node has these three — the platform adds them, not the node author.

  • expose_error_output — When enabled, show an execution output to connect nodes that run if this step fails.
  • split_ports_in — Show separate execution and data input handles instead of one combined port.
  • split_ports_out — Show separate execution and data output handles instead of one combined port.