Fix: Critical Performance Regression in Parallel Agent Stepping#264
Open
Fix: Critical Performance Regression in Parallel Agent Stepping#264
Conversation
* fix: handle non-LLM neighbors in _build_observation(mesa#143) Signed-off-by: BhoomiAgrawal12 <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: Ruff formating * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: remove AsyncMock and add coroutine function * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: BhoomiAgrawal12 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: khushiiagrawal <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: khushiiagrawal <[email protected]>
Signed-off-by: khushiiagrawal <[email protected]>
for more information, see https://pre-commit.ci
The readme incorrectly stated to change api_key in app.py. app.py uses load_dotenv() so API key should be set in .env file. Fixes mesa#248
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
Note
Use this template for bug fixes only. For enhancements/new features, use the feature template and get maintainer approval in an issue/discussion before opening a PR.
Pre-PR Checklist
Summary
Fix critical performance regression where parallel agent stepping becomes exponentially slower than sequential execution for large agent counts. This bug makes Mesa-LLM unsuitable for large-scale simulations by causing O(n²) scaling instead of expected O(n) linear scaling.
Bug / Issue
Related Issue: #200
Bug Description:
Root Cause:
Symptoms:
Implementation
Core Changes Made:
mesa_llm/parallel_stepping.py:
tests/test_realistic_benchmark.py:
Key Technical Fixes:
Testing
Test Coverage:
Performance Validation Results:
Key Validation Points:
✅ Parallel time stays flat (~0.7s) regardless of agent count
✅ Sequential time grows linearly (expected behavior)
✅ Linear scaling confirmed (O(n²) → O(n) fix working)
✅ Conservative estimates (200-800ms delays vs asyncio.sleep(0.01))
Additional Notes
Bug Classification: This is a critical bug fix because:
Breaking Changes: None - fully backward compatible
Dependencies:
Performance Impact:
Reviewer Feedback Addressed:
✅ Focused bug fix (not architectural changes)
✅ Realistic validation (conservative benchmark)
✅ Proper testing (comprehensive coverage)