v8 Vision Capability Status

Artifact-specific status for generated image execution. Encoder numerics, decoder numerics, task quality, and live serving are separate gates. A passing shared-prefix decoder test does not certify image preprocessing or the encoder.

Evidence reviewed: 2026-11-06. This is a curated snapshot, not a live nightly result. Links identify the result and its scope; a newer build needs its own evidence.

No full vision artifact is certified for the HTTP harness yet. Generated image paths run, but independent numerical, task-quality, and live-serving gates have not all passed on one pinned artifact. Unsupported bundles should continue rejecting image requests.

Experimental Qwen3-VL image HTTP adapter

The separate server.vision_http service connects uploaded PNG/JPEG bytes to the existing generated encoder and visual native-session entry. Ordinary text serving remains unchanged. It binds only to loopback. Its supported surface is /v1/chat/completions, streamed or non-streamed, with exactly one image across the caller-supplied conversation. The client must attach the image bytes. The server does not open paths from prompts or fetch remote images. A PDF must first be rendered into page images by the client; this endpoint handles one page per request.

OpenAI-compatible clients can set stream_options.include_usage to true to get a separate usage chunk before [DONE]. They can send a tool list only with explicit tool_choice: "none". The server does not forward tool declarations to the native worker, execute tools, or accept tool results.

One request owns admission before upload starts; other requests receive 429. Uploads are bounded at 12 MiB and 30 seconds, image bytes at 8 MiB, decoded pixels at 16 million, text at 64 KiB and output at 1,024 tokens, further restricted by the generated context capacity. Each request uses a fresh subprocess with a 32 GiB address-space limit. This is not resident serving or batching. Cancellation kills and reaps that worker before releasing admission. A streaming response supplies X-Request-ID; cancel it with DELETE /v1/requests/{id}. Closing the client connection also cancels work. Healthy native execution has no automatic inference deadline.

Pin operator-owned generated artifacts before launch. The decoder directory needs libmodel.so, its packaged engine/tokenizer, weights, layouts and imported publisher chat_template.jinja. The profile hashes these inputs, the GGUF tokenizer source and the native session library. Artifact changes require explicit re-pinning; rebuilding a bundle does not silently upgrade the running profile.

make ck-session-v8
python -m server.vision_bundle --encoder /path/to/encoder --decoder /path/to/decoder \
  --tokenizer-gguf /path/to/model.gguf --model cke-qwen3-vl-experimental \
  --image-placeholder '<|image_pad|>' --output /path/to/profile.json
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python -m server.vision_http \
  --profile /path/to/profile.json --threads 4 --port 8120
curl http://127.0.0.1:8120/v1/capabilities
python scripts/vision_http_client.py --model cke-qwen3-vl-experimental \
  --image ./example.png --prompt 'Describe the image.' --max-tokens 4 --stream

The client example uses only Python's standard library and can be copied to another machine. Connect through SSH forwarding for remote use. No unauthenticated remote listener is provided. Capabilities describe preflight validation, not full numerical certification. Startup loads and frees both native models; workers verify pinned artifacts again for every request.

The November 14 P3 smoke test uses a generated 56-by-56 two-color fixture, four visual rows, 20 prompt rows and only 256 tokens of compiled capacity. Both response modes produced the same four tokens and first full-vocabulary logit hash as retained standalone execution. This is a budget- truncated output, not an answer-quality or normal-EOS pass. Rejection, busy admission, cancellation and follow-up recovery were exercised separately. Cold request cost includes hashing and loading; these timings must not be presented as warm resident performance. See the retained scope and evidence.

Qwen Code image smoke test

For Qwen Code 0.25.1, pin the larger bundle under model name cke-qwen3-vl-8k and start the local vision service on port 8120. Run from the directory containing the image:

QWEN_CODE_SYSTEM_SETTINGS_PATH=/path/to/CKE/server/qwen-code/vision-smoke.settings.json \
CKE_LOCAL_VISION_KEY=local \
qwen --auth-type openai --model cke-qwen3-vl-8k --safe-mode --advisor off \
  --approval-mode default --max-tool-calls 0 --max-session-turns 1 \
  --max-wall-time 10m --system-prompt 'Answer only the question about the attached image.' \
  '@image.png What characters are printed in the image? Reply with the characters only.'

The smoke profile uses a 32K client estimate to accommodate Qwen Code's conservative context padding. This is not an advertised server capacity: the tested bundle enforces 8192 compiled tokens. The 2K bundle could not fit the harness prompt. Use this profile only for a bounded turn. @image.png explicitly attaches the image; a plain path does not.

On the pinned Qwen3-VL-8B Q4_K_M decoder and BF16 encoder at 224 by 128 pixels, Qwen Code read one synthetic image exactly and stopped normally. On a second image, both Qwen Code and direct HTTP dropped a digit; the direct JSON response also included Markdown fences. This verifies the attachment path, not broad OCR accuracy, numerical parity, or model-requested uploads. The isolated vision service does not replace text or speech serving.

Choose the encoder resolution for document OCR

The low-cost Qwen3-VL 8B image profile compiled at 224 by 128 pixels misread the year 2026 as 2020 on the public receipt. Pinned llama.cpp read the original 512-by-512 PNG correctly, but reproduced the wrong year when given CKE's prepared 224-by-128 RGB input. Holding the CKE decoder and projector weights fixed, a 512-by-512 generated encoder with 256 merged rows read all eight receipt fields correctly through Pi and stopped normally.

For this square receipt fixture, the generated bridge builder can target 256 merged image rows using --image-path tests/fixtures/nano_vl_ocr/receipt.png --image-min-tokens 256 --image-max-tokens 256 with the matching projector GGUF and decoder. Pin the resulting encoder separately and check its compiled geometry before serving. Use the same image and prompt when comparing bundles; this experiment isolates a geometry limitation, not general OCR accuracy.

python -m server.vision_http --profile /path/to/ocr-profile.json \
  --threads 6 --min-encoder-short-edge 512

The opt-in guard rejects an undersized or unknown compiled encoder geometry before the server listens. It does not change resizing, impose a minimum on input files, or guarantee effective text resolution after padding. Higher resolution also means more visual rows and more model work.

Repeatable image answers and follow-up acceptance

Cancellation now retains ownership while subprocess creation finishes, then reaps the child before releasing admission. The delayed-creation regression fails against the previous controller and passes with this change; test cleanup also reaps its deliberate negative-control child. A failed transport before stream iteration also releases admission, and nested generators close before a new request can start. The CLI allows five seconds for graceful server shutdown before cancelling active requests; this does not impose a normal inference deadline.

The acceptance lane uses committed two-color PNG/JPEG fixtures, swapped left/right colors, repeated requests and caller-supplied follow-up history. The assessor requires the requested JSON answer and normal stop; a truncated answer, swapped colors, duplicate JSON keys, extra contradictory text, reused request ID or service restart cannot pass. Every attempt gets its own report directory; it starts INCOMPLETE and preserves responses collected before a failure. A timeout is INCOMPLETE, not a model-quality verdict. This command is suitable for an opt-in local nightly; no timer is installed and no old result is substituted for a current attempt.

For a stronger connection check, launch the isolated test service with --verify-reference. This operator-only flag repeats direct generated prefill using the identical rendered IDs and encoded prefix before native-session execution. Initial full-vocabulary logits must match exactly. It doubles prefill work and is intended for diagnosis, not performance measurement. The independent encoder oracle, later decode logits and full mutable-state comparisons remain separate gates.

python -m server.vision_http --profile /path/to/2k-profile.json --port 8121 \
  --threads 4 --verify-reference
python scripts/certify_vision_http.py --base-url http://127.0.0.1:8121 \
  --model cke-qwen3-vl-2k --fixtures tests/fixtures/vision_http_acceptance \
  --expected-bundle THE_PINNED_BUNDLE_SHA256 --require-reference \
  --output-root /private/vision-acceptance --timeout 600

The expected bundle must come from the operator's retained profile and preflight evidence; do not silently adopt whichever identity happens to answer. The client verifies boot identity and loaded libraries across the run. Output contains the public fixture answers, hashes, token counts and timings. Use a dedicated endpoint so other clients do not interrupt single-request admission.

The retained 2K bundle has 32 visual rows and preprocesses the 224-by-112 fixtures to its compiled 256-by-128 geometry. Allocated 2K capacity is not certification of 2K rendered prompts. These simple color tasks do not establish OCR, arbitrary visual reasoning, tools, real harness integration, resident latency or sustained unattended operation. See the actual acceptance verdicts and prompt counts.

Native visual session: first connected decoder boundary

The next experimental step adds ck_session_v8_generate_visual and SessionV8.generate_visual. One already-encoded visual block sits between exact rendered token segments. The existing generation lock, decoder loop, token callbacks, cancellation flag and failure reset remain the execution owner. That native change alone did not add HTTP serving; the experimental adapter above now connects it. It is not a resident encoder service.

The generated decoder exports its exact visual-row width, including any deep-stack slices. Older bundles without that contract reject this entry. Native admission checks token IDs, finite visual values, buffer extent, grid geometry, explicit text position, sampling parameters and both requested and loaded context capacities before reset. Failed or cancelled execution resets the affected state. Visual requests do not publish text checkpoints or enable prefix reuse. The Python binding owns a prefix copy during execution; its storage must be included in the future HTTP memory budget.

A fresh Qwen3-VL-8B-Instruct Q4_K_M decoder and BF16 vision projector processed a generated 56-by-56 image into four visual rows of 16,384 floats, with 20 total prompt rows. Three native session repetitions matched direct generated execution for all four full-vocabulary logit rows, active positions and declared KV arenas. KV comparison includes arena padding; internal bridge scratch is not captured. This establishes same-artifact session equivalence, not an independent encoder oracle, OCR accuracy, long-context or harness certification. Four-token generation stopped at its requested budget.

The first real load exposed a deployment gap: standalone bridge libraries relied on a globally preloaded tokenizer. The bundle compiler now links and packages that dependency, hashes it in the build fingerprint, and invalidates old compile stamps. A fresh-process relocation test covers this defect.

Retained native evidence and limitations. The opt-in replay command consumes an existing bridge report and its exact prefix/logit captures:

python version/v8/scripts/certify_visual_session_v8.py   --bridge-report /path/to/bridge_report.json   --prefix-f32 /path/to/prefix.f32   --reference-logits-f32 /path/to/logits.f32   --output /path/to/current-session-report.json

The probe writes INCOMPLETE before starting and FAIL on missing inputs or an execution error. It verifies actually loaded library hashes. Synthetic compiled tests separately exercise A/B/A, failed prefill, invalid admission without mutation, cancellation, close ownership and successful follow-up. They are not model arithmetic certification. These native tests remain separate from the HTTP smoke evidence above.

The experimental HTTP adapter above connects this boundary for one pinned bundle. Larger-context task acceptance and image-plus-tool continuation remain open. Ordinary text and speech services are unchanged.

Experimental serving integration: upload contract first

As of 2026-11-13, the ordinary HTTP session still rejects live images. The generated standalone bridge already executes image preprocessing, encoder, visual prefix and decoder, but the complete upload/encoder/session path is not yet exposed through HTTP. The first serving change adds server.vision_input.prepare_vision_input: a model-independent, ordered input contract. This is a callable validation helper, not a new HTTP endpoint or a claim of harness acceptance.

The harness owns local file access. It must read an explicitly selected file and upload its bytes as a PNG/JPEG base64 data URL. A filename on the laptop is not a filename on P3. The helper accepts Responses input_text/input_image and Chat Completions text/image_url parts and preserves their order and original image bytes. It does not flatten images into text, resize them, fetch URLs, read server paths, or modify publisher templates. Model-specific preprocessing remains in the generated pipeline.

Initial defaults allow one image, 8 MiB total compressed image data, 16 million decoded pixels, 64 KiB of UTF-8 text and 32 ordered parts. These are input-safety bounds, not a bundle's token capacity or supported visual geometry. Future HTTP integration must additionally bound raw body size and concurrent uploads before JSON parsing. Animated images, PDF, audio/video parts, remote URLs, file IDs and explicit image detail modes are rejected until their own contracts exist.

  1. Pin and rebuild one Qwen3-VL encoder/decoder pair with loaded library, tokenizer and preprocessing identities.
  2. Expose generated mixed-image/text execution through a checked native session adapter. Bind visual rows, positions, masks and any deep-stack inputs to their owner. Reject unsupported order/geometry before mutation.
  3. Use the upload contract at HTTP admission only for a bundle declaring the connected capability. Validate visual plus text plus output capacity; serialize native ownership and keep prefix caches disabled until certified.
  4. Compare identical image bytes and rendered tokens through standalone and HTTP execution, including full logits and applicable state. Exercise reset, cancellation, streaming and a successful follow-up.
  5. Connect a real harness, then add image-plus-tool continuation and explicitly tested multi-image ordering.

The server suite covers malformed images, MIME mismatches, truncation, aggregate limits, part order, Unicode, request independence and rejection before expensive decoding. It also retains the live-media rejection tests. These are admission tests, not encoder parity tests. Qwen Code, Nemotron harnesses and other clients gain image support only for an explicitly supported vision artifact; text-family support alone is insufficient. PDF rasterization and its page/pixel limits belong to a separate follow-up.

CKE artifactEncoder vs llama.cppDecoder vs llama.cppPyTorchImage tasksHTTP / harnessFirst unresolved boundary
Qwen3-VL
qwen3_vl_vision + qwen3vl
INCOMPLETE: no maximum boundProduction-flash comparison retains a concentrated outlier. Aggregate metrics passed, but no maximum-error bound was declared, so strict prefix parity is not established. #889 Historical scoped PASSShared-prefix decoder campaigns passed under older artifacts and oracle settings. Current independent-prefix certification is open. #506 NOT TESTEDNo complete independent PyTorch encoder-to-decoder verdict recorded here. NOT CERTIFIEDCurrent independent image-to-answer and broader quality gates remain open. EXPERIMENTAL HTTPTiny pinned upload smoke passed; full harness and tool continuation are not promoted. #894 Late visual-prefix row outlier; its first causal layer is unresolved. Track
Qwen3.6-VL
qwen36vl
FAIL: strict prefix gateRetained public case: maximum 0.0490 against 0.01; RMSE 0.000427 against 0.001. #949 FAIL: numerical trajectoryIndependent prefixes matched token choices in one case, but step-3 logit RMSE reached 0.501. Shared-prefix and independent-prefix lanes remain distinct. #949 NOT TESTEDNo complete independent PyTorch verdict recorded here. SCOPED PASSOne public clean-text image produced the expected answer; this is not corpus or general-vision certification. #949 NOT CONNECTEDNo promoted image-capable bundle. Encoder outlier origin unresolved; decoder numerical divergence persists even in a shared-prefix diagnostic.
Gemma4
gemma4_vision + gemma4
SCOPED PASSPublic table case: 72 visual tokens, RMSE 0.000467 and maximum 0.007234 within the declared 0.001 / 0.01 limits. Not a family-wide verdict. #970 NUMERICAL MISMATCHShared-prefix first-logit RMSE 0.312, maximum 2.186; independent-prefix RMSE 0.384, maximum 2.411. A later opt-in attention candidate improved some forced steps but worsened step 0; it was not promoted. #970, #1032 NOT TESTEDNo complete PyTorch decoder comparison recorded here. LIMITED EXECUTIONImage-fed answers have been generated; broader scored quality remains open. The EOS output-contract fix is separate. #1040 NOT CONNECTEDGenerated bridge execution is not an HTTP harness PASS. Layer-0 attention output is the first observed decoder mismatch on the cited case (maximum 0.00419). Its locally introduced cause is not proven. Track
Cohere Compass
cohere_compass_vision
IMPLEMENTED, NOT CERTIFIEDA vision circuit exists; a complete pinned generated-prefix verdict is not recorded. Circuit NOT TESTED PARTIALOfficial-PyTorch X-Ray evidence is cited for selected operations, not a complete artifact-level encoder comparison. Contract NOT TESTED NOT CONNECTED Fresh generated encoder, bridge, and independent-oracle evidence are needed before naming a numerical layer.

Inventory boundary

qwen35, qwen38, instella_moe, and nemotron_h are text/recurrent circuits in this inventory. Their text compatibility does not certify a vision encoder. An exact vision-capable artifact and a connected CKE path must be identified before adding a numerical verdict for them.

Nemotron Nano 12B v2 VL: generated fixed-tile image path. The checked generated gather reproduces the publisher's v2 patch packing for one 512-pixel tile: 1024 spatial RADIO rows of width 1280 become 256 projector rows of width 5120, without changing BF16 storage bits. Generated C then runs weighted RMSNorm, bias-free expansion, squared ReLU, and bias-free projection with BF16 stores. On one public image, a PyTorch RADIO reconstruction provided the same spatial input to both projectors. With the publisher weights and the opt-in CBLAS provider, final embeddings differed from PyTorch by RMSE 0.000229 and maximum absolute error 0.03125. This is a diagnostic, not a declared numerical acceptance result. The offline host now executes the patch projection and all 32 RADIO blocks in generated C, with publisher BF16 weights widened to FP32 and FP32 intermediate activations. Two public color fixtures had encoder feature RMSE 0.0231 and 0.0287 against the retained BF16 PyTorch reconstruction. The generated projector feeds the generated 12B Q4_K_M decoder with 256 image rows inside the publisher's image markers. It gave the expected color on both public fixtures and stopped normally. This does not certify BF16 encoder parity, dynamic tiling, or broad OCR quality. It does not change the capability of the text-only 9B bundle. Publisher implementation.

Nano VL HTTP: experimental, loopback only. The separate Nano VL profile admits one uploaded PNG or JPEG, resizes to one 512-by-512 RGB tile, and inserts its generated prefix between the publisher's image delimiters. Each request owns a disposable worker and starts with fresh decoder state. The local client reads the image on the client machine; the server never opens a user-supplied path. Tool calls, incremental text streaming, dynamic tiling, PDF and other media, and third-party harness certification are not part of this profile.

On Ryzen, the generated Nano VL bundle answered both swapped-color fixtures and read FORM 42 from a synthetic image, all with normal stops. The test checked the uploaded image hash, distinct visual prefixes, and loaded library identities. It also rejected a path-only request and an oversized request, cancelled an active encoder worker and accepted the next upload. These are bounded application results, not independent logit parity or broad document OCR.

Prepare encoder/config.json from the publisher, and extract encoder/vision.safetensors from the pinned BF16 checkpoint's model-00001-of-00007.safetensors with python -m scripts.pack_nemotron_vision. Place a BF16 CBLAS library exporting cblas_gemm_bf16bf16f32 at encoder/libblas.so. Use the matching generated 12B staged decoder (as decoder/libmodel.so), its layouts, manifests, runtime libraries, publisher tokenizer and template. The matching GGUF supplies the prompt tokenizer used by this profile.

python -m scripts.pack_nemotron_vision model-00001-of-00007.safetensors encoder/vision.safetensors
python -m server.vision_bundle --nemotron-vl --encoder encoder --decoder decoder \
  --tokenizer-gguf decoder.gguf --model nemotron-nano-vl \
  --image-placeholder '<image>' --output profile.json
python -m server.vision_http --profile profile.json --threads 10
python scripts/vision_http_client.py --model nemotron-nano-vl --image form.png --prompt 'Read the text.'

Pi one-shot OCR from a local path

Use a trusted Pi 0.73.1 installation on the client. Explicitly approve a directory and select one relative image path. The launcher rejects links and paths outside the approved directory, stages the image in a private temporary directory, and passes it to Pi as an image attachment. It disables tools, sessions and auto-compaction so Pi does not send a text-only follow-up to the image endpoint. It returns the raw answer text and stop reason, not Pi's input-image events. This is a user-approved upload, not a model-selected file or permission prompt.

python scripts/pi_vision_once.py --base-url http://127.0.0.1:8120 \
  --approved-root ./images --image form.png \
  --prompt 'Read the text in the image. Reply with the exact text and nothing else.'

For a server on another machine, forward the port over SSH. The launcher uses the tested 1,024-token Nano VL profile and a 32-token output budget. Keep exact formatting and recognized text as separate verdicts: a trailing newline does not change the characters read from the image, but fails a byte-exact answer check.

Validated OCR JSON

Supply a local Draft 2020-12 JSON schema to validate an OCR object after a normal stop. The launcher accepts a plain object or one complete JSON fence, rejects duplicate keys and extra prose, and reports accepted fields in data. The original text and its json_source remain separate. Validation errors return a nonzero exit and no data. This mode does not enable constrained decoding or change model output.

python scripts/pi_vision_once.py --approved-root tests/fixtures/nano_vl_ocr \
  --image receipt.png --max-tokens 160 --json-schema tests/fixtures/nano_vl_ocr/receipt.schema.json \
  --prompt 'Extract merchant, date, subtotal, tax, total, and items (object mapping printed item names to prices) as JSON.'

The server checks the rendered prompt, image rows and requested output against compiled context. The public cheque, receipt and checkbox fixtures have captured answers and field-level expected values for portable client regressions. Replaying those captures tests parsing and validation, not a new model run. The earlier live run got all 15 fields right, but all three answers used fences.

Interactive image REPL

python -m scripts.vision_repl --model nemotron-nano-vl --approved-root ./images
> /image form.png
> What fields are present?
> Which options are selected?

Follow-up requests retain one uploaded image in the client-side history. A successful /image PATH replaces the image and clears the old history; /reset clears both. Control-C cancels the active request and interrupted, failed or truncated turns are not added to the history. The service still uses a fresh native worker per turn. This is not a resident image cache, multi-image context, or persistent Pi certification.

python -m scripts.certify_vision_repl --model nemotron-nano-vl --output /tmp/nano-repl.json

The opt-in real-model check uses two public images with opposite answers. It tests follow-up, replacement, cancellation, recovery, and reset in one client against an already running pinned service.

A separate Pi 0.73.1 RPC acceptance command tests A, B, then A again in one Pi process. It explicitly resets the session before each replacement and rejects a stale image or history. It does not add automatic file selection, resident model state or a Pi cancellation claim.

timeout 600 python -m scripts.certify_pi_vision_replacement \
  --model nemotron-nano-vl --output /tmp/nano-pi-replacement.json

Nemotron 3 Nano Omni: not supported by this path. Its C-RADIOv4-H encoder, dynamic image geometry, and 2688-wide language bridge require a separate checked artifact contract. Publisher architecture.

OCRia Nano 1.0.0 upright Latin image OCR

The detector and Latin recognizer are compiled to two checked CKE entries. ONNX parses the pinned model assets at build time only. The image runner uses Python, Pillow, NumPy and SciPy for image decoding, geometry, connected components and CTC string assembly. All learned operations, including the recognizer's affine quantization boundaries and CTC top-1/confidence head, execute in generated C and native kernel providers. The runner does not implement the model's orientation/script router, other recognizers, document layout or PDF parsing. Treat it as a bounded image lane, not as a replacement for the publisher's whole application. Review the upstream model terms before using the assets.

python version/v8/scripts/run_ocria_generated_v8.py build "$ASSETS" "$NEW_BUNDLE" \
  --target-isa avx2_fma
taskset -c 0-7 python version/v8/scripts/run_ocria_generated_v8.py run "$NEW_BUNDLE" \
  tests/fixtures/nano_vl_ocr/receipt.png --threads 8 --repeats 9 \
  --fact 'NORTH MARKET' --fact 'TOTAL 13.39' --oracle "$ASSETS"

Use the portable build by omitting --target-isa, and select one hardware thread per physical core appropriate to the host. Omit --oracle for a native run with neither ONNX package nor the original model files. The default bundle has a 512x512 detector and 512-wide Latin crops; the importer checks geometry and the runner refuses inputs outside the built geometry. The ONNX Runtime comparison uses the same crop padding and image-side code, a separate detector heatmap and recognizer inference, and the CPU provider with idle intra-op spinning disabled. Each timing median is from nine warmed image-to-text executions; image I/O, decode, preprocessing, detector, all crops, recognition and text assembly are included. Build, library/session load and the first warm-up are excluded.

Initial Ryzen comparison

Physical cores Receipt CKE / ORT (ms) Cheque CKE / ORT (ms)
1 201.88 / 20.97 131.42 / 14.59
4 159.09 / 12.22 104.10 / 8.88
8 152.33 / 10.88 98.65 / 8.02

At eight cores the recognizer took 139.29 ms for the receipt and 85.94 ms for the cheque, versus 6.25 and 3.51 ms in ONNX Runtime 1.31.1. The receipt used 16 crops and 412 CTC steps; the cheque used 9 crops and 378 steps. Both runtimes matched 8/8 receipt facts and 4/4 cheque facts and returned identical strings, matching crop boxes and used CTC IDs. Both added an extra :2 on the receipt date line. Detector maximum error was below 8.7e-7; maximum CTC confidence difference was 0.07030 on receipt and 5.97e-8 on cheque. These results are not a claim of confidence parity or general OCR accuracy.

The generated sources total 52,858 bytes and the linked model libraries 79,112 bytes (only system C and math libraries are dynamically needed). ONNX Runtime's standalone native library on that host was 29,352,200 bytes, excluding its Python binding and other support files. The ONNX detector and recognizer artifacts total 1,291,110 bytes including graph metadata. CKE requires 3,520,420 bytes for packed weights, including padding: the current import expands integer weights to FP32. Its two arena allocations reserve 128,384,220 bytes outside the weight spans; those are explicit arena sizes, not RSS. ORT workspace and end-to-end process RSS were not measured.

The 512-wide recognizer calls 29 convolutions per crop. Its 16 pointwise convolutions account for 139.5 million of the 146.0 million nominal MACs per crop. This is a work count, not a measured cycle share. Profile those calls and compare a packed quantized pointwise provider next, preserving the existing accuracy fixtures. Review workspace liveness separately instead of inferring memory savings from generated code size.

AVX2 Q/DQ follow-up

On Ryzen, perf record -e cycles:u attributed 32.8% of baseline user cycles to the scalar Q/DQ body, plus at least 7.7% to its clamp calls. Pointwise GEMM was about 17.0%. Vectorizing Q/DQ reduced its share to 2.8% in the follow-up profile. Pointwise convolution then took 31.8%, other grouped convolutions 20.4%, and worker loops 21.4%. These are whole-process sampled shares, not a per-layer roofline.

Eight physical cores, 11 warm runs per process, baseline/candidate/ candidate/baseline ordering on the shared Ryzen host:

Image Baseline CKE median range AVX2 Q/DQ median range ORT in candidate processes
Receipt 159.0-206.2 ms 56.8-61.8 ms 11.0-12.2 ms
Cheque 136.8-143.6 ms 41.1-42.5 ms 9.3-9.9 ms

Separate perf stat receipt runs (35 measured iterations) had 11369 ms process task-clock over 7.38 s baseline and 7068 ms over 2.55 s candidate, averaging 1.54 and 2.77 busy core-equivalents. These include thread waiting/spinning and process overhead; they do not establish useful FMA utilization. Generic cache-miss counts did not consistently move the same way across the two images. This is not an LLC or bandwidth finding. The two builds matched heatmaps and used CTC confidences bitwise, as well as boxes, IDs and text, on both fixtures.

The optional X-Ray adapter python version/v8/scripts/xray_onnx_qdq_v8.py PACKET/bundle.json executes an independent ONNX Q/DQ graph on verified packet operands, reporting mismatches without graph rewrites. It is not a replacement for the optimized connected ONNX oracle or a native replay-fidelity check.

There is no KV-cache region in either OCR arena. Named detector features and input account for 109,969,408 bytes and Latin features/input account for 17,686,528 bytes. An offline lifetime count, retaining external inputs and final outputs, finds peaks of 15,728,640 and 1,638,400 bytes respectively among declared graph buffers. Those are live-byte lower bounds, not implemented allocation sizes. Reuse needs to follow resolved calls and exclude any aliased, exported, or persistent operands that outlive a call.

Matched physical-core sweep

Use the same taskset and --threads for both processes. Run native without --oracle; add --oracle "$ASSETS" --oracle-only for a separate ONNX Runtime process that does not load the generated libraries. Set OPENBLAS_NUM_THREADS=1 so the shared image host does not add BLAS workers. busy_core_equivalents is warmed process CPU seconds divided by elapsed seconds, including spins, not useful SIMD utilization.

Ryzen 9950X3D, one hardware thread per physical core, receipt image and 55 warm iterations per backend, pinned to CPU 0 through N-1:

Cores allowed CKE ms ORT ms CKE busy cores ORT busy cores
1 86.14 20.88 1.00 1.00
4 44.36 11.56 2.65 2.27
8 38.52 11.03 4.31 3.25
16 50.41 21.96 7.59 4.63

The 16-core run spans both CCDs. The measurement does not separate cross-CCD cost from additional dispatch and synchronization. At eight cores, detector was 8.89 / 1.39 ms and recognition 25.60 / 6.28 ms (CKE / ORT). The two stages acquire CPU time in separate worker pools, but have the same eight physical CPUs available and run sequentially. In separate 25-iteration receipt processes, perf stat counted approximately 54.4 billion instructions for CKE versus 14.2 billion for ORT at eight cores (including startup and host processing). At 16 cores, CKE's context switches increased from 57,199 to 270,745 and its CPU migrations from 31 to 2,339. Those are scheduling symptoms, not a measurement of L3 misses or the cause of each switch.

A diagnostic static partition of equal-sized pointwise tiles was effectively tied on eight cores (receipt 38.4-38.7 ms baseline, 38.5 ms candidate). It regressed latency on both fixtures at 16 cores and was not shipped. A separate diagnostic, keeping the detector at eight threads but assigning up to eight simultaneous crops to single-threaded recognizer instances, improved receipt from 38.35 to 27.97 ms and cheque from 27.45 to 25.95 ms. Outputs remained bitwise equal at the used CTC confidence boundary, with the same IDs and text. That prototype replicates full recognizer arenas and weights; it is not a production mode. Treat packed pointwise projection and workspace reuse as the next steps, and retest crop scheduling once workspace per worker is bounded.

One-core attribution

On the same Ryzen CPU 0, with an idle SMT sibling, one intra-op thread, BLAS capped at one, and 60 warmed full receipt runs, CKE measured 86.15 ms (19.16 detector, 63.02 Latin) and ORT 20.76 ms (3.39 detector, 14.00 Latin). Each averaged one busy core and had no active worker threads. perf stat recorded about 29.49B versus 7.57B user cycles and 124.15B versus 27.65B user instructions, including process startup. CKE's cycle samples were 41.2% pointwise and 30.4% other grouped convolutions. Annotating the hot pointwise loop showed YMM broadcasts, loads, and vfmadd231ps: FP32 SIMD is active.

With ORT graph optimization disabled, the receipt took 47.07 ms instead of 20.83 ms in a separate run. Used IDs and text agreed. That switch changes multiple optimizations, not just quantization. The optimized graph used 29 QLinearConv and 11 QLinearAdd nodes for Latin, and blocked channel layouts in the detector. On a synthetic capturable head fixture using its real 192-by-792 weights and 128 input positions, isolated warm ORT QLinearConv took 37.33 us, versus 267.65 us for the current CKE FP32 convolution alone. Requantizing CKE's output matched all 101,376 output bytes for that fixture. Sampling the isolated ORT node and disassembling its hot addresses confirmed ZMM vpdpbusds with weight reuse across several input rows. This is a different arithmetic path; the one fixture does not establish general exact equivalence.

CKE had about 4.81x as many demand-L2 data requests in a separate counter pass, but a higher L2 hit ratio (97.5% vs 93.3%). These counters include the whole pipeline and cannot isolate a kernel or prove bandwidth saturation. Do not infer a prefetch deficiency or peak FMA utilization from them. A proper roofline needs a per-operation measurement against a bandwidth ceiling for the actual residency level and separate FP32 and U8xI8 compute ceilings.

Next acceptance experiment: a packed U8xI8 pointwise provider with an independent integer reference, identical logical operands, explicit accumulation/requantization semantics and portable fallback. Compare packing cost, cycles, cache traffic and output bytes independently from the connected OCR task. Evaluate blocked FP32 detector convolution separately.

The first private, fixed-shape VNNI prototype on that same synthetic head fixture measured 53.46 us for the packed dot product plus native requantization, versus 256.58 us for CKE's FP32 convolution alone and 37.35 us for ORT's quantized operator. Packing and session setup were outside the timed region. All 101,376 accumulators matched an independent int64 reference and all 101,376 U8 output bytes matched ORT. The padded weight panel occupied 153,600 bytes versus 608,256 bytes for the FP32 weight matrix, before scales, bias and alignment. This is evidence for the quantized provider design, not a shipped provider or an end-to-end speedup.

Generated packed pointwise lane

Build with --packed-pointwise --target-isa avx512_vnni to select all 16 eligible pointwise calls. The checked loader requires AVX2, FMA, AVX-512F and VNNI before loading this target. The portable target implements the same integer contract without VNNI. The FP32 path remains the default; the other 13 recognizer convolutions and the detector are unchanged at the graph level.

Packed model weights stay INT8. The provider quantizes the input into planner-owned U8 scratch, performs zero-point-corrected INT32 dot products, and applies per-output scales, nearest-even rounding, and saturation. It emits the dequantized FP32 result for remaining mixed precision consumers. This is not yet an all-INT8 graph. Only explicit single-consumer affine output edges with compatible bias and scale semantics are fused. No ONNX dependency is needed to run either image.

On Ryzen, warmed full image-to-text medians from 25 runs at fixed 512 recognizer width:

Physical cores Image FP32 baseline Packed VNNI ORT
1 Receipt 86.07 ms 70.18 ms 21.02 ms
1 Cheque 58.56 ms 49.56 ms 14.45 ms
8 Receipt 38.31 ms 35.65 ms 11.10 ms
8 Cheque 27.13 ms 25.35 ms 8.13 ms

Both runtimes matched 8/8 and 4/4 expected facts, crop boxes, used CTC IDs and raw text. ORT confidence differences remain; the maximum values are unchanged from the FP32 baseline on both fixtures. The packed recognizer's stored weights went from 3,191,136 to 877,824 bytes, and non-weight arena space from 18,051,168 to 12,836,928 bytes.

An initial serial, dynamically indexed VNNI implementation regressed latency. Fixed register tiling, vector input packing, removal of unused FP32 Q/DQ results, and parallel output panels removed that regression. The eight-core receipt profile puts mixed grouped FP32 convolution and pool worker loops ahead of the packed dot product. A separate controlled 320-wide receipt run took 26.81 ms and retained ORT text and CTC-ID agreement; it cannot accept the longest cheque crop. Do not generalize that result to arbitrary crops. A width bucket needs a verified right-context guard and a full-width fallback. Other next targets are the remaining spatial/depthwise operators and the blocked FP32 detector.

Byte-activation recognizer

--byte-activations --target-isa avx512_vnni builds a separate circuit and native library. With --target-isa portable it uses scalar providers for the same arithmetic. The original default and --packed-pointwise remain available for A/B testing; the two opt-in modes are mutually exclusive. ONNX is not loaded when executing a generated bundle.

The importer establishes matching affine scales and zero points before connecting U8 ports. The planner reserves one byte per element. The convolution maps resolve explicit INT32 reduction contracts and per-output FP32 requantization. Packing at build time produces position-major byte execution with 16 packed pointwise convolutions, 13 signed spatial or depthwise convolutions, and 11 affine byte adds. Within the recognizer, FP32 remains at normalized input and dequantized logits for CTC confidence. The detector remains FP32, as in the pinned oracle. Recognizer model weights occupy 838,144 bytes; its non-weight arena is 3,034,176 bytes, versus 12,836,928 bytes for the previous mixed path.

Eight physical Ryzen cores, 25 warmed full-image runs, same 512-wide recognizer geometry:

Image Previous mixed path Byte-activation path ORT
Receipt 35.58 ms 22.71 ms 11.11 ms
Cheque 25.55 ms 17.97 ms 8.13 ms

Both images match ORT text, used CTC IDs and crop boxes; all 12 fixture facts pass. Receipt confidence maximum difference is 5.96e-8; cheque is 0.01202. Comparing raw intermediate outputs against the optimized ORT graph gave 640/640 exact crop-operator outputs for the receipt and 302/360 for the cheque. The first cheque mismatch is one byte at a residual-add midpoint (CKE 110, ORT 109). Neither dtype agreement nor task agreement is a claim of universal bitwise parity. FMA experiments did not produce a proven portable replacement contract.

The final detector is approximately 8.4 ms versus 1.45 ms in ORT, representing the majority of the remaining end-to-end latency gap. Detector-only perf samples put grouped FP32 convolution at 37%, pointwise FP32 at 22%, and dispatch/worker loops at 25%. Optimize its FP32 spatial execution and scheduling separately, rather than quantizing it merely to match the recognizer's dtype.

Detector row execution and guarded crop widths

The AVX-512 target now specializes eligible 3x3 FP32 one-input-per-group convolutions. Each worker processes disjoint rows. The vector interior avoids per-output geometry checks and the borders retain the original padding and accumulation order. A separate experiment widening the pointwise FP32 vectors did not materially improve full OCR and was not retained.

Add --latin-bucket-width 160 --latin-bucket-width 224 --latin-bucket-width 320 to a byte-activation build to enable optional shorter recognizable crops. The importer traces the local graph to determine the right-context bound: one position per four pixels, with 79 pixels of maximum right reach. The shortest compiled width that preserves every used position's support is selected. Crops not admitted by a smaller bucket continue through the full 512-wide entry; oversized crops are still rejected. The ONNX comparison uses exactly the same crop widths. Extra resident stages add 2.51 MB of weights and 4.76 MB of non-weight arena space in this three-bucket configuration; that space is reported separately.

Eight physical Ryzen cores, 35 warmed runs on the final bucket build:

Image Previous fixed-width CKE CKE row path + buckets ORT, same buckets
Receipt 22.71 ms 16.74 ms 9.29 ms
Cheque 17.97 ms 15.30 ms 7.51 ms

The detector-only row change saved about 0.9 ms at fixed width in alternating runs. Bucketed Latin time is 5.19 / 3.83 ms (receipt / cheque), versus 4.51 / 2.87 ms in ORT. The longest cheque crop falls back to width 512. The new path matched original fixed-width CKE heatmaps and used CTC confidences byte-for-byte, with identical boxes, IDs and text across receipt, cheque, then receipt again. The prior ORT cheque confidence difference is unchanged.

The remaining dominant cost is detector execution: about 7.7 ms in CKE versus 1.4 ms in ORT. The inspected optimized ORT detector uses 40 blocked NCHWc convolutions, with fused ReLU on 33 and sigmoid on one. CKE currently runs planar convolutions and separate activation passes. This evidence prioritizes blocked layout and fusion experiments over another vector-width change; it does not attribute the entire gap to any one operator.

Channel-contiguous detector and fused activations

Add --detector-channel-layout to opt in. The graph keeps the planar RGB-to-gray ingress, then uses FP32 position-major activations and reduction-major packed weights. The 27 single-consumer convolution/ReLU edges are fused without changing FMA order or negative-zero behavior. Resize and concat use matching HWC maps. The generic checked add keeps two-pass rejection-before-write and vectorizes both passes on AVX-512. The original detector path remains buildable without the flag.

Eight physical Ryzen cores with 40 warmed runs per process, alternating baseline and candidate, at matched recognition widths:

Image Planar CKE HWC CKE + vector add ORT
Receipt 16.75-16.77 ms 11.86-11.87 ms 9.26-9.42 ms
Cheque 15.25-15.26 ms 10.25-10.36 ms 7.58-7.60 ms

The HWC layout and ReLU fusion alone brought detector time from about 7.7 to 4.4 ms. Its follow-up sampled profile attributed 14.4% of cycles to checked addition. Vectorizing residual adds reduced detector time to 3.05-3.11 ms; the matched ORT detector remains around 1.4-1.5 ms. Detector workspace fell from 110,333,052 to 79,645,820 bytes; stored detector parameters stayed at 329,284 bytes. The final detector and used CTC confidence tensors match the previous CKE build byte-for-byte, with matching boxes, IDs and text in an A/B/A request sequence. Both engines pass all 12 expected facts. Prior ORT confidence differences are unchanged. These two fixtures meet a 1.5x latency target, not full timing parity or general accuracy certification.

ThinkStation P3: physical P and E cores

The Intel Core i7-14700T exposes AVX2/FMA and VEX AVX-VNNI on both core types, but no AVX-512. The prior AVX2/FMA build still used scalar fallbacks for HWC convolution and for the recognizer's INT8 dot product. On eight P-cores that build took about 255 / 198 ms for receipt / cheque, despite producing the same text as ORT.

Build with --target-isa avx_vnni on an admitted host, retaining --byte-activations --detector-channel-layout and the width buckets. The existing maps and accumulator contracts are unchanged. The new target emits YMM VEX vpdpbusd for byte pointwise ops. The 256-bit vector paths also cover affine byte operations, spatial convolution, FP32 HWC convolution and checked residual add. No ISA assumption about AVX-512 is made in the P3 build.

Warm full OCR medians, same physical CPU affinity, thread count, images and crop widths in CKE and ORT 1.31.1. P-core tests pin one hardware thread per physical core:

Core set Receipt CKE / ORT Cheque CKE / ORT
1 P 43.11 / 25.21 ms 39.54 / 21.23 ms
2 P 35.64 / 20.77 ms 30.48 / 17.68 ms
2 E 56.45 / 36.36 ms 48.62 / 30.21 ms
8 P 25.11 / 18.61 ms 21.18 / 13.92 ms
4 P + 4 E 26.05 / 20.45 ms 22.09 / 15.24 ms

A separate reversed-order check used one backend per process. Eight P-cores reproduced 25.07 / 17.46 ms and 20.79 / 14.45 ms; 4P+4E reproduced 26.16 / 19.38 ms and 21.93 / 15.20 ms. Eight P-cores are faster in absolute terms even where adding E-cores lowers the ratio relative to ORT. CKE's 8P detector remains roughly 6.8-7.0 ms vs 2.2-2.4 ms for ORT. The Ryzen ratio does not carry across unchanged in the single- or dual-core cases. Both fixtures retained matching CTC IDs and text across the sweep; the ORT confidence differences are unchanged.

Full-width 3x3 interiors

The HWC provider uses unmasked vectors when the entire 3x3 window is in bounds and the channel block is full. Padded borders and channel tails keep the guarded path. Both x86 vector widths keep the same bias-first FP32 FMA order and fused-ReLU behavior.

Warm 512x512 receipt detector medians, with the same generated graph, model weights, prepared pixels, affinity and thread count before and after. Excludes image preprocessing and model loading.

Host Physical cores Before After ORT
P3 AVX2/FMA 1 P 17.83 ms 13.98 ms 6.66 ms
P3 AVX2/FMA 2 P 12.12 ms 10.15 ms 4.18 ms
Ryzen AVX-512 1 7.63 ms 6.11 ms 3.31 ms
Ryzen AVX-512 2 4.89 ms 4.13 ms 2.10 ms

The receipt heatmap is bitwise unchanged on both hosts. Receipt and cheque retain exact ORT crop boxes, CTC IDs and text. P3 one-P-core full receipt OCR was 44.44 ms before and 39.38 ms after (ORT 25.19 ms). Pointwise convolution is the largest remaining sampled P3 detector hotspot. These are bounded fixture timings, not broad certification.

Unlimited-OCR SAM bring-up

Tracker: #1319. Artifact: Baidu Unlimited-OCR, revision 8249d20. This is operation evidence, not image inference or model support.

SAM produces query-dependent relative-position terms along each axis. For a query at (y, x), the height term for key row ky is the dot against table row y + H - 1 - ky. The width term is analogous. The checked provider stores the H height terms followed by the W width terms, using BF16 inputs, scalar FP64 dot accumulation, and FP32 then BF16 rounding. The later attention consumer must round the axis sum at the declared BF16 boundary before applying the score bias.

Equal query and key grids and pre-sized tables are required. The op does not partition windows, interpolate tables, run attention or change how padded keys participate. It does not allocate workspace or materialize a dense per-query attention-bias matrix. The existing compiler resolves the provider ABI and checks the planned extents.

Evidence

Run python -m pytest -q tests/test_v8_relative_position_terms.py. The generated asymmetric fixture is asset-free. The optional PyTorch CPU test uses seeded synthetic BF16 queries and the full local geometry for one base image: 25 windows by 12 heads, each 14x14 with 64 head channels. CKE and PyTorch 2.6.0 matched all 1,646,400 BF16 terms both with synthetic tables and with the publisher's two block-0 BF16 tables. This does not establish equivalence with every PyTorch reduction backend or with the publisher's connected QKV.

To repeat with the checkpoint tables, download the 6,912 byte inclusive range 5879775536-5879782447 of the pinned model-00001-of-000001.safetensors and set CK_SAM_RELATIVE_TABLES to that file. The test validates the SHA-256 before use. The range was derived from the shard header, and contains height then width.

Generated attention consumer

The generated probe now composes the relative terms with noncausal plane-major attention. It adds the two position terms in BF16, then applies the stored bias to the scaled query-key score. The provider stages the output in planner-owned scratch, with one FP32 score row, and publishes it only after successful execution. Padding keys are ordinary keys in the SAM attention contract; the provider does not insert a padding mask.

The asset-free rectangular fixture matches an independent NumPy reference bitwise and checks that a nonfinite key leaves the previous output untouched. The two-plane, 14x14, 64-channel BF16 case compares against PyTorch CPU math SDPA on identical seeded Q/K/V, including the optional pinned block-0 position tables. It uses rtol 0.008 and atol 3e-5, not a bitwise SDPA contract. A no-bias control confirms that the tested positional bias materially changes the output. This scalar provider establishes numerical behavior, not CPU speed at full scale.

Spatial window layout

The checked BF16 layout op maps raster rows to window-major, then head-major, rows and can invert that mapping. It writes positive zero to partial windows when packing and drops those positions on unpack. An asymmetric asset-free generated graph runs raster Q/K/V, window pack, relative terms, attention, and raster recovery. The packed queries and restored output agree bitwise with NumPy. Masking padded positions would change the answer in this fixture.

The raster Q/K/V fixture uses synthetic zero padding after projection. The publisher instead pads hidden rows before its biased projection. All 2,304 values of the real block-0 bias are nonzero; zero-padding Q/K/V after projection is not equivalent.

Generated padded QKV projection

A separate generated probe packs hidden rows before a checked BF16 biased projection, using the portable ordered reduction. The portable fixture detects double rounding if bias is applied after the dot has already been stored as BF16. The pinned case uses block-0 weights and bias with synthetic 768-channel hidden rows. Its padded QKV rows equal the publisher bias bitwise, and all 18x2304 outputs match the PyTorch CPU comparator within the declared rtol 0.008 and atol 3e-5.

Set CK_SAM_QKV to the 3,543,552 byte inclusive range 5876231984-5879775535 of the same pinned shard to reproduce the optionally asset-backed test. The probe validates SHA-256 and reads bias then weight. The portable test has no checkpoint dependency.

Connected block-0 attention

The generated SAM attention circuit starts with post-normalization raster rows, pads before the biased QKV projection, splits its packed output into window/head planes, applies relative-position attention, restores raster order, and runs the output projection. Restoring raster before the pointwise output projection avoids projecting discarded rows. The asset-free test checks the exact split planes and final BF16 values against NumPy, and verifies a rejected input leaves the prior final output unchanged.

The pinned PyTorch 2.6.0 CPU math comparison uses the publisher's block-0 attention weights and synthetic post-normalization rows (9x15, padded to two 14x14 windows, 12 heads, head dimension 64). Max absolute error was 0.0078125 and RMSE was 2.947013e-5, below the exploratory caps 0.03125 and 0.00390625. This is neither a bitwise contract nor a full-resolution or image-driven model result. To reproduce with the existing QKV and relative-table assets, also set CK_SAM_OUTPUT_PROJ to inclusive shard bytes 5875050800-5876231983 (bias followed by weight), then run python -m pytest -q -s tests/test_v8_sam_connected_attention.py.

Complete generated block 0

The block circuit adds both LayerNorms, the attention residual, biased MLP projections with exact erf GELU, and the second residual using existing checked providers. Explicit BF16-to-FP32 and FP32-to-BF16 operations surround the FP32 LayerNorm and GELU providers; storage policy is declared by the source manifest. The asset-free test exercises nonzero residual and MLP inputs and verifies that nonfinite input does not replace the previous final output.

On the same synthetic 9x15 hidden grid with two 14x14 windows and the publisher's full block-0 weights, the generated block reaches max absolute error 0.015625 and RMSE 0.000364686 against PyTorch 2.6.0 CPU, within exploratory block caps of 0.125 and 0.015625. This is a full block, not a full-resolution encoder comparison. Add CK_SAM_MLP_NORM with inclusive shard bytes 5879782448-5889233455 to the other three pinned assets and run the same test command.

Document pixels through block 0

The image circuit accepts prepared RGB8 HWC pixels. Generated C normalizes to BF16, packs raster patches in channel/row/column order, projects using the pinned 16x16 patch weights and bias, and adds the learned absolute position tensor in BF16 before invoking block 0. The oracle computes independently from its prepared pixels with PyTorch BF16 normalization, Conv2d (stride 16), position addition, and the block. Both resize lanes use Pillow bicubic: the CKE host assembles resize and center padding explicitly, while the oracle uses ImageOps.pad. This does not establish independent RGB decoding or resize-library parity.

The test derives portrait receipt and landscape cheque inputs from the existing public synthetic fixtures by adding neutral margins. It does not generate or score document text. It checks RGB pixels and normalized patch samples exactly, then records max absolute error and RMSE at projection, position addition, and the complete block output. The asset-free generated test checks the same wiring at small geometry. For the full 1024x1024 case, add CK_SAM_PATCH_POS with inclusive bytes 6058716464-6066189103 (patch bias, patch weights, absolute positions) from the pinned shard to the other assets.

Results on P3 with Pillow 13.0 and PyTorch 2.6.0 CPU, seeded fixtures as described above. Each lane processed the full 1024x1024 image and 64x64 patch grid. RGB and BF16 patch operands were bitwise equal.

Synthetic input Projection max / RMSE After position max / RMSE Block 0 max / RMSE
Portrait receipt 0.00390625 / 3.76429e-6 0.0078125 / 5.22715e-6 0.0625 / 2.71212e-4
Landscape cheque 0.0078125 / 1.41160e-5 0.015625 / 1.61824e-5 0.0625 / 5.97385e-4

Both cases met the exploratory max/RMSE caps (0.03125 / 0.00390625 for projection and position addition, 0.25 / 0.03125 for block 0). These are image-fed block-level results, not full encoder certification.

Image-fed prefix through the first global block

The generated graph passes the portrait receipt through patch projection and blocks 0, 1, and 2 using the pinned weights. The first two blocks use 14x14 windows; block 2 uses a 64x64 global window with all 4,096 keys per head. Against PyTorch CPU math, max error / RMSE was 0.0625 / 2.71212e-4 for block 0, 0.0625 / 8.62551e-4 for block 1, and 0.0546875 / 1.49862e-3 for block 2. These meet the exploratory checkpoint caps; the final block is not bitwise equal.

To repeat, add CK_SAM_BLOCK1 with inclusive shard bytes 5889233456-5903416111 and CK_SAM_BLOCK2 with bytes 5931807024-5946015279 to the previous block-0 and patch assets. The test validates both hashes. Run python -m pytest -q -s tests/test_v8_sam_connected_attention.py -k first_global. The asset-free two-block fixture checks input handoff and exact output.

Complete generated SAM stage

The 12-block generated stack reuses activation regions across blocks of the same window geometry. Its four global blocks use the entire 64x64 grid. The generated neck runs 1x1 and 3x3 convolutions, two channel normalizations with explicit BF16 rounding boundaries, and two stride-2 convolutions, emitting a 16x16 grid of 1024-channel BF16 features.

The asset-free tests check bounded workspace reuse, padding, strided raster order, and rejection before publication. The optional released-weight comparison accepts the Safetensors header bytes 8-334639 and model bytes 5875050800-6066189103 as header.json and sam.bf16. Set CK_SAM_FULL_ASSETS to their directory and run python -m pytest -q -s tests/test_v8_sam_full_stack.py. Both input files are hash checked.

On the pinned synthetic 1024x1024 receipt, the independent PyTorch CPU comparison measured max error / RMSE of 0.125 / 0.00815685 before the neck and 0.00805664 / 0.000910964 at the SAM feature output. The identical-input neck probe using trained weights measured 0.001953125 / 0.0000977733. These are bounded numerical checks, not full-model parity.

One execution with both backends pinned to the same P3 P-core took 489.03 seconds in the generated SAM stage and 75.59 seconds in PyTorch, excluding resize and load. The CKE arena includes weights and was 1,176,434,816 bytes. This is an initial latency baseline, not a warmed timing distribution or a speed pass.

Next: feed SAM features into the 24-layer CLIP-derived encoder, connect the visual bridge and generated decoder, and score actual image answers. SAM evidence alone is not OCR or serving support.

Unlimited-OCR base-image bridge

For the pinned Baidu revision 8249d20b2822a7d8a4c22c8d8c9069b5ac36bda3, the generated bridge accepts 257 CLIP rows (including the class token) and 256 SAM rows. It drops the CLIP class row, concatenates CLIP then SAM per patch, runs the released linear projector, appends the learned newline after each of the 16 raster rows, and appends the view separator. It emits 273 rows of 1,280 BF16 features.

The connected producers and decoder insertion are not part of this test. On seeded synthetic feature operands, the real released projector and framing weights matched the PyTorch CPU comparison at max absolute error 0.0009765625 and RMSE 2.540229e-6. Newline and separator bytes were exact. A portable asymmetric fixture also checks source order, class removal and no publication after nonfinite input.

Run python -m pytest -q -s tests/test_v8_unlimited_ocr_bridge.py. For the optional pinned comparison, set CK_UNLIMITED_OCR_BRIDGE_ASSETS to a directory containing these inclusive byte ranges from model-00001-of-000001.safetensors:

Filename Byte range
projector.bf16 5869805360-5875050799
newline.bf16 662248240-662250799
separator.bf16 6066189104-6066191663

The test verifies the SHA-256 hashes before loading them. No model inference or OCR text was generated for this bridge-only comparison.

Unlimited-OCR receipt CPU performance

On December 2, 2026, the pinned Baidu Unlimited-OCR BF16 revision 8249d20b2822a7d8a4c22c8d8c9069b5ac36bda3 ran a public synthetic receipt on eight physical P-cores of an Intel i7-14700T. Both backends used the same affinity, without SMT siblings or E-cores. The reference is the explicit PyTorch CPU replay in the test, not a hosted service.

Decoder acceptance

The prompt has 279 rows, including 273 visual rows. Each backend receives the prefix from its own image pipeline. Timing includes prefill and cached greedy generation to EOS, excluding vision, compilation and weight loading.

BuildCKE prefill / decode (s)PyTorch prefill / decode (s)Total ratio
Control 44ca44b914.704 / 7.5132.403 / 3.6192.029x
Combined 12.501 / 5.8272.361 / 3.5801.402x
Combined 22.486 / 5.9912.364 / 3.4871.449x
Combined 32.492 / 5.8082.371 / 3.4891.416x

The combined build fuses single-row BF16 load validation, reuses bounded weight panels across multiple rows, and vectorizes range attention without changing accumulation order. All three runs preserved the 138 control CKE token IDs, including EOS, and recovered all eight annotated receipt fields. CKE and PyTorch differ on two layout-coordinate tokens; this is not bitwise cross-runtime parity.

A separate cycle profile attributed 79.7% of sampled prefill cycles to the bounded projection panel and 83.0% of sampled decode cycles to the paired single-row projection. Worker code and range attention accounted for 7.6% and 3.4% of sampled decode cycles. These are not elapsed-time shares.

Fresh image diagnostic

Each runtime independently regenerated its prefix from the public receipt, matching its retained prefix byte-for-byte. Both decoders consumed the fresh outputs, reached EOS and passed all eight fields. The independent prefixes differed across runtimes by 0.0546875 maximum absolute error and 0.00250341 RMSE.

StageCKE (s)PyTorch (s)
SAM20.79931.989
CLIP4.9671.021
Bridge0.0130.009
Decoder prefill2.5102.365
Cached generation to EOS5.8663.482
Sum of measured stages34.15538.866

This is one image and a sum of separately timed stages, not a warm request-latency measurement. It excludes image decoding and resize, compilation, weight loading and transitions between stages. Multipage, live HTTP and harness execution were not tested. The remaining gates are tracked in #1319.

Reproduce the decoder

Set the fixture directory to the pinned checkpoint slices, tokenizer and independent-prefix archive. The test verifies their hashes. Adapt the affinity list to one logical CPU per physical P-core on the test host. The full-budget test requires the control CKE IDs, EOS from both backends and the annotated merchant, date and label-to-price pairs. The timing target is not imposed on portable CI.

CK_UNLIMITED_OCR_FULL_DECODER_FIXTURES=/path/to/fixtures CK_UNLIMITED_OCR_RING_STEPS=160 \
  CK_NUM_THREADS=8 CK_THREADPOOL_CAPACITY=8 OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 \
  OPENBLAS_NUM_THREADS=1 taskset -c 0,2,4,6,8,10,12,14 \
  python -m pytest -qs tests/test_v8_unlimited_ocr_prefill_logits.py::test_pinned_receipt_full_prefill_logits

Next acceptance gate

For Gemma4, freeze the already compared visual prefix and forced tokens. Replay the first differing decoder operation on identical operands, distinguishing the first observed attention-output mismatch from a proven local cause. After a justified fix, rerun shared-prefix logits, independent-prefix logits, and scored image answers separately. Keep the tracking issue open until one exact artifact completes the image-to-answer and live-serving gates.

Image
100% | |
Scroll to zoom | Drag to pan | W/H to fit | 0 to reset | ESC to close