AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

QdrantVectorStore.As_retriever(Search_type='Mmr') Inverts Lambda_mult Semantics

The QdrantVectorStore MMR retriever passes LangChain's lambda_mult as Qdrant's diversity parameter, but Qdrant interprets diversity as 1 - lambda, resulting in inverted behavior: lambda_mult=0.0 maximizes relevance instead of diversity.

highConfidence 95%Langchain_qdrantChat ModelsChainslangchain-coreAffected V1.1.0

Origin Analysis

In langchain_qdrant/qdrant.py, the _search_mmr method constructs models.Mmr(diversity=lambda_mult, candidates_limit=fetch_k). However, Qdrant's Mmr model defines diversity as 1 - lambda, where lambda controls the trade-off between relevance and diversity. Since LangChain's lambda_mult is the direct trade-off parameter, passing it as diversity reverses the effect.
Use the provided Python script in the issue: create Qdrant collection, add documents, call vector_store.as_retriever(search_type='mmr', search_kwargs={'k':3, 'fetch_k': len(docs), 'lambda_mult': 0.0}), invoke query 'What is LangChain?'. Observe that output documents are highly relevant (low diversity), while manual MMR with lambda_mult=0.0 selects diverse documents. This indicates inversion.

Fixing Code Block

Edge Case Audit

Applying this patch changes retrieval semantics; users who previously tuned lambda_mult based on observed inverted behavior will see changed results. Re-evaluate hyperparameters after upgrade. Ensure all code paths using MMR with Qdrant are tested. No concurrency or threading issues anticipated. Rollback by reverting this patch.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state