Embeddings and a reranker on trogdor's second RTX 5000
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Chris Moriarty 7cb7f7040c Now part of cmoriarty/trogdor-services; kept as history
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-30 12:28:20 -05:00
docker-compose.yml Start beside other programs on the card: vLLM's start-up check wanted 92% of the card free 2026-11-30 09:18:42 -05:00
README.md Now part of cmoriarty/trogdor-services; kept as history 2026-11-30 12:28:20 -05:00

Search by meaning on trogdor

Since 2026-11-30 this service runs from cmoriarty/trogdor-services, one stack for everything on trogdor's two RTX 5000s. This repo's Portainer stack is removed. The repo is kept for the measurements below and the reason behind each setting; its compose file is no longer deployed.

An embedding model and a reranker on the second Quadro RTX 5000, as a Portainer git stack, search (trogdor, endpoint 39, stack 155). Both run on vLLM, with the image patched for these cards.

Service Model Address Request
Embeddings Qwen3-Embedding-0.6B, 1,024 dimensions http://trogdor:8092/v1 POST /v1/embeddings, model qwen3-embedding-0.6b
Reranker Qwen3-Reranker-0.6B http://trogdor:8093/v1/rerank POST /v1/rerank, model qwen3-reranker-0.6b

An embedding model turns text into a list of numbers so that texts with a similar meaning sit close together; documents are embedded once and a question is matched against them. A reranker then reads the question with each of the best candidates and sorts them more carefully.

Checked on 2026-11-29

  • Both services start and answer. Each takes about 3.6 GB of the card (7.3 GB together), with a 1.5 GiB working cache and texts of up to 8,192 tokens.
  • Embeddings: 64 passages of about 300 tokens in 0.52 s. Given six unrelated sentences and the question "How do I change which model is loaded?", the nearest was the sentence about stopping and starting stacks in Portainer (0.62, the next 0.48).
  • Reranker: 32 passages in 0.26 s; the same sentence came top (0.88). Its replies have results with relevance_score, the shape Open WebUI expects.

The reranker's prompt template (2026-11-30)

The reranker is started with --chat-template pointing at Qwen's own template, which ships in the vLLM image. Without it the scores were of little use. Eight sentences were scored against "How do I change which model is loaded?". One answers it; the rest only share words with it or are unrelated.

Right sentence Best wrong sentence Unrelated sentence ("Whisper turns speech into text.")
Without the template 0.88 0.82 0.78
With the template 0.98 0.16 0.00

Speed is the same: 32 passages in 0.28 s.

Open WebUI

Connected on 2026-11-30, with the owner's yes. Open WebUI (0.13.3, on trogdor) keeps these settings in its database, shown in Admin Settings, Documents. No Open WebUI login for agents exists, so the rows of its config table were changed directly and the container restarted (healthy after 35 s).

Setting Before Now
Embedding engine built in (all-MiniLM-L6-v2, on the CPU) OpenAI, http://host.docker.internal:8092/v1, model qwen3-embedding-0.6b
Embedding batch size 1 32
Reranking engine none External, http://host.docker.internal:8093/v1/rerank, model qwen3-reranker-0.6b
Hybrid Search off on (without it the reranker is not used)
Top K 3 20 candidates, of which the reranker keeps 5

Both API key fields hold the placeholder none; the services ask for no key.

  • Checked that day: the rows read back after the restart, and Open WebUI's own code, run inside its container, got 1,024-number vectors from the embedding service and scores of 0.98 and 0.00 from the reranker. A document upload through the web page was not tried.
  • There were no knowledge bases, so nothing needed reindexing. Files attached to chats before the change were indexed with the old model (384 numbers a vector): to search one again, attach it again.
  • To undo: set the "Before" values in Admin Settings, Documents, and save. A copy of the whole database from just before the change is webui.db.bak-2026-11-30-before-search in the volume open-webui-data.
  • Open WebUI now depends on this stack, so both services have restart: unless-stopped.

Trimmed on 2026-11-30

To leave the card room for voice and images, each service now takes texts of up to 4,096 tokens (it was 8,192) with a 0.75 GiB working cache (it was 1.5). Together they hold 5.7 GB of the card, down from 7.3. Open WebUI sends pieces of about 250 tokens, so nothing it sends is affected. Speed and scores were the same afterwards.

Things that did not work

  • Giving each service a share of the card (--gpu-memory-utilization): two services starting together on one card count each other's memory, and both stop with "No available memory for the cache blocks". A fixed working cache (--kv-cache-memory-bytes) avoids that.
  • A 512 MiB working cache: an 8,192-token text needs 0.88 GiB.
  • Starting beside another program on the card without --gpu-memory-utilization: vLLM checks at start that 92% of the card is free, even when the cache size is fixed. On 2026-11-30 both services restarted in a loop for about 20 minutes because the voice stack was on the card. They now start with --gpu-memory-utilization 0.2, which only satisfies that check.