Skip to content

fix: stabilize Jina v5 and Qwen3 reranker deployment - #5232

Merged
qinxuye merged 3 commits into
xorbitsai:mainfrom
OliverBryant:fix/jina-embeddings-v5-text-small
Jul 28, 2026
Merged

fix: stabilize Jina v5 and Qwen3 reranker deployment#5232
qinxuye merged 3 commits into
xorbitsai:mainfrom
OliverBryant:fix/jina-embeddings-v5-text-small

Conversation

@OliverBryant

@OliverBryant OliverBryant commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • require sentence-transformers>=5.2.0 for the Jina embeddings v5 family, matching its pinned Transformers 5 runtime
  • keep inherited NumPy ABI packages aligned when sentence-transformers runs in a --system-site-packages virtual environment
  • replace broken Qwen3-Reranker GGUF conversions with llama.cpp-compatible, revision-pinned models
  • remove unsupported/broken Qwen3 GGUF quantizations and handle the repositories' distinct Q8 filename convention
  • add regression coverage for dependency selection, ABI pin generation, and Qwen3 GGUF source resolution

Root cause

The Jina v5 virtualenv spec pinned transformers==5.7.0 but left
sentence_transformers unconstrained. Package mirrors could therefore resolve
sentence-transformers 5.1.x, which requires transformers<5, and fail during
the uv dry-run.

Even when dependency resolution succeeded, uv could upgrade only part of the
scientific Python stack inside the child virtualenv while inheriting compiled
packages from the parent environment. Mixing NumPy, SciPy, scikit-learn, and
pandas across incompatible ABIs caused import-time failures.

The Qwen3-Reranker GGUF specs referenced community conversions that omitted the
reranker classifier tensor and metadata required by llama.cpp. Those files
could load and return HTTP 200 while producing near-zero, incorrectly ordered
scores. The replacement conversions include the classifier tensor, rank
pooling metadata, output labels, and rerank chat template.

Validation

  • pre-commit run --files passed for all modified files
  • 30 focused core and embedding tests passed
  • 8 focused Qwen3/llama.cpp rerank tests passed
  • dependency dry-run succeeded against the Tsinghua PyPI mirror
  • deployed jina-embeddings-v5-text-small through a real Xinference REST
    server on an RTX 3090 Ti, using ModelScope and virtualenv mode
  • /v1/embeddings returned HTTP 200 for three inputs with 1024-dimensional
    normalized embeddings; terminate/relaunch against the reused virtualenv also passed
  • deployed Qwen3-Reranker-0.6B with the sentence-transformers engine on the
    RTX 3090 Ti; English and Chinese /v1/rerank requests returned HTTP 200 and
    correct ordering before and after relaunch
  • reproduced the broken GGUF source returning incorrect near-zero scores, then
    deployed the replacement Q4_K_M GGUF with xllamacpp on the same GPU
  • replacement GGUF returned HTTP 200 with correct English and Chinese ordering;
    the relevant English document scored 0.999512 versus 0.000395 for the
    irrelevant document

Deployment note

On the GPU test host, the xllamacpp CUDA package index was reachable but its
GitHub Release asset timed out. Supplying the identical official wheel locally
allowed the GGUF runtime test to complete; this is a host egress limitation,
not a package-resolution or model-loading failure.

@XprobeBot XprobeBot added the bug Something isn't working label Jul 23, 2026
@XprobeBot XprobeBot added this to the v3.x milestone Jul 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to keep the inherited sentence-transformers scientific stack ABI-compatible in virtual environments by pinning packages like numpy, scipy, scikit-learn, and pandas to their parent environment versions. It also updates the sentence-transformers dependency to version 5.2.0 or higher for Jina v5 embedding models and adds corresponding tests. The review feedback suggests improving the robustness of the newly added test by dynamically identifying model families that require specific transformers versions instead of hardcoding model names.

Comment thread xinference/model/embedding/tests/test_embedding_models.py Outdated
@OliverBryant
OliverBryant marked this pull request as ready for review July 24, 2026 02:21
@OliverBryant OliverBryant changed the title fix: stabilize Jina v5 sentence-transformers deployment fix: stabilize Jina v5 and Qwen3 reranker deployment Jul 24, 2026
@XprobeBot XprobeBot added the gpu label Jul 24, 2026

@OliverBryant OliverBryant left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Reviewed the full diff, ran the new tests locally (3 ABI-pin + 1 Jina-v5 + rerank param tests all pass), and verified the replacement GGUF repos against the live HF/ModelScope APIs. Overall this is a solid, well-tested fix. Notes below.

Verified correct

  • pin_sentence_transformers_numpy_abi — engine name is exactly "sentence_transformers" (rerank/core.py:246, embedding/core.py:442), and the function lowercases before comparing, so casing is safe. Call ordering in _prepare_virtual_env is expand_placeholders → filter_by_markers → ensure_system_torch_pin → pin_sentence_transformers_numpy_abi, so by the time it runs the #sentence_transformers_dependencies# marker is fully expanded; any explicit numpy/scipy/sklearn/pandas is caught by explicitly_requested and won't be double-pinned. canonicalize_name correctly handles underscore/hyphen spellings. Pinning to parent versions under --system-site-packages is the right ABI-alignment behavior.
  • Q8 filename split — the two-spec-entry approach maps to real files: HF repo has Qwen3-Reranker-0.6B-Q4_K_M.gguf (dash) for most quants and Qwen3-Reranker-0.6B.Q8_0.gguf (dot) for Q8_0. match_rerank flattens per-quant, so requesting Q8_0 resolves to the dot-template spec and everything else to the dash-template spec. Confirmed against the live HF tree.
  • sentence_transformers>=5.2.0 correctly matches the transformers==5.7.0 runtime (ST 5.1.x requires transformers<5, which was the root-cause conflict).

Worth noting (non-blocking)

  1. ModelScope coverage dropped for Qwen3 rerankers. The change removes the modelscope src entirely for all three GGUF reranker families. I confirmed Voodisss/Qwen3-Reranker-*-GGUF-llama_cpp returns 404 on the ModelScope API and 200 on HF — so there is no ModelScope mirror to point at, making this unavoidable with these repos. But CN users (a large part of the audience) who relied on the ModelScope GGUF path will now be forced onto HuggingFace, which is frequently slow/blocked there. Consider (a) mirroring these GGUFs to a ModelScope org, or (b) at minimum calling this out in the PR description / release notes so CN users aren't surprised. The non-GGUF (pytorch) reranker specs still have ModelScope, so this only affects the GGUF path.

  2. Minor: the HF repos also ship an F16 GGUF that isn't exposed as a quantization option. Not required, just noting it's available if you want full coverage.

Nothing here blocks merge. Item 1 is the only thing I'd want a conscious decision on.

@qinxuye qinxuye left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qinxuye
qinxuye merged commit 608deb2 into xorbitsai:main Jul 28, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gpu

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants