Studio: default multimodal RAG embedder to BAAI/BGE-VL-large (Qwen3-VL kept as alt)

This commit is contained in:
Roland Tannous 2026-05-27 00:11:40 +04:00
commit bdbf47a341
3 changed files with 20 additions and 8 deletions

View file

@ -15,9 +15,10 @@ git+https://github.com/meta-pytorch/OpenEnv.git
# executorch>=1.0.1 # 41.5 MB - no imports in unsloth/zoo/studio
torch-c-dlpack-ext
# Bumped from 5.2.0 to expose the `sentence_transformers.base.modules`
# package that Qwen3-VL-Embedding-2B (the multimodal RAG embedder)
# references in its modules.json. Upper bound left at <7 to avoid
# accidental jumps across a future major rewrite.
# package that Qwen3-VL-Embedding-2B references in its modules.json
# (still supported as an alternative multimodal RAG embedder; the
# current default is BAAI/BGE-VL-large via our in-process adapter).
# Upper bound at <7 to avoid jumps across a future major rewrite.
sentence_transformers>=5.3.0,<7
transformers==4.57.6
pytorch_tokenizers

View file

@ -441,10 +441,9 @@ def warmup_rag_embedder(
) -> dict:
"""Preload the configured default embedder so the first retrieval is warm.
Called from the frontend when the user enables the RAG pill moves the
cold-load latency (Qwen3-VL-Embedding-2B is ~4 GB) out of the first
chat-completion path, where a 30s+ load can race the llama-server
prefill timeout.
Called from the frontend when the user enables the RAG pill moves
the cold-load latency out of the first chat-completion path, where a
multi-second load can race the llama-server prefill timeout.
"""
from utils.rag.config import resolve_embedder

View file

@ -33,10 +33,22 @@ RAG_EMBEDDING_MODEL: str = (
# Default embedder per (mode, chunking). (multimodal, late) is unsupported
# and rejected at KB-create time in routes/rag.py.
#
# Multimodal default is BAAI/BGE-VL-large (~400 M params, 768-d, ~800 MB
# bf16) — small, fast, shared text/image space. Loaded via the
# `_BGEVLAdapter` in core/rag/embeddings.py which bypasses BGE-VL's
# fragile sentence-transformers shim and pre-truncates text to CLIP's
# 77-token cap.
#
# To switch back to Qwen3-VL-Embedding-2B (2 B params, 2048-d, no CLIP
# text cap; ~4 GB bf16 / ~1.5 GB 4-bit via FastSentenceTransformer),
# change the ("multimodal", "standard") entry below — the in-process
# loader supports both via `model_name.startswith("BAAI/BGE-VL")`
# routing.
RAG_EMBEDDER_MATRIX: dict[tuple[str, str], str] = {
("text", "standard"): "BAAI/bge-small-en-v1.5",
("text", "late"): "nomic-ai/nomic-embed-text-v1.5",
("multimodal", "standard"): "Qwen/Qwen3-VL-Embedding-2B",
("multimodal", "standard"): "BAAI/BGE-VL-large",
}