Skip to content

fix(k8s): set q8_0 KV cache on every Ollama tier - #3101

Merged
dan-petty merged 4 commits into
mainfrom
fix/2396-the-q4-0-ollama-16gib-tier
Nov 1, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/2396-the-q4-0-ollama-16gib-tier

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2396

Issue #2396: ollama-16gib sets OLLAMA_KV_CACHE_TYPE to q4_0, and the other eight Ollama tiers set q8_0. Ollama passes the value to llama-server for every model, also for the embedding model. The 4-bit KV cache changes the vectors of qwen3-embedding:0.6b: for the same input, a vector from ollama-16gib has a cosine of 0.78 to 0.92 against a vector from a q8_0 tier. The gateway lists ollama-16gib-fast as an order: 2 deployment of that model. When an order 1 tier fails or cools down, a RAG batch goes to it, and its drifted vectors go into the Qdrant collection that holds the q8_0 vectors.

Change: openspec/changes/archive/2026-11-01-2396-the-q4-0-ollama-16gib-tier/

@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

  • group 1 (Set q8_0 KV cache on every Ollama tier): done, 36 model requests, commit 513bc191970c

@dan-petty

Copy link
Copy Markdown
Owner

Advisory pre-merge review (automated; a person decides).

Recommendation: merge after minor fixes. The manifest change is correct and in scope. Four minor points remain, and none of them is a defect in the manifest.

Reviewed head: e4bf3c8. Lenses: fidelity, tests, correctness, standards.

Severity Where Problem Evidence Fix
minor PR title The title is cut off with "..." and is 65 characters long. It becomes the squash commit subject. Title: "fix(k8s): the q4_0 ollama-16gib tier makes different embedding..." Rename the PR, for example "fix(k8s): set q8_0 KV cache on every Ollama tier".
minor openspec/specs/ai-gateway-routing/spec.md (new requirement "Every Ollama tier sets one KV cache type") The scenario says "a check reads" the nine values. No test or check does this. A later edit can put q4_0 back on one tier and no check fails. git diff origin/main...HEAD --stat lists no file under tests/. grep -rn OLLAMA_KV_CACHE_TYPE tests finds no assertion on the manifest. design.md gives the owner rule of 2026-11-01 (tests are for new code functionality). The archived change 3005 states the same rule, so the rule is not invented. Person decides. Either accept the rule and word the scenario with the command that verifies it (git grep for q4_0, count of q8_0 is 9), or add one small test on OLLAMA_PROFILES_MANIFEST in tests/ai/benchmark/test_k8s_llm_gateway.py.
minor proposal.md and PR body ("Closes #2396") Acceptance criterion 3 (cosine 0.999 or more between ollama-16gib and ollama-48gib-slow) cannot run before Argo CD rolls out the manifest. The plan marks it "pending a person". Merge closes the issue before the check runs. proposal.md section Acceptance, criterion 3. tasks.md section "Workflow follow-up" has two pending steps. Keep "Closes #2396" only if the owner accepts a check after the rollout. Otherwise leave a PR comment that criterion 3 stays open.
minor k8s/llm/profiles/ollama-profiles.yaml (ollama-16gib DaemonSet, line 127) The VRAM fit of gpt-oss:20b at 131072 context with q8_0 on the 16303 MiB GPU is an estimate: 13660 + up to 1536 = 15196 MiB. The estimate does not count qwen3-embedding:0.6b, and OLLAMA_MAX_LOADED_MODELS is "2". A partial CPU offload is possible after the rollout. proposal.md Feasibility says the embedder "is not counted". The PR states this openly and asks a person to run ollama ps after the rollout. After Argo CD syncs, a person confirms 100% GPU with ollama ps. If the model offloads, lower the context of this tier.
nit k8s/llm/profiles/ollama-profiles.yaml:18 Trailing space at the end of the new comment line. git diff origin/main...HEAD --check prints ollama-profiles.yaml:18: trailing whitespace. Remove the space.
nit Commit 513bc19 The subject is not a Conventional Commit. It does not matter after a squash that uses the PR title. git log: "Set q8_0 KV cache on every Ollama tier (#2396)". None, if the squash uses the PR title.

Findings dropped:

  • The "hawk" node name in the proposal: the same name is already in CHANGELOG.md and in an archived change. It is no new exposure.
  • The standards lens rated the title as major. It is a one-click fix and it changes no content, so it is minor here.
  • The tests lens rated the missing test as major. The repo shows the owner rule for this case (see above), so it is minor and a person decides.

Checks that I ran (through the lenses):

  • Diff against origin/main: one env value (q4_0 to q8_0) on ollama-16gib, a header comment, the spec sync and the archive move. git grep "value: q4_0" prints nothing. The q8_0 count is 9.
  • uv run devops ci test tests/ai/benchmark/test_k8s_llm_gateway.py tests/invariants/test_k8s_manifests.py tests/ai/test_k8s_gpu_matrix.py: 129 passed. These tests do not read the KV cache type, so they do not guard this change.
  • The root spec requirement is the same as the delta spec. The change folder is archived in the last commit. The PR is a draft and closes only fix(k8s): the q4_0 ollama-16gib tier makes different embedding vectors, so a fallback rag batch puts drifted vectors in the index #2396. No CHANGELOG or version file changed. No private data in the diff.
  • CI at review time: all finished checks passed. "Tests & Coverage" was still running.
  • I did not run the full test suite. I did not measure the VRAM fit.

@devops-cli-service
devops-cli-service Bot marked this pull request as ready for review November 1, 2026 20:26
@dan-petty dan-petty changed the title fix(k8s): the q4_0 ollama-16gib tier makes different embedding... fix(k8s): set q8_0 KV cache on every Ollama tier Nov 1, 2026
@dan-petty
dan-petty merged commit aad0115 into main Nov 1, 2026
20 checks passed
@dan-petty
dan-petty deleted the fix/2396-the-q4-0-ollama-16gib-tier branch November 1, 2026 20:44
dan-petty-release Bot added a commit that referenced this pull request Nov 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.38.0](v0.37.4...v0.38.0)
(2026-11-01)


### Features

* **review:** osv-scanner toolrun records its database digest
([#3120](#3120))
([5731fac](5731fac))
* **roadmap:** add gate tools to the runner, one shell policy
([#3111](#3111))
([7735d8b](7735d8b)),
closes [#3072](#3072)
* **roadmap:** give the step AGENTS.md and routed rules
([#3107](#3107))
([80a22eb](80a22eb)),
closes [#3097](#3097)
* **roadmap:** run the project hooks and scoped CI in the Job
([#3112](#3112))
([b7ab211](b7ab211)),
closes [#3043](#3043)


### Bug Fixes

* **ai:** send the per-call sampling of LLMClient.chat
([#3126](#3126))
([8207bdc](8207bdc))
* **argo:** replace a token that Argo CD refuses
([#3121](#3121))
([b4955b4](b4955b4))
* **devcontainer:** remove CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
([#3125](#3125))
([295c32c](295c32c))
* **k8s:** set q8_0 KV cache on every Ollama tier
([#3101](#3101))
([aad0115](aad0115))
* **rag:** raise EmbeddingsError for an empty Ollama URL list
([#3118](#3118))
([111a031](111a031))
* **security:** refuse PYTEST_ADDOPTS and npm_config_logs_dir overrides
([#3119](#3119))
([9fe2af5](9fe2af5))


### Code Refactoring

* **security:** read legacy numeric hosts with getaddrinfo
([#3128](#3128))
([41779f9](41779f9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): the q4_0 ollama-16gib tier makes different embedding vectors, so a fallback rag batch puts drifted vectors in the index

1 participant