Repository navigation
fix: preserve agentic delay bounds after context scaling - #1613
Wenyan0315 wants to merge 1 commit into
Conversation
Signed-off-by: Wenyan0315 <206175637+Wenyan0315@users.noreply.github.com>
Try out this PRQuick install: pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@4f24baacf3fb1465a9fad99a2492a75ba6e382edRecommended with virtual environment (using uv): uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@4f24baacf3fb1465a9fad99a2492a75ba6e382edLast updated for commit: |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Delay configuration and sampling src/aiperf/dataset/agentic_code_gen/configs/spec.json, src/aiperf/dataset/agentic_code_gen/models.py, src/aiperf/dataset/agentic_code_gen/distributions.py, tests/unit/dataset/agentic_code_gen/test_distributions.py |
MixtureDelayConfig adds the enabled-by-default context_scaling setting. sample_mixture_delay accepts a keyword-only delay_scale and rejects values outside (0, 1]. Tests cover scaling, component minima, a zero global maximum, and invalid scales. |
Synthesis, reporting, and validation src/aiperf/dataset/agentic_code_gen/session_synthesizer.py, src/aiperf/dataset/agentic_code_gen/reporting/metrics.py, tests/unit/dataset/agentic_code_gen/test_session_synthesizer.py, tests/unit/dataset/agentic_code_gen/test_roundtrip.py, docs/tutorials/agentic-code-generator.md |
Session synthesis passes a context-dependent scale when enabled. The quality summary records the setting. Tests cover scaled and unscaled delays, bound precedence, and configuration roundtrips. The tutorial documents the scaling formula, delay bounds, and reported statistics. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Merge Risk: 
Minimal · up to 4f24b
-
The configured maximum still takes precedence over component minimums. No identified delay-scaling issue remains to resolve before merge.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 7 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
I’m a rabbit with a config to share,
Delays now scale as context grows there.
Component floors still enter the play,
And global caps can have their say.
Tests trace the settings end to end,
Then off through the docs I hop, my friend.
Comment @coderabbitai help to get the list of available commands.
| minimums = np.where( | ||
| is_agentic, config.agentic_delay.min or 0.0, config.human_delay.min or 0.0 | ||
| ) | ||
| samples = np.maximum(samples, minimums) |
There was a problem hiding this comment.
This re-applies the component min by clamping, which is inconsistent with how min is defined on the model:
aiperf/src/aiperf/dataset/agentic_code_gen/models.py
Lines 94 to 96 in 4f24baa
LognormalParams.min is documented as "Hard lower bound (rejection sampled)", and sample_lognormal honors that by redrawing out-of-range values (L63–78 in this file). Here the same field is enforced with np.maximum, so after scaling, every value below the floor lands exactly on it rather than being redrawn.
This distorts the distribution. For example, with a human component of mean 450 s / median 84 s / min 30 s / max 1800 s, about 51% of human delays come out at exactly 30 s at full context (28% at scale 0.4). The new test ({900.0, 4500.0}) uses σ = 0 components, so it confirms the clamp happens but can’t show its effect on a spread-out distribution.
Could we pick one behavior and apply it consistently, from the individual lognormals through the mixture?
- Redraw: resample, scale, re-check, falling back to the clamp after N attempts as
sample_lognormalalready does, or - Clamp: keep this, but update the
mindescription (and the tutorial's "enforced again") to say it's rejection sampled before scaling and clamped after.
Context scaling can push generated inter-turn delays below the selected component's configured minimum. With the bundled default config plus agentic
min=1000and humanmin=5000, seed 42 and 1,500 sessions produced 6,174 of 22,135 later-turn delays below 1,000 ms on main1558551(minimum 241.745 ms). This change reduces that count to zero, with a minimum of 1,000 ms.Addresses #1603. Kept as a draft for feedback on the compatibility choice below; analytic aggregate delay targets remain outside this focused fix.
Behavior
inter_turn_delay.context_scaling, defaulting to true to preserve existing seeded workloads. Setting it to false disables the context multiplier.The issue proposes default-off. This PR uses default-on to avoid silently changing existing benchmark workloads; maintainer feedback on that choice is welcome.
quality.jsonstill reports null aggregate delay targets: component means/medians are not valid final targets after mixture selection, truncation, and context scaling. Related #1188 changes distribution support; this PR keeps the existing distribution families.Validation
git diff --checkpass.AI-assisted investigation, implementation, and validation on behalf of Wenyan0315.
Summary by CodeRabbit
New Features
Documentation