Surface rerankers and modernize Hugging Face integration pages#3673
Open
Tom Aarsen (tomaarsen) wants to merge 2 commits intolangchain-ai:mainfrom
Open
Surface rerankers and modernize Hugging Face integration pages#3673Tom Aarsen (tomaarsen) wants to merge 2 commits intolangchain-ai:mainfrom
Tom Aarsen (tomaarsen) wants to merge 2 commits intolangchain-ai:mainfrom
Conversation
Contributor
|
Thanks for opening a docs PR, Tom Aarsen (@tomaarsen)! When it's ready for review, please add the relevant reviewers:
|
There was a problem hiding this comment.
I'm glad to leave these changes be, but I get lots of questions about choosing embedding models personally, so I think this kind of page can be very helpful.
There was a problem hiding this comment.
The crux of the PR: showing rerankers more prominently, they're very strong, but a bit underutilized/underdocumented right now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
langchain_communityimports and stale 2023-era model defaultsHuggingFaceEmbeddingsto the Python "Top integrations" table, add a new shared reranker-tabs snippet, and add a brand-newdocument_transformers/index.mdxwith a reranker comparison table (previously that entire directory had no index page and was completely absent from the sidebar navigation)Type of change
Type: New and updated documentation page
Related issues/PRs
N/A
Checklist
docs devsrc/docs.jsonif neededI couldn't run
make broken-linkslocally, but did runmake lint_prose.Additional notes
I'm the maintainer of Sentence Transformers, and I'm pitching this PR with two main goals.
The first is to highlight rerankers more across the docs. The flagship RAG tutorial never mentioned them, even though reranking is probably the cheapest retrieval-quality win available on top of vector search. The entire
document_transformers/directory had no index page and was completely absent from the sidebar navigation, so pages likecross_encoder_reranker.mdxwere only reachable via direct URL or cross-link. Andcross_encoder_reranker.mdxitself was using a 2023-era model default.The second is to update the Sentence Transformers / Hugging Face integration pages. Several still imported from deprecated
langchain_communitypaths (includingHuggingFaceInferenceAPIEmbeddings, which has been explicitly deprecated sincelangchain-community==0.2.2), the default model IDs were a couple of years stale, and the mainsentence_transformers.mdxpage opened with a red "experienced users only" warning that the currentpip install langchain-huggingfacehas made obsolete.For context: the prose and code changes here were drafted with AI assistance and then critically edited by me before opening the PR. Every claim about the current state of the code, every recommended model, and every cross-link was checked against the repo and against the live PyPI packages (
langchain-huggingface,langchain-community,langchain-classic), and the model recommendations are based on my own experience with the Sentence Transformers ecosystem and MTEB (e.g. the newly released lightonai/DenseOn model).Concrete changes:
src/oss/python/integrations/document_transformers/index.mdxwith a reranker comparison table (HuggingFace first, with a "local" column), plus a content-transformation section and a card grid of all 21 pages. Registered in the "Integrations by component" sidebar group.rag.mdx, backed by a newreranker-tabs-py.mdxsnippet covering HuggingFace (local, no API key), Cohere, Jina, Voyage AI, and FlashRank.cross_encoder_reranker.mdx: default bumped toBAAI/bge-reranker-v2-m3, plus a model-selection table coveringmixedbread-ai/mxbai-rerank-large-v2,Alibaba-NLP/gte-multilingual-reranker-base,Qwen/Qwen3-Reranker-0.6B, and the classiccross-encoder/ms-marco-*family.sentence_transformers.mdx: warning removed; now covers device/throughput (with ST's auto-selection noted), normalization, batch sizes, query/document prompts for instruction-aware models, and Text Embeddings Inference for production.bge_huggingface.mdxrestructured by model generation:BAAI/bge-m3viaHuggingFaceEmbeddingsas the recommended path,bge-*-en-v1.5viaHuggingFaceBgeEmbeddingsas a zero-config alternative. Also caught that the legacy class defaults to"Represent this question..."while the v1.5 model card actually recommends"Represent this sentence..."; the generic-class example uses the model-card wording.providers/huggingface.mdx,instruct_embeddings.mdx, andhuggingfacehub.mdx, with short deprecation notes (including the explicitHuggingFaceInferenceAPIEmbeddingsdeprecation).choosing-embeddings.mdx: provider-neutral conceptual guide covering deployment patterns, MTEB, cost/latency/dimensionality/context-length trade-offs, multilingual support, prompts, licensing, and rerankers / hybrid / late-interaction (includinglightonai/DenseOn).HuggingFaceEmbeddingsto the Pythonembeddings/index.mdx"Top integrations" table; bumpedinfinity_rerank.mdxandvolcengine_rerank.mdxembedding examples fromall-MiniLM-L6-v2toBAAI/bge-m3.I also ran the dev server and browsed each changed page end-to-end before opening this. Happy to pare back or split if you'd prefer. Let me know. I think it'll be nice to display the rerankers a tad more prominently in the docs via this.