Skip to content

fix: Fix prefix synthesis error with text_input trace#670

Merged
lkomali merged 4 commits intomainfrom
lkomali/fix-error-in-prefix-synthesis-tutorial
Feb 11, 2026
Merged

fix: Fix prefix synthesis error with text_input trace#670
lkomali merged 4 commits intomainfrom
lkomali/fix-error-in-prefix-synthesis-tutorial

Conversation

@lkomali
Copy link
Copy Markdown
Contributor

@lkomali lkomali commented Feb 11, 2026

Synthesizer is adding input_length for any trace if not provided.
This causes an error if text_input is provided in the trace because only one of the two fields should be provided in mooncake format.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed an issue where synthesis operations could unintentionally modify input content length for traces using text_input fields.
  • Tests

    • Added integration test for text_input trace handling with synthesis speedup, validating request counts and output integrity.
    • Added unit test ensuring text_input content is preserved during synthesis operations.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 11, 2026

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@79e5bdde4ea6b87dfb2485830ad81c096f961538

Recommended 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@79e5bdde4ea6b87dfb2485830ad81c096f961538

Last updated for commit: 79e5bddBrowse code

@github-actions github-actions Bot added the fix label Feb 11, 2026
@lkomali lkomali force-pushed the lkomali/fix-error-in-prefix-synthesis-tutorial branch from 0b4ae0f to 9a83ea6 Compare February 11, 2026 17:39
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 11, 2026

Warning

Rate limit exceeded

@lkomali has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

The trace synthesis logic now conditionally assigns input_length only for traces without text_input, preventing Mooncake validation conflicts. Supporting tests verify this behavior through integration testing with text_input traces and speedup, plus unit test confirmation of text_input preservation.

Changes

Cohort / File(s) Summary
Synthesizer Logic Update
src/aiperf/dataset/synthesis/synthesizer.py
Conditional guard added to assign input_length only when text_input is absent, preventing validation conflicts. Guard avoids modifying traces that already use text_input.
Test Coverage
tests/integration/test_mooncake_trace.py, tests/unit/dataset/synthesis/test_synthesizer.py
Integration test validates Mooncake traces with text_input and synthesis speedup ratio applied. Unit test confirms text_input preservation and input_length exclusion in synthesis output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A trace with text_input came hopping by,
No need for length—it's standing quite high!
The synthesizer knows when to play,
Leave text_input alone, let speedup have its day!
With tests to confirm, all fuzzy and bright,
The validation conflict is fixed just right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main fix: preventing synthesis errors when processing traces with text_input fields.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lkomali lkomali force-pushed the lkomali/fix-error-in-prefix-synthesis-tutorial branch from 9a83ea6 to bf4696b Compare February 11, 2026 17:43
Signed-off-by: lkomali <lkomali@nvidia.com>
@lkomali lkomali force-pushed the lkomali/fix-error-in-prefix-synthesis-tutorial branch from bf4696b to 8fd6ac9 Compare February 11, 2026 17:46
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@matthewkotila matthewkotila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ajcasagrande
Copy link
Copy Markdown
Contributor

looks good, but please add tests

Copy link
Copy Markdown
Contributor

@debermudez debermudez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. 1 test to cover us for later and this is good to go

lkomali and others added 3 commits February 11, 2026 10:12
@lkomali lkomali merged commit 9ebf0a2 into main Feb 11, 2026
18 checks passed
@lkomali lkomali deleted the lkomali/fix-error-in-prefix-synthesis-tutorial branch February 11, 2026 18:33
lkomali added a commit that referenced this pull request Feb 11, 2026
Signed-off-by: lkomali <lkomali@nvidia.com>
saturley-hall pushed a commit that referenced this pull request Feb 11, 2026
Signed-off-by: lkomali <lkomali@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants