fix(v1): reject invalid sampled logprobs#2121
Draft
EazyReal wants to merge 1 commit into
Draft
Conversation
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.
Description
The v1 renderer path currently persists completion token IDs and sampled logprobs independently through
TurnTokens.model_construct. If the logprob list is short,Branch.logprobssilently fills the missing sampled positions with0.0; if it is long, it truncates it.At a sampled position,
0.0asserts probability 1.0. Repairing malformed evidence this way changes the behavior-policy signal used for training.This change:
ProviderError;0.0only for genuinely unsampled positions.It deliberately does not tighten the persisted Pydantic field types, so historical
0/1masks keep their existing loading behavior.Type of Change
Malformed sampled evidence that previously flowed into training now fails closed.
Testing
uv run pytest tests/ -qlocally (provider E2E cases requiringPRIME_API_KEYskipped).Per
AGENTS.md, no unit tests are added. A temporary adversarial probe covered aligned and interleaved masks; short, long, missing, non-list, non-finite, Boolean, and string logprobs; mask/token mismatches; andProviderErrortranslation.Additional checks:
uv run pre-commit run --all-filesuv run ruff check .Checklist
Draft blocker
Released Renderers
0.1.8can normalize missing evidence to an apparently aligned0.0before Verifiers receives it, losing both missing-versus-real-zero provenance and per-entry token identity.Renderers #108 is merged and adds strict wire validation plus
MalformedGenerateResponseError, but it is currently available only in the0.1.9.dev5prerelease. Before this PR is marked ready, the next stable Renderers release should be available; this branch can then translate that exact exception toProviderErrorand advance the dependency floor and lock without catching unrelatedValueErrorfailures.