Skip to content

vision: header probe, decode caps, EXIF orientation and pixel-bound parity (ported from Enntity) - #237

Merged
AzeezIsh merged 9 commits into
mainfrom
stack/vision-probe
Oct 29, 2026
Merged

AzeezIsh merged 9 commits into
mainfrom
stack/vision-probe

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Stack: … ← #236 ← this.

Summary

  • Ports Enntity's vision-preprocess revision (AGPL-3.0; 83389c7e, 9f656251, 8f0a89b1, aa494ccb, d85c88d0, at d0cead1) with credit.
  • Output changes, by design: EXIF-rotated images are now decoded upright; larger images fit under the higher decode cap; early rejects return errors instead of failing mid-decode.

Test plan (vs parent #236)

Tracking: #220.

Generated with Devin


Update 10-29 (pair-checked and fixed):

  • Admission wiring. vision: admission budgets: per-request rows (400) and in-flight rows (503 + Retry-After) (ported from Enntity) #236's prepare.rs now passes state.vision_limits / state.vision_budget. Before, every caller passed AdmitCtx::default() (fixed in vision: admission budgets: per-request rows (400) and in-flight rows (503 + Retry-After) (ported from Enntity) #236). On the pair, d7601f1c5: 8 × 2048² images → 400 vision_input_too_large (non-stream, stream and Anthropic); 1, 2 and 4 images are served; malformed or hostile headers are refused in under 20 ms.
  • Pre-decode video reservation. qwen_video_rows_ceiling → reserve_video → decode_gated(preprocess_video) → reconcile_video are now wired, as upstream d0cead1 does. It's opt-in, like upstream: it engages only with --video-max-pixels set, since FfmpegPolicy::max_total_decoded_pixels defaults to None (upstream serve_args.rs:1047, video_decode_ffmpeg.rs:117). Test: a_video_request_with_a_spent_in_flight_budget_is_refused_busy_before_decode.
  • Open: on b4d2a6541, vision-fidelity showed geometry matched 4/14 and integrity 8/10 against the parent's 14/14 and 10/10. That run used each arm's own binary as the client, so it's being re-run with one fixed client to name the cells. Don't merge until that's resolved.

@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from bdc9c03 to 0ead7cb Compare October 29, 2026 05:50
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from 0ead7cb to 79e9093 Compare October 29, 2026 07:13
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from 79e9093 to 63d7c29 Compare October 29, 2026 07:19
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from 63d7c29 to 339ea06 Compare October 29, 2026 07:20
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from 339ea06 to eda90fe Compare October 29, 2026 07:29
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from eda90fe to 13b85cc Compare October 29, 2026 07:30
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from 13b85cc to b15cc3d Compare October 29, 2026 07:40
@AzeezIsh
AzeezIsh force-pushed the stack/vision-probe branch 2 times, most recently from 6e608da to 0fb157c Compare October 29, 2026 08:37
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch from e535188 to 2d377ef Compare October 29, 2026 08:54
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
…eiling + reserve/reconcile + decode_gated + FfmpegPolicy::max_total_decoded_pixels (Enntity/atlas d0cead1, #237)
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
…eiling + reserve/reconcile + decode_gated + FfmpegPolicy::max_total_decoded_pixels (Enntity/atlas d0cead1, #237)
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

vision-fidelity on this PR: the "geometry failures" come from the benchmark's model, not from the engine.

Run on T = d7601f1c5, with the client pinned to the default binary so only the server varies (out/stacktop2-d7601f1c5/vf-T2-human.log). On P = #233 it's 14/14. On T, every rung the server answered matches transformers' smart_resize for this checkpoint:

  • Ties round to even (Python round): 336 → 320, 720 → 704. The benchmark's snap uses half-away-from-zero (336 → 352).
  • shortest_edge = 65536 in the checkpoint's preprocessor_config.json, so 224² and 8×8 are scaled up to 256² (64 tokens).

The uniform −15 on every rung comes from the calibration fixture: it's 224², whose expectation becomes 64 instead of 49. The two "integrity" deltas, 36 against an expected 72, are the 224² → 336² difference under the same rule (100 − 64).

fixture benchmark (old model) served by T reference smart_resize
224² 49 64 64
336² 121 100 100
1280×720 920 880 880
8×8 1 64 64
others n n n

The benchmark's own comment anticipated this: "if the engine ever switches to half-even this model must move with it". This PR now carries that change as a separate commit: geometry.rs models the reference smart_resize (half-to-even rounding plus the shortest_edge/longest_edge bounds), and its tests pin the new numbers. I checked every expected value against a Python reimplementation of smart_resize.

Behaviour change to be aware of: after this PR, images whose side divided by 32 ends in .5, and images under 65536 px, get the same token grid the HF processor gives them. Main gives them a grid one unit off, or doesn't scale them up. The in-budget identity check (T vs P on the same images) shows exactly that: 1280×720 changes, while 640×480, 1024², red/blue, EXIF-6 and the 4 s clip don't.

cc @tbraun96 (author of the geometry model).

AzeezIsh added a commit that referenced this pull request Oct 29, 2026
…eiling + reserve/reconcile + decode_gated + FfmpegPolicy::max_total_decoded_pixels (Enntity/atlas d0cead1, #237)
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
…n rounding, shortest_edge floor) that #237 moved the engine to
@AzeezIsh AzeezIsh closed this Oct 29, 2026
@AzeezIsh AzeezIsh reopened this Oct 29, 2026
@AzeezIsh
AzeezIsh force-pushed the stack/vision-admission branch 2 times, most recently from 11e7dd2 to 0a313f9 Compare October 29, 2026 11:09
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
…eiling + reserve/reconcile + decode_gated + FfmpegPolicy::max_total_decoded_pixels (Enntity/atlas d0cead1, #237)
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
…n rounding, shortest_edge floor) that #237 moved the engine to
…be modules

Ports Enntity/atlas 83389c7 9f65625 8f0a89b aa494cc d85c88d (vision
preprocess revision, probe + qwen/glm sizing, video row ceiling, startup
parity) on top of stack/vision-admission.

Output changes vs parent:
- Native decoder allocation is capped at 640 MiB (DECODE_MAX_ALLOC); decodes
  over 192 MiB (DECODE_LARGE) run two at a time behind decode_gated.
- EXIF orientation is applied: header-declared sizes are swapped when the
  orientation flag rotates 90/270 degrees.
- Header probing (sniff_format + limited_reader + check_decode_size) rejects
  malformed images and >16384px side declarations before pixel allocation.
- Video media hold a conservative qwen_video_rows_ceiling reservation
  (reserve_video) reconciled to actual rows after decode.
- startup_parity gains a 'vision max pixels' entry (aa494cc): ranks with
  different resolved encoder windows fail at boot, not inside a collective.
- VisionConfig gains token_budgets/min_pixels/video_pixels; GLM sizing runs
  through glm_pixel_budget/glm_target_size (token-budget bounded).

Co-authored-by: Enntity/atlas contributors
…eiling + reserve/reconcile + decode_gated + FfmpegPolicy::max_total_decoded_pixels (Enntity/atlas d0cead1, #237)
…test with the admission tests (500-LoC cap, no logic edits)
…n rounding, shortest_edge floor) that #237 moved the engine to
…t fit request_rows so the spent-budget 503 fires)
@AzeezIsh
AzeezIsh changed the base branch from stack/vision-admission to main October 29, 2026 12:18
@AzeezIsh
AzeezIsh marked this pull request as ready for review October 29, 2026 12:27
@AzeezIsh
AzeezIsh merged commit 8e50375 into main Oct 29, 2026
21 of 22 checks passed
AzeezIsh added a commit that referenced this pull request Oct 29, 2026
…837e76/8fe99bfe)

Pair-gated (#220): with --video-max-pixels the 10-min and 60-min clips are served within the encoder window (16494/16442 prompt tokens) where #237 alone refuses them; the 4 s clip text is identical. Opt-in. CI green except the PR benchmark gate.
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.

1 participant