server: persist vision KV with exact conditioning provenance - #961
Open
JordiPosthumus wants to merge 1 commit into
Open
server: persist vision KV with exact conditioning provenance#961JordiPosthumus wants to merge 1 commit into
JordiPosthumus wants to merge 1 commit into
Conversation
JordiPosthumus
force-pushed
the
codex/fix-vision-kv-hash-provenance
branch
from
September 4, 2026 18:06
81b2cf9 to
d28b29e
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Persist image-conditioned KV under a key containing the exact conditioning that
produced it, and retain that provenance through prefix reuse.
Why
Equal text tokens do not imply equal KV when images contributed embeddings. The
key therefore includes image count, token spans, hashes of the final
conditioning vectors and canonical token text. Loading reattaches image metadata
only when the key and restored frontier agree.
A retained prefix still contains its old conditioning even if a fresh encoder
call produces different candidate bytes. Sync reports what was actually kept:
wholly retained images keep their old hashes, rebuilt images use new hashes, and
partial or unknown provenance cannot be persisted. A GLM dense-cache gap does
not itself erase the authoritative compact prefix; the dense repair bridge is
separately marked unknown.
Compatibility
Text-only cache files and payload ABI remain unchanged. Changed, moved or
missing images cannot select the checkpoint. Appended-image disk recovery is
excluded; live appended-image reuse remains #927. No model math, sampling,
launcher or default change.
Validation
Rebuilt as one commit directly on main
b0a147a7fba6d1a104d047d5a140e9bb4bfc13cd. Unit/backend coverage includesretained, rebuilt and appended images, interrupted sync, partial-image rejection,
malformed metadata and text-only compatibility.
Apple M3 Ultra, Metal default build; CPU is compile/link portability only:
All commands passed on 2026-09-04. Earlier C ASan+UBSan server checks passed.
A fresh M3 Ultra/Metal Vision-Exp MXFP4 run saved an image-conditioned
checkpoint on shutdown and recovered it after restart; changed-image and
text-only controls explicitly rebuilt cold. The server invocation was:
GLM compact-path behavior is source-checked but not GLM-model-tested. No full
aggregate model suite or GPU sanitizer result is claimed.
Matched speed/correctness check
Two mirrored runs per build, M3 Ultra/Metal, 2,048 and 16,384-token text
frontiers, 262,144 allocated context, 4,096 prefill chunk, 64 greedy output
tokens, warmed weights and no MTP:
Frontier-logit dumps were byte-identical; all differences were below 0.5%.
This short engine check is not an image-throughput, server-scheduling or
long-context production guarantee.
Merge coordination: #943 changes the same disk lookup call site. If either lands
first, preserve both canonical-text fallback and image filtering, plus both
regression groups.