Skip to content

feat: add LLM Opinion Dynamics example using mesa-llm#360

Open
abhinavk0220 wants to merge 4 commits intomesa:mainfrom
abhinavk0220:add/llm-opinion-dynamics
Open

feat: add LLM Opinion Dynamics example using mesa-llm#360
abhinavk0220 wants to merge 4 commits intomesa:mainfrom
abhinavk0220:add/llm-opinion-dynamics

Conversation

@abhinavk0220
Copy link

Summary

Adds a new example demonstrating LLM-powered opinion dynamics, where
agents debate a topic using natural language reasoning instead of
classical mathematical rules.

Motivation

The existing deffuant_weisbuch example models opinion change using
a fixed convergence parameter (μ). This example shows what becomes
possible when agents use an LLM to genuinely reason about their
neighbors' arguments — producing emergent consensus or polarization
that no hardcoded rule could replicate.

What's included

  • agent.pyOpinionAgent extending LLMAgent with CoT reasoning
  • model.pyLLMOpinionDynamicsModel on an OrthogonalMooreGrid
  • app.py — SolaraViz with opinion trajectories, mean, and variance plots
  • README.md — explanation with comparison table vs Deffuant-Weisbuch

How it works

Each step, agents observe their Moore neighborhood, construct a prompt
summarizing neighbor opinions, and let the LLM decide whether to update
their opinion score (0-10). The topic is fully configurable.

Testing

  • Import check passes: from llm_opinion_dynamics.model import LLMOpinionDynamicsModel
  • Requires a Gemini or OpenAI API key to run the full simulation

Closes #[issue number if any]

Related: mesa/mesa-llm#153

abhinavKumar0206 and others added 4 commits March 6, 2026 09:33
…le model demonstrating LLM-powered opinion dynamics,where agents debate a topic using natural language reasoning insteadof classical mathematical convergence rules (cf. Deffuant-Weisbuch).Each agent:- Holds an opinion score (0-10) on a configurable debate topic- Observes neighboring agents' opinions each step- Uses CoT reasoning via LLM to decide whether to update its opinion- Produces emergent consensus or polarization from genuine reasoningVisualization includes opinion trajectory plot, mean opinion, andvariance over time via SolaraViz.Depends on mesa-llm for LLMAgent and CoTReasoning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant