Repository navigation
feat(reranker): default to a small multilingual cross-encoder, keep bge-reranker-v2-m3 selectable - #23
Merged
Conversation
…ge-reranker-v2-m3 selectable The model-init image now uses a model's own onnx/model.onnx when the repository ships one and only exports to ONNX otherwise. The chart default moves to cross-encoder/mmarco-mMiniLMv2-L12-H384-v1 (about 10x faster on CPU); BAAI/bge-reranker-v2-m3 stays available via the init image tag. README gets the measured trade-off, the ADR gets an addendum correcting its latency figure. Closes #22
Contributor
Author
|
Follow-up measurement in a Kubernetes pod (4 CPU limit, same TEI cpu-1.9.4 image and arguments, 800-character documents, through a port-forward, 3 runs each for the small model, 1 run for the current default):
That is about 0.05 s per pair against about 0.55 s per pair, so roughly 11x. A sanity probe with 3 German and 3 English queries (one relevant document among 20) ranked the relevant document first every time. German scores were noticeably lower than English, so consumers should rank by order and not rely on absolute score thresholds. 20 documents fit a 1.5 s budget only narrowly; 10 to 15 documents leave comfortable headroom. |
…assage count and length trade-off
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.
Closes #22
What
tei-reranker-model-initnow takes the model's ownonnx/model.onnxwhen the repository ships one (copying only the files TEI needs) and runs the Optimum export only otherwise.MODEL_REVISIONcan pin the model revision. While testing I found that the repeated--excludeflags in the oldhf downloadcall replaced each other, so every excluded file was downloaded anyway; the patterns are now passed to a single--exclude. For the new default the resulting init image holds about 0.5 GB instead of about 1.5 GB.cross-encoder/mmarco-mMiniLMv2-L12-H384-v1(tagmmarco-mminilmv2-l12-h384-v1-2026.10). New valuereranker.modelNameis shown inNOTES.txt.BAAI/bge-reranker-v2-m3stays selectable by setting the init image tag andmodelName.release-models.ymlbuilds both init images (matrix); only the default also gets:latest.--max-client-batch-size 32added next to--max-batch-tokens 2048. The BGE model needs 4Gi/8Gi, noted in the values.make docker/tei-reranker-model-init RERANKER_MODEL_ID=...selects the model locally.Verified
helm lintandhelm templaterender with the default and with the bge-reranker-v2-m3 tag/modelNameoverride.onnx/model.onnxplus config and tokenizer files. Ran it against an empty volume, started TEIcpu-1.9.4(4 CPUs,--max-batch-tokens 2048, offline) on that volume and POSTed/rerankwith three German/English texts: HTTP 200, relevant text ranked first (0.997), irrelevant last (0.0002), about 0.07 to 0.15 s.go test -race ./...andgolangci-lint run ./...pass (no Go code changed).Not verified / notes for the reviewer
release-models.ymlhas run on this change (the tag carries the build month, as before), so merge, run the workflow, and check the tag before relying on a chart release.tei-reranker-model-init:latestnow points at the small model.--ignore-existing, so switching models on an existing release needs the old reranker model PVC deleted (documented in the README).