Skip to content

example: add Information Cascade model to benchmark STLTMemory latency#251

Open
ZhehaoZhao423 wants to merge 3 commits intomesa:mainfrom
ZhehaoZhao423:feat-information-cascade
Open

example: add Information Cascade model to benchmark STLTMemory latency#251
ZhehaoZhao423 wants to merge 3 commits intomesa:mainfrom
ZhehaoZhao423:feat-information-cascade

Conversation

@ZhehaoZhao423
Copy link
Copy Markdown

@ZhehaoZhao423 ZhehaoZhao423 commented Mar 20, 2026

Pre-PR Checklist

Approval Link

None yet. This PR is a proactive submission following the creation of Issue #246. I'm opening this now to provide a concrete working implementation for the maintainers to evaluate alongside the feature request.

Summary

This PR introduces a new agent-based model example: Information Cascade (Financial Rumor Mill). It simulates a volatile stock market where LLM-powered quantitative traders make decisions (BUY/SELL/HOLD) based on peer-to-peer rumors and their internal STLTMemory.

Motive

This feature addresses the ongoing performance concerns regarding API latency and event-loop blocking (discussed in #200).

  • Latency Stress Testing: By constraining short_term_capacity=1, this model forces continuous STLTMemory consolidation, providing a reproducible environment to measure synchronous API blocking.
  • Cognitive Dynamics: It serves as a demonstration of "Echo Chamber" effects and information cascading in multi-agent systems.

Implementation

  • Model Architecture: Implemented MarketPanicModel and TraderAgent with custom rumor-broadcasting logic. Used strict system prompting to prevent agents from hallucinating spatial interactions (move_one_step).
  • Performance Profiling: Included run_benchmark.py, a headless script to profile step-execution time.
  • UI Stability: Developed a custom app.py using raw solara reactive components with strict CSS formatting. This approach bypasses the current SolaraViz NoneType initialization conflict, ensuring a robust demonstration even with high-latency LLM calls.
  • Documentation: Integrated the model into the official registry via docs/examples.md.

Usage Examples

To run the performance benchmark (headless):

cd examples/information_cascade
python run_benchmark.py

To launch the visualization:

cd examples/information_cascade
solara run app.py

(Feel free to run the app to see the complete terminal-style CoT logs rendered in the browser!)

Additional Notes

  • Tested locally with pre-commit (Ruff/Black) to ensure strict compliance with project standards.
  • Requires a .env file with a valid DEEPSEEK_API_KEY (or other LiteLLM-compatible keys).

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 54092cac-d7e7-484a-a9f4-b512c6a1087c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can use your project's `pylint` configuration to improve the quality of Python code reviews.

Add a pylint configuration file to your project to customize how CodeRabbit runs pylint.

@wang-boyu wang-boyu added the example Release notes label label Mar 29, 2026
@wang-boyu wang-boyu changed the title feat(examples): add Information Cascade model to benchmark STLTMemory latency example: add Information Cascade model to benchmark STLTMemory latency Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

example Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants