Skip to content

cua-s1: accelerate resident screenshot questions with matched prefix Graphs - #183

Open
Levius-Fubuki wants to merge 6 commits into
InferMatrixLab:mainfrom
Levius-Fubuki:codex/cua-device-language-graph
Open

Levius-Fubuki wants to merge 6 commits into
InferMatrixLab:mainfrom
Levius-Fubuki:codex/cua-device-language-graph

Conversation

@Levius-Fubuki

@Levius-Fubuki Levius-Fubuki commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Repeated questions about one screenshot repeat most language computation. This update combines GPU-resident features, ordinary-compatible request-local prefix reuse, and window Graphs. On the frozen 12-screenshot HTTP workload, mean latency falls 249.244 → 148.656 ms (40.4%), with exact ordinary outputs; sampled process maximum increases 438 MiB.

Dependency/scope: PR #184's foundation is now merged into main; this PR adds resident windows and Graph integration on top. The large gain includes prefix computation reuse; window Graphs alone add a measured 1.4% mean reduction over prefix eager on this real workload. All controls remain opt-in. This PR is ready for review and remains unmerged.

Required human contributor answers

The contributor explicitly reviewed and confirmed these answers and PR necessity in the implementation task on 2026-10-25.

  1. What outcome are you trying to achieve?

    Enable language CUDA Graphs when Cua-S1 vision features stay on the GPU, preserving screenshot preparation, prompts, probabilities and decision semantics. The goal is lower repeated-decision latency where measurements justify it; capture cost and fallback remain explicit.

  2. What is the highest-leverage variable for that outcome?

    CPU operator submission and kernel-launch overhead in language forward. The primary outcome is warmed complete-request p50/p95, with first-capture cost and GPU memory reported separately. Correct current-input execution is a prerequisite.

  3. How will this work move that variable rather than create busywork?

    Combine the existing resident-feature path and existing multimodal Graph path by staging current input into owned scratch before replay. Use matched eager/Graph evidence; keep the opt-in and do not claim every shape improves.

  4. Who is the customer or user, and what do they actually need?

    GUI/browser-agent operators serving Cua-S1 and native-worker maintainers. They need predictable screenshot decisions with unchanged API behavior, current data after screenshot/shape changes, safe cache retirement and recoverable capture failure, backed by focused tests and reproducible evidence.

After answering the four questions: is a PR needed at all to achieve this outcome?

Yes. The contributor confirmed this scope and requested submission after validation. It requires the shared execution change, root regressions and recipe updates.

For a bug fix: link actual observed failure evidence.

This is a capability extension. The new GPU test fails on main because resident execution makes no capture, then passes here. The exact red/green logs are in the qualification package below.

Purpose

Original #183 enables ordinary language Graphs over resident vision features. The follow-on routes matched-prefix execution through one host/device planner, copying current checked device rows into owned language scratch outside capture. Full-prompt GEMM descriptors must match for every question and support each window; incompatible/no-prefix/single-question requests retain ordinary independent execution.

Window cache keys include begin/end, both prefix source and capture destination allocation identities, and GEMM handle. Entries retain both allocations until retirement, bounded at 128. Scratch growth, FIFO eviction and matched-workspace retirement synchronize before freeing addresses. Recording failure retains the warmed eager result, disables language Graphs and clears caches. No schema, scheduler, prompt, precision or default change. No cross-request screenshot/answer cache.

Test plan and provenance

Conflict-resolution update (2026-10-27): merged main through 32346fcb2b88a10ffa7c8d456ae74d0543972d03; updated head c4f68282b9d33ae6e2f1adefe01fd2f6843e0dc5. Preserved both the startup-symbol guard and resident window-Graph lifecycle logic; resolved the recipe/test whitespace conflicts. Local macOS verification: workspace Rust tests 379 passed / 0 failed / 94 ignored, strict all-target Clippy, release build with omni-laya/serve, formatting, strict MkDocs, CUDA contract plus 68 checker / 26 backend tests, and 135 Vela tests passed. The final Vela merge changes no Rust sources or Cua/Qwen fixtures. GPU/HTTP measurements and CI links below are historical qualification at 48dfc6ffa; no new CUDA execution or performance measurement is claimed. GitHub reports the updated PR conflict-free; new CI runs are separate from the historical results.

  • Review base/current main 28f4957a6; original PRbase 05075d0f; previous cua-s1: accelerate resident screenshot questions with matched prefix Graphs #183 911faa0d22753be56c8bf513a23741dfa6d00593; final head 48dfc6ffa42aaa4c6c72a077f70b1ecc6c870b46. Main’s shared-executor refactor is integrated, with Cua retaining its ordinary arithmetic and optional text packing disabled. Conflicts are resolved; current PR is mergeable.
  • RTX 4090 / SM8.9 / CUDA 13.0 / driver 595.71.05 / ABI9 / Rust1.98. Pinned original BF16 vision, FP32 vision adapter and merged BF16 language; 23 artifact-file hashes verified. No tolerance change.
  • Exact frozen source qualification: all 783 committed files at final head match the candidate archive byte-for-byte, verified before and after execution. The 143 production/build source files and relevant tests match. The only build-tree change is the documented public-API example harness registration; no inference patch or tolerance change. Source/archive/worker/library/model hashes are included.
  • Five native public-API profiles each run 80 layouts twice plus 32 single extracts: 960 regular records, exact raw logits, complete responses, IDs/T-H-W and grids. Also 15 malformed-input rejections and 10 valid before/after recovery executions. Host/device and Graph/eager comparisons pass; individual answers match multi-question extraction.
  • 54 actual GPU test executions:27 kernels,7 language Graph,2 device-boundary,4 Cua prefix tests at each visionGraph0/1, plus2 canonical Qwen prefix and3 readout tests at each languageGraph0/1. Covers current data, producer release, simultaneous continue/capture destinations, scratch growth, actual recording failure/recovery,129th-entry FIFO release, live matched-workspace retirement, recapture/replay and positive resident admission.
  • Local: 376 passed /0 failed /92 default ignored, workspace all-target strict Clippy, workspace release with omni-laya/serve, format, strict MkDocs, CUDA contract plus68checker/26backend tests. Ignored tests are not device passes.

Full HTTP result

Clock: native /v1/systemone POST through complete JSON/schema validation; concurrency1. Each suite visits O/E/G/G/E/O, four shuffled timed traversals per worker. Exclude one growth traversal, one stabilization traversal and5warmups per visit. 480 formal timed,300excluded and135feasibility calls remain separate. Timed regions contain no recapture/failure or foreign GPU process. p50=median,p95=pooled nearest rank; process GPU memory sampled about100ms, not allocator-exact peak.

O=original183 resident Graph; E=resident matched prefix eager; G=resident matched prefix Graph. VisionGraph1 for all. Cache synthetic8/1024MiB, real16/2048MiB: workload controls, not new defaults.

Workload / mode Mean ms p50 ms p95 ms Sampled maximum MiB
8 synthetic /64 calls / O 130.086 117.070 270.064 10202
8 synthetic /64 calls / E 106.349 102.571 169.042 10448
8 synthetic /64 calls / G 104.981 100.919 171.937 10538
12 real /96 calls / O 249.244 258.318 263.885 10256
12 real /96 calls / E 150.812 151.246 157.745 10606
12 real /96 calls / G 148.656 149.528 154.843 10694

G/O real mean/p95 reductions 40.4%/41.3%; descriptive paired complete-round mean bootstrap95% 40.2%–40.5%, describing this repeated workload only. Synthetic mean/p95 reductions 19.3%/36.3%. The small case-1 regresses4.2%; G synthetic p95 is1.7% worse than E. All per-case values are retained.

Cold costs remain separate: real worker readiness20.07–21.07s; initial growth traversal mean milliseconds across the two visits: O253.2/253.8; E157.5/156.7; G159.5/159.8; no cold-start speedup claimed. Matched workspaces are bounded at16×32MiB, window Graphs at128 plus retained prefix allocations and vision budgets. Formal real matched profiles show48 admissions/visit and0 descriptor fallbacks; direct single-question/no-prefix fallback is separate and not counted by the descriptor trace.

Real quality is unchanged 119/192 correlated choice permutations over48screenshots, not official ScreenSpot accuracy or general GUI task success. Existing ordinary native-vs-FP32-reference limitations remain. No arbitrary-workload, other-hardware, throughput or concurrency claim.

Demo / evidence

Qualification release contains the sealed raw archive, portable audit, per-case table, protocol/reproduction, source/build/model identities, and shutdown verification. Public delivery cua183-verified-raw-20261026.tar.xz SHA256 e0bda4602cf48484ef41381b9dfe3d54a93daef9b6d00b8ade05ebcf5d29006c contains both raw evidence directories with unchanged per-file inventories. The local original integrated gzipcontainer SHA256 is e7801ab180c331a950f22242339404b43ac39ec518b9a0131bd4c6cfccfbdac5; DELIVERY.json maps the packaging change. Local verification checks all193file hashes, all783source files, measured executable/library bindings and raw-data recomputation. The pre-main c764 archive (SHA256e2cf87494c703f542e8acadc91616a5017ee6414f0acc764487a18b58fa22121,219files) is retained as its unchanged raw-directory payload alongside it; the recipe table records that historical measurement, while the table above is the fresh integrated result. Original screenshot pixels and credentials are omitted. Video:N/A; actual API measurements are retained.

Historical initial/follow-up Graph evidence remains unchanged, including its original small/no general gain finding; it is not reused as evidence for this new implementation.

Platform shutdown has been acknowledged after verified local copy; two fresh SSH connections failed. An endpoint-free shutdown receipt is published. Exact-head CI and Docs passed; deployment is intentionally skipped for this PR.

Self-review

Full diff reviewed, independent ownership/admission findings resolved and covered. 1022 authored-code /1193 total changed lines against main at 32346fcb2. Shared foundation is from #184; new orchestration stays in Cua/Qwen Rust, device operators in CUDA, tests under root tests/, one-off evidence external. Agent self-review and evidence verification are complete; the human checklist remains unchecked.

  • I have reviewed the full diff and addressed the issues I found.
  • I have checked that the change follows the project's architecture and stays focused on the stated purpose.
  • I have run the checks appropriate to this change and reported commands, results, and anything I could not verify above.
  • I have checked that the PR description, documentation, and any accuracy or performance claims match the implementation and available evidence.

@Levius-Fubuki Levius-Fubuki changed the title cua-s1: replay language Graphs with GPU-resident vision features cua-s1: accelerate resident screenshot questions with matched prefix Graphs Oct 26, 2026
@Levius-Fubuki
Levius-Fubuki marked this pull request as ready for review October 26, 2026 14:03
Copilot AI balanced review requested due to automatic review settings October 26, 2026 14:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@MrDongsls

Copy link
Copy Markdown
Collaborator

Reviewed at 48dfc6ff. Some findings:

  • P3: omnijev's readout_window path picks up window-Graph behavior under CUA_S1_GRAPH=1 — no direct test, no body disclosure.

Minor:

  • Window-Graph entries retain prefix allocations via Arc until retirement; the residency ceiling is structural.
  • A repo doc still says "PR184" without a number.
  • Matched's "identical to ordinary output" rests on per-hardware row invariance (author-disclosed caveat).

Since 911faa0d: the #184 cross-reference is numbered, the overlap dissolved into true shared commits, and an exact-head GPU evidence release now exists (author-run; no local GPU to reproduce).

Copy link
Copy Markdown
Collaborator Author

@psv666 @MrDongsls The merge conflicts are resolved. Could you please review this PR when you have a chance? Thanks!

This branch has not been deployed

No deployments
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.

3 participants