[Feature Request]: Reranker support for LightRAG knowledge bases (and stop the per-query "no rerank model is configured" warning)
Do you need to file a feature request?
- [x] I have searched the existing feature request and this feature request is not already filed.
- [x] I believe this is a legitimate feature request, not just a question or bug.
Feature Request Description
LightRAG knowledge bases cannot use a reranker, and every query logs a warning about it.
The native LightRAG pipeline never passes a rerank function to the SDK, and no setting exposes one:
-
build_ragindeeptutor/services/rag/pipelines/lightrag/engine.pybuilds the constructor kwargs withoutrerank_model_func. The only reference to it in the pipeline is the read in_managed_queue_funcs, used for queue shutdown. -
query_with_sourcesbuildsQueryParamfrommode,stream,include_references,top_kandresponse_type. It does not setenable_rerank. -
LightRAG 1.5.7 defaults
enable_rerankto true (RERANK_BY_DEFAULT), so each query reaches the rerank step with no model and logs:WARNING: Rerank is enabled but no rerank model is configured. Please set up a rerank model or set enable_rerank=False in query parameters.
Checked on v1.7.2 and on dev at 60fb3bd.
Requested:
- Let a LightRAG knowledge base use a reranker, configured alongside the existing LightRAG role models (extract / keyword / query / vlm).
- When no reranker is configured, pass
enable_rerank=Falseso the query does not warn on every call.
Item 2 is small and independent of item 1.
Related Module
Knowledge Base Management
Use Case
Reranking exists for LlamaIndex knowledge bases (reranker_model, rerank_top_k, added for #304 in #1045) but not for LightRAG ones, so the two providers differ in retrieval quality controls for no visible reason.
The LightRAG README states that enabling rerank at query time "can significantly improve query quality" and recommends BAAI/bge-reranker-v2-m3 for local deployment. In hybrid mode the pipeline currently truncates the merged candidate chunks without scoring them against the query. Example from one query on a 6-document KB:
Round-robin merged chunks: 38 -> 38 (deduplicated 0)
WARNING: Rerank is enabled but no rerank model is configured. ...
Final context: 87 entities, 118 relations, 16 chunks
The effect grows with KB size, since more candidates are dropped unranked.
Additional Context
- DeepTutor 1.7.2,
lightrag-hku1.5.7, KB providerlightrag, query modehybrid. - I did not measure retrieval quality with and without a reranker; the request rests on the missing wiring and the upstream LightRAG guidance, not on a benchmark.
- No existing issue or PR covers this. #304 / #1045 predate the native LightRAG pipeline (#1069) and apply to the LlamaIndex pipeline only.
I'll take item 2 (the small, independent slice): stop the per-query warning when no reranker is configured. Item 1 (wiring a rerank model alongside the existing LightRAG role models) is a larger feature — I'll leave it as a follow-up.
Confirmed on dev at 60fb3bd: query_with_sources builds QueryParam without enable_rerank, and LightRAG 1.5.7 defaults it to true (RERANK_BY_DEFAULT), so every query reaches the rerank step with no model and logs the warning. The fix gates enable_rerank on whether the RAG instance actually has a callable rerank_model_func — the default deployment stops warning, and anyone who later wires a reranker (item 1) still gets reranking. PR incoming.