Repository navigation
Description
Context & Rationale
The embedding task still calls one Ollama node directly (embeddinggemma:300m), while the gateway now serves embeddings from every Ollama node (devops-embedding is bge-m3, and ollama/* passes any model through). Retrieval quality has never been compared on this repository.
Scope & Deliverables
- Context & Rationale*: The embedding task still calls one Ollama node directly (
embeddinggemma:300m), while the gateway now serves embeddings from every Ollama node (devops-embeddingis bge-m3, andollama/*passes any model through). Retrieval quality has never been compared on this repository. - Deliverable*: Point the embedding task at the gateway. Compare bge-m3, embeddinggemma and nomic-embed-text on retrieval over the indexed repository (
devops ai rag, and thedevops ai benchmarkembedding runner): recall at k on a small labelled query set, indexing time and vector size. Re-index with the best model. - Constraint*: Changing the model means re-indexing Qdrant, since vector sizes differ (768 and 1024).
Strategic Alignment
- Milestone:
v0.2.23(Foundational Architectural Guardrails & Project Hygiene) - Roadmap Reference:
docs/ROADMAP.md
Update 2026-10-08: refinement
#1065 shipped. The READMEs still name embeddinggemma:300m (k8s/README.md:79, :88, :119-121; k8s/llm/profiles/README.md:100-103), while the gateway serves only bge-m3:latest (k8s/llm/gateway/configmap.yaml:53-59).
- Both READMEs name only embedding groups the gateway serves.
Proposed design
Problem statement
The embedding task currently calls one Ollama node directly (embeddinggemma:300m), while the gateway now serves embeddings from every Ollama node. This prevents comparison of retrieval quality across different models and requires re-indexing Qdrant when changing models due to differing vector sizes.
Acceptance criteria
- Criterion 1: The embedding task points at the LLM gateway instead of a direct Ollama node
Verification: Verify that calls to the embedding endpoint route through the llm-gateway service rather than directly to an ollama pod - Criterion 2: Comparison of bge-m3, embeddinggemma and nomic-embed-text models on retrieval quality
Verification: Run the devops ai benchmark embedding runner with all three models and compare recall at k scores on a small labelled query set - Criterion 3: Indexing time and vector size measurements for each model are recorded
Verification: Execute re-indexing with each model and measure both indexing duration and final Qdrant collection vector sizes - Criterion 4: The best performing model is used for re-indexing the repository
Verification: Confirm that after evaluation, the index is rebuilt using the highest performing model according to recall metrics
Key questions
- What are the current embedding models available through the LLM gateway?: The gateway serves embeddings from every Ollama node, with devops-embedding using bge-m3 and ollama/* passing any model through. [sources: docs/ROADMAP.md]
- What is the current direct Ollama node used for embeddings?: The embedding task currently calls one Ollama node directly (
embeddinggemma:300m). [sources: docs/ROADMAP.md] - What models will be evaluated for retrieval quality?: The models to be compared are bge-m3, embeddinggemma and nomic-embed-text. [sources: docs/ROADMAP.md]
- What are the constraints for changing embedding models?: Changing the model means re-indexing Qdrant since vector sizes differ (768 and 1024). [sources: docs/ROADMAP.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
docs(roadmap): plan LLM tuning and optimization work for v0.2.23 (#483)
feat(release): v0.2.23 (#681)
dan-petty commentedon Oct 1, 2026
Moved from the shipped v0.2.23 to the backlog. It is still valid (checked 2026-10-01), and P2 items don't displace P1 work in the planned releases.
dan-petty commentedon Oct 2, 2026
Grooming (2026-10-02): Priority p2-medium → p3-low. The routing half is already a config switch. What remains is a model-quality evaluation with no defect behind it.
Checked against the code at the release/v0.2.25 tip.
dan-petty commentedon Oct 3, 2026
Retarget (2026-10-03). Source: the slow-tier plan (
.data/slow-tier-plan-20261003.md, sections 1 and 3) and its verification pass.What is compared, and how.
bge-m3:latestagainstqwen3-embedding:0.6b.embeddinggemma:300mhas had no request in any Ollama or gateway log, and fix(k8s): ollama-48gib-slow keeps its embedding model and qwen3-coder loaded and leaves every interactive pool, so a review no longer evicts the embedder #1064 deletes its gateway groups.nomic-embed-textis not served."{path} {symbols}"per file, top_k 3 (ai/review/pipeline.py:1484at e3ff98c);"{title} {description}"per finding, top_k 2 (ai/review/verification.py:297).ai/benchmark/document_chunker.py:437-500), so it judges code search poorly.Why switch at all.
qwen3-embedding:0.6bis already devops-cli's default (config/defaults.py:201).server/routes.go, per the plan's verification].Order.
query:/passage:prefixes (ai/rag/embeddings.py:668-680) and may be served stale cached vectors. fix(ai): a failing embedding model pauses rag lookups instead of ending rag for the run, and each embedding model gets its own prompts, cache keys, dimension and bounded chunks #1065 also fixes the 768 → 1024 fallback dimension.Running it (person-run).
KEEP_ALIVE=-1, so a third model evicts qwen3-coder. Run the A/B while hog is idle:ollama stop bge-m3:latestafter its arm, and pull the new model first (kubectl -n llm exec ds/ollama-48gib-slow -- ollama pull qwen3-embedding:0.6b).qdrant.collection_prefix, or rundevops ai rag clear --forcebetween arms.If qwen3-embedding wins.
qwen3-embedding:0.6b(model: ollama/qwen3-embedding:0.6b,model_info.mode: embedding) and setai.tasks.embedding.model.DEVOPS_CLI_AI_TASK_EMBEDDING_TIMEOUT=120 devops ai rag clear --force && devops ai rag index --force && devops ai rag index-kb.devops ai rag status. The plan's offline chunker run gives about 17,500 chunks.ai.rag.score_threshold, which fix(ai): a failing embedding model pauses rag lookups instead of ending rag for the run, and each embedding model gets its own prompts, cache keys, dimension and bounded chunks #1065 makes the code read. Use about 10 known path/symbol pairs and the cosinerag queryprints after fix(ai): a rag collection records its embedding model, a mismatch fails instead of wiping the collection, and ranking keeps the cosine score #1066.Priority stays P3 for now. In practice it waits for #1065.
dan-petty commentedon Oct 3, 2026
Review redesign (#1137, 2026-10-03): this item is a phase P5 child (P5-4, conditional) and is not frozen: embeddings through the gateway serve chat and the KB index now, and any review embedding use waits for this item and #1066.
dan-petty commentedon Oct 8, 2026
Linked: #598, which fits models per Ollama tier with this item choosing the embedding model; that choice sets the background tier's second resident. Found by the 2026-10-08 backlog review.
dan-petty commentedon Oct 18, 2026
Status set to Ready at 25e2cda (see proposed design in issue body).
docs(k8s): the READMEs name only the embedding model the gateway serv…
feat(benchmark): rank code chunks queried by path and symbols in the …
feat(k8s): serve qwen3-embedding:0.6b as the gateway embedding model (#…
dan-petty commentedon Oct 22, 2026
What changed
#1931, merged into
release/v0.2.39as 80e07bb.11 file(s) changed.
How it was verified
Check runs at 1c86b72:
Acceptance Criteria of
docs/agent/tasks/task-481-embeddings-through-the-gateway.md:qwen3-embedding:0.6bsince part 3). The new test failed for each of four places that named a model the ConfigMap lacked. These were the by-name list, the bullet, the example configuration and the profiles excerpt.mxbai-embed-large:latest,ollama/embeddinggemma:300m) fails the same way asembeddinggemma:300m.--code <dir>queries each code chunk under the directory by its path and symbol names and aims the query at that chunk, with no hand-labelled set, model-written query or constant score, and--documentand--codeare refused together.bge-m3:latestandqwen3-embedding:0.6b.EmbeddingBenchmarkRunner.__init__is the one place that readsDEFAULT_EMBEDDING_BENCHMARK_MODELS, whenmodelsis empty.devops ai benchmarkpasses the models it parsed (--models, elseai.model), so it reaches the default only when--modelsholds no model name, as--models ,does; a person-run names its models.qwen3-embedding:0.6bscored recall@1 of 74% against 53% forbge-m3:latest. Its MRR was 0.804 against 0.583, and its nDCG@5 was 0.823 against 0.589. Both give 1024-dimension vectors.qwen3-embedding:0.6bwon.qwen3-embedding:0.6bas its one embedding group, on the deployment that servedbge-m3:latest(ollama-48gib-slow,model_info.mode: embedding). The tests read the group from the ConfigMap. No group forbge-m3:latestremains.k8s/devops/configmap.example.yamlsetsai.tasks.embedding.modelto the group the gateway serves._collect_deploy_targets(["llm"], ...)lists the gateway ConfigMap, sodeploy-stack --stack llmapplies it.qwen3-embedding:0.6b, the size that the benchmark measured.uv run devops k8s deploy-stack --stack llm. On a cluster that Argo CD manages, the command applies no manifest of git. ThellmApplication then syncs the ConfigMap frommain, after the release merges.kubectl -n llm rollout restart deployment/llm-gateway && kubectl -n llm rollout status deployment/llm-gateway. Follow-up issue fix(k8s): a changed gateway ConfigMap rolls the gateway deployment, so deploy-stack never leaves a stale pod #1929 makes a changed gateway ConfigMap roll the gateway deployment, so thatdeploy-stacknever leaves a stale pod.KEYto the gateway master key. Runkubectl -n llm port-forward svc/llm-gateway 4000:4000. In a second terminal, runcurl -sS -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' http://localhost:4000/v1/embeddings -d '{"model":"qwen3-embedding:0.6b","input":"ping"}' | jq '.data[0].embedding | length'. The command prints1024.kubectl -n llm exec ds/ollama-48gib-slow -- ollama list. Where the model is missing, runkubectl -n llm exec ds/ollama-48gib-slow -- ollama pull qwen3-embedding:0.6b. Then run the check again.uv run devops k8s deploy-stack --stack devops. The command needsservice.reposandservice.machine_accountin yourconfig.yaml. A deployeddevops-cli-confignamesbge-m3:latestuntil then, and the gateway no longer serves that model.uv run devops k8s deploy-stack --stack allin place of thellmanddevopsdeploys. Then restart the gateway. The cluster jobs read their ConfigMap when they start, so they need no restart.roadmap-servicestays at 0 replicas (chore(service): the roadmap service stays at 0 replicas, and its development is blocked, while its machine account is suspended #1562).config.yamlat the gateway model. Setai.tasks.embedding.providertogatewayandai.tasks.embedding.modeltoqwen3-embedding:0.6b. Setai.gateway_urland the gateway key as ink8s/README.md. An agent never edits that file.export DEVOPS_CLI_AI_TASK_EMBEDDING_TIMEOUT=120first, because the default timeout is 15 s (DEFAULT_RAG_EMBEDDING_TIMEOUT). Indexing sends batches of 32 to a tier that serves one request at a time. Then runuv run devops ai rag clear --force && uv run devops ai rag index --force && uv run devops ai rag index-kb. The clear comes first, because the index refuses a collection that another model indexed (fix(ai): a rag collection records its embedding model, a mismatch fails instead of wiping the collection, and ranking keeps the cosine score #1066).index --forcestep and note its wall time. Record the vector size thatuv run devops ai rag statusshows. The benchmark measured 1024.ai.rag.score_threshold(0.35). For about 10 known path and symbol pairs, runuv run devops ai rag query "<path> <symbol>" --min-score 0. Read the cosine of the known chunk. Set the threshold between those cosines and the cosines of unrelated chunks.kubectl -n llm logs ds/ollama-48gib-slow --since=15m | grep 'POST.*/api/embed'during the re-index. The benchmark p95 ofqwen3-embedding:0.6bwas 2,655 ms, the slowest of five single queries. Look for requests that take 15 s or more, the default timeout. The re-index step sets 120 s, so the 15 s limit applies to later lookups.cosine_similaritycalled per chunk,compute_ndcg_at_kand the inline recall, MRR and nDCG loop inevaluate_model_on_server) with a numpy matrix product (numpy is inuv.lock) andpytrec-eval-terrier, orir-measuresif its named-measure API is preferred. Measured on this part's input (100 queries over the 7,699 chunks ofsrc): 57 s with the runner's pure-Python cosine and sort, against 0.05 s for the numpy matrix and 0.01 s for the metrics. Both libraries gave the runner's recall@1/3/5 (9, 15, 18%) and nDCG@5 (0.138) exactly; MRR differed (0.150 against the runner's 0.151) only because their runs were cut at the top 100, and they break ties by document id where the runner takes the lower index, which differs only for chunks with identical content. The saving is about 2 minutes of a 27-minute run, because the embedding of the corpus dominated the run: 15.6 and 12.3 items per second over about 17,600 chunks is 19 and 24 minutes.pytrec-eval-terrierhas no aarch64 wheel and needs a C compiler (gcc 15 or later needsCFLAGS=-std=gnu17), and the change touches the release image build. The estimate is 250k to 400k tokens and about an hour for one build and review (follow-up issue refactor(ai): rank the benchmark with numpy and pytrec-eval #1928).feat(release): v0.2.39 (#1947)