feat: add LLM Opinion Dynamics example using mesa-llm#360
Open
abhinavk0220 wants to merge 4 commits intomesa:mainfrom
Open
feat: add LLM Opinion Dynamics example using mesa-llm#360abhinavk0220 wants to merge 4 commits intomesa:mainfrom
abhinavk0220 wants to merge 4 commits intomesa:mainfrom
Conversation
…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.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
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.
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_weisbuchexample models opinion change usinga 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.py—OpinionAgentextendingLLMAgentwith CoT reasoningmodel.py—LLMOpinionDynamicsModelon anOrthogonalMooreGridapp.py— SolaraViz with opinion trajectories, mean, and variance plotsREADME.md— explanation with comparison table vs Deffuant-WeisbuchHow 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
from llm_opinion_dynamics.model import LLMOpinionDynamicsModelCloses #[issue number if any]
Related: mesa/mesa-llm#153