Repository navigation
fix(probe_data): support zero, fractional, and seeded weights in dataset blending - #397
Merged
Merged
Conversation
msoedov
approved these changes
Nov 26, 2026
msoedov
left a comment
Owner
There was a problem hiding this comment.
@brixtonpham thx for the patch! LGTM
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.
What this changes
Refs #76.
Fixes weighted dataset blending in
UnifiedDatasetLoader._merge_weighted(agentic_security/probe_data/unified_loader.py), whererepeat_count = max(1, int(weight))previously includedweight == 0.0datasets and collapsed all fractional weights in(0.0, 2.0)to1:weight == 0sources inload_all()and_merge_weighted()(returningunified_emptywhen all sources are excluded or empty).NaN, and infinite weights inInputSourceConfig.weight(allow_inf_nan=False) and_merge_weighted().target = max(1, round(prompt_count * weight))(full copies plus remainder sampling) and scalestokensandapprox_costproportionally, preserving existing integer-weight behavior.seed: int | None = NoneonUnifiedDatasetLoaderand_merge_weightedfor deterministic fractional sampling and shuffled interleaving.How it was tested
pytest tests/unit/probe_data/test_unified_loader.py -v: 21 passed (6 new tests covering zero-weight exclusion, fractional<1.0and>1.0blending + token scaling, seeded determinism/shuffling, and negative/NaN/infrejection).pytest . -qwith placeholderOPENAI_API_KEY): 578 passed, 4 skipped, 594 deselected..pre-commit-config.yaml(black --check,flake8,pyupgrade --py314-plus,pycln --check,codespell,poetry check --lock): all clean.Checklist
pytestpasses and new behaviour has a test. Tests don't call paid APIs.pre-commit run --all-filesis clean.UnifiedDatasetLoader.__init__and_merge_weighted.)