Specializer raw-dict output mode — output='dict' opt-in, python_dict gap closed to 0.74-1.11x (TASK-51) - #37
Merged
Conversation
… the python_dict gap (TASK-51) The marshaller already builds the per-row dict the model would consume; dict mode returns it and skips model construction. Typed default is untouched; mutually exclusive with output_model; all four emit paths honor it (marshaller / generic / reentrant / constant, the latter copying per call). Parity gate extended: dict == typed field-for-field before any timing. Bench gains the spec_dict row: 25-35% off the typed path at n=1024, and the handcrafted python_dict floor shrinks from the standing 1.3-2x caveat to 0.74-1.11x — spec_dict WINS house_prices; what remains is input marshalling, not output. TASK-50 Done-flip and TASK-51 ride this branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ahrzb
approved these changes
Jul 26, 2026
ahrzb
approved these changes
Jul 26, 2026
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.
Raw-dict output mode —
output="dict"opt-in closes the python_dict gap (TASK-51)The serving report's standing caveat was that a handcrafted server returning plain dicts beat the specializer's typed output by 1.3–2×, because pydantic model construction dominated our cost. This ships the opt-in lever:
Design
dict == typedbefore any timing.output="dict"is mutually exclusive with a suppliedoutput_model; unknown values reject; anoutputgetter exposes the mode.Measured (n=1024 p50, 4 Kaggle scenarios)
python_dictfloor: 0.74–1.11× —spec_dictoutright wins house_prices and sits within ~35% elsewhere, down from the 1.3–2× caveat. The remaining gap is input marshalling, not output.Gate green (759 passed + 13 xfail); 6 new tests + the parity-gate extension + a
spec_dictbench engine row. TASK-50's Done-flip rides this branch.🤖 Generated with Claude Code