Repository navigation
Skip sequence checks for plain object annotations - #4341
Draft
markstuart-oai wants to merge 1 commit into
Draft
markstuart-oai wants to merge 1 commit into
markstuart-oai wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Changes being requested
Skipping three checks on plain
objectannotations has been saving about 2.25 ms on a 128-row inline eval in both clients. With eight fields per row, each client has been making 9,216 unnecessary checks for a list, iterable or sequence annotation.I’ve been skipping the three checks only for the exact built-in
objectannotation. Both paths have been continuing to dump models and apply field formats. The test has been checking date formatting and list values in both clients. Neither path has been caching caller data.Additional context & links
I’ve been timing the public
client.evals.runs.createcall through the returned typed result with an in-memory HTTPX2 transport on Linux and Python 3.12. I’ve been comparing this patch alone againstf2b2399, without contacting a server.I’ve been rotating the order across 16 blocks on one CPU, keeping 40 calls per case per process after six warmups and resampling whole blocks. The outgoing bytes and serialized results have been matching between revisions. With just two fields per row, the 128-row saving has been ranging from 11% to 15% across Python 3.10–3.14, sync and async.
On a two-request agent task with one tool and mock HTTP, I haven’t been seeing a reliable speedup. I’ve been comparing the patch to two separate launches of main using the same import path in 24 blocks. The paired changes have been measuring −0.30% [−0.51, +0.16] and −0.45% [−0.71, +0.81].
In the Agents SDK’s 83 offline comparisons with Codex off, I’ve been checking the patch against the same Agents revision with unmodified client main. The upper end of the 95% interval has been staying below a 3% slowdown for 82 of 83 medians and 39 of 47 p95 estimates. Only the four HTTP workloads have been reaching this branch. None of those four has been showing a clear median speedup. The eval batch above has been exercising many more plain object fields.
I’ve been using 32 paired processes, with 64 fresh pairs when the protocol calls for confirmation, and 5,000 resamples of whole pairs for each interval. I haven’t been adjusting across rows. Four median intervals have been showing small increases (0.38–1.04%). All four have been including zero or favoring the patch in separate 128-pair checks. Both SQLite writes have been staying within 3% in 256 new pairs. In the 16-call tool test, throughput has been changing by +0.20% [−0.79, +0.68] in 128 pairs.
The 32-concurrent diagnostic has been showing a p95 increase of +1.70% [+0.48, +3.95] in 128 pairs. In 512 fresh pairs the change has been going the other way, −1.15% [−1.92, −0.24]. A second copy of main has been measuring +1.12% [+0.28, +2.30] against main. In two checks of all 1,024 calls, the diagnostic hasn’t been entering the changed converter. I haven’t been attributing either direction to the patch.
For the four-turn case with 1,024 items, even two copies of main have been differing by +3.12% [−2.65, +9.84] at p95. I haven’t been counting the patch’s −8.63% as a benefit.
I’ve also been checking the mean of three requests with large tool outputs. In the first 32 pairs, the change has been measuring +2.70% [+0.73, +3.86] without streaming and +3.51% [+0.51, +4.97] with streaming. In the separate 64 confirmation pairs the changes have been measuring −0.69% [−1.31, −0.05] and +0.11% [−0.44, +0.97]. In 128 new pairs, the changes have been measuring −0.24% [−1.08, +0.84] and −0.51% [−2.79, +0.79]. The two copies of main have been differing by −0.25% [−1.67, +0.51] and −0.23% [−0.92, +0.17] in that last check.
In a separate ten-block test of a long-lived process, I’ve been seeing +14.45% [+0.46, +26.72] from launch to the first answer on the patch alone. In a 48-block launch check, I’ve been loading main twice and the patch once from the same absolute path. Both launches of main have been using the same primed files, with separate files for the patch. The changes have been measuring +1.43% [−1.67, +5.11] and −0.55% [−3.02, +2.71] against those two launches of main. I haven’t been reproducing a 14% change, though those measurements have been leaving room for smaller differences.
Longer check of the one-tool task against two launches of main
I’ve been sending 3,300 changing tasks per process. In the 24 planned blocks I haven’t been seeing a consistent change in launch or in the last 200 calls against both launches of main. The two references have been loading the same source and primed bytecode. The launch intervals have still been allowing substantial slowdowns. I’ve been showing the paired percentage changes and 95% intervals separately.
On one of the four CPUs I’ve been waiting up to 15 minutes instead of two for the same 80% idle check after a timeout between groups. I’ve been keeping the same CPU, order and every original observation. The 18 uninterrupted blocks have been showing the subset on the other three CPUs. The six extra blocks have been serving as a separate check on a fifth CPU. I haven’t been pooling those results.
Separate follow-ups, with a duplicate main as a control
concurrent5 2x128retained_2048time_1024_4096time_2_256tools4warmdiag_32handoffs_12history120mixed_6retained_2048schemas_24tail 4x1024warmI’ve been comparing 41,730 paired cases near Python’s recursion limit across 3.10–3.14. The two versions have been agreeing on successes, failures, exception details and all 4,428 transmitted request bodies.
On Python 3.12, the full client suites have been passing 21,626 tests with Pydantic 2 (205 skipped) and 21,610 with Pydantic 1 (221 skipped, repository v1 exclusions). With Agents at
cecd9eband this client patch, the full Agents suite has been passing 12,874 tests (30 skipped). Formatting, Ruff, ty, import checks and package checks have been passing. With the host’s package mirror,uv lock --checkhas been asking for a refresh on both versions. With the index named in the lockfile,uv lock --check --offline --default-index https://pypi.org/simplehas been passing on both without downloading anything or changing any file. One of ten Node tooling tests has been failing on both versions when the installer tries to fetch JSR metadata. The client suites have been using the pinned local test server.One-process reproduction for the 128-row sync case
All 83 paired medians
cold_normalcold_streamids_17x32769ids_17x32769_streamids_3x8193ids_3x8193_streamreuse_normalreuse_streamtyped_3x257typed_3x257_streamadd_toolbuild_dict_12build_omitted_12build_typed_12con1con32con8diag_32h128handoffs_0handoffs_12history120history2000history720mixed_6nested67_stream16repeat_8retained_16384retained_2048run_dict_6run_omitted_6run_typed_6schemas_24server_1server_1024server_128server_512single_0single_12streamsustained_32time_1024_4096time_16384_2time_2048_2time_2_256time_4096_8tools1tools16tools4warmbatch-compare 1x1024batch-compare 2x32bulk-live 12x64bulk-live 1x1024bulk-live 1x2048bulk-live 1x256combo5 4x1024combo5 8x128concurrent5 2x128first-final 1x0first-mcp 1x0lists-final 1x1024lists-final 8x8192provider-final 1x2048provider-final 1x4096quote-final 1x1quote-final 1x64quote-final 8x16quote-final 8x256quote-final 8x64shape-local normal 12x96shape-local stream 12x96shape-local stream 4x12shape-local stream 8x0tail 4x1024values-final ids 1x1values-final ids 8x8192values-final last 4x512values-final records 8x512values-final typed 16x1024values-final typed 4x128warm-control 1x0warm-control 1x4096All 47 p95 estimates, including separate cohorts
add_toolbuild_dict_12build_omitted_12build_typed_12con1con32con8diag_32h128handoffs_0handoffs_12history120history2000history720mixed_6repeat_8retained_16384retained_2048run_dict_6run_omitted_6run_typed_6schemas_24server_1single_0single_12streamsustained_32time_16384_2time_2048_2time_4096_8tools1tools16tools4warmbatch-compare 2x32bulk-live 12x64bulk-live 1x256quote-final 1x1quote-final 1x64quote-final 8x16quote-final 8x256quote-final 8x64tail 4x1024values-final ids 1x1warm-control 1x0warm-control 1x4096tail 4x1024