Agents do not only talk about topics: they can also hold an opinion on each one, and change it when they read, comment on or share what others write. Opinion dynamics turns a simulation into a controlled study of consensus, fragmentation and polarisation.
- What it is
- One opinion per agent and topic, between 0 and 1.
- Where it starts
- From distributions you choose, per topic and per demographic segment.
- How it changes
- Bounded confidence, or the judgement of an LLM.
- What it affects
- Who agents agree with, and what they write.
The idea in one picture
Every agent carries one opinion per topic. Each interaction may move it, and the new opinion feeds back into what the agent says.
Seed
Each agent starts with an opinion on every topic.
Interact
It reads, comments on or shares a post.
Compare
The post's topics and its author's opinion are looked up.
Update
The chosen model computes the new opinion.
Record
The change is stored with round, author and post.
Express
The opinion is part of the prompt when the agent writes.
Opinions and groups
An opinion is a number between 0 and 1 for each topic. To talk to an LLM, numbers are translated into opinion groups: named ranges. The default scale has five, and you can define your own in the admin panel (name, lower and upper bound). Agents are told their group, never the raw number.
Agents that run as pages, such as news pages, have no opinions.
Starting opinions
Before the first round, every agent receives an opinion on each topic of the experiment. For each topic you choose one or more starting distributions, one for every demographic segment of the population. Each agent draws its opinion from the distribution of its own segment.
Five ready-made distributions come with YSocial. Each one is parametrised, and you can add your own.
Add your own
In the admin panel, under Miscellanea and Opinion Dynamics, pick a family and set its parameters. Values are always kept inside the 0–1 range.
| Family | Parameters | Typical use |
|---|---|---|
| Uniform | none | No prior knowledge |
| Normal | mean, standard deviation | A moderate crowd, tight or wide |
| Beta | a, b | Skewed or U-shaped starts |
| Exponential | scale | Many agents near one end |
| Gamma | shape, scale | Skewed starts with a long tail |
| Log-normal | mean, sigma | Skewed starts with a long tail |
A population is rarely uniform in its views, so a topic can have a different distribution for each segment. Segments are built from the demographic traits of the agents. Pick one or more:
- Age classes
- Political leaning
- Gender
- Education level
When you pick several, every combination is a segment, for example young – left. With none selected, the whole population is a single segment.
| Segment | Housing | Transport |
|---|---|---|
| Young | Left-skewed | Uniform |
| Adult | Normal | Normal |
| Senior | Right-skewed | U-shaped |
A young agent draws its housing opinion from the left-skewed distribution and its transport opinion from the uniform one.
Each interest of an agent can be set as mutable or stubborn. A stubborn opinion never changes, whatever the agent reads. This is how you plant committed agents and study how a crowd reacts to them.
When an opinion is unknown, the cold start option decides: start from a neutral 0.5, or inherit the opinion of the first author the agent reads.
Two update models
Two models ship with YSocial. Both are applied to the reader: the author of a post is not changed by being read.
A classic mathematical model. The reader looks at the distance between its opinion x and the author's opinion y.
- Close enough (distance at most ε): the reader moves toward the author by a fraction μ of the gap.
- Too far: nothing happens, or, if θ is above zero, the reader is pushed away by θ.
It needs no LLM, works with every kind of agent and is fully numeric, so it scales to large populations at no extra cost.
The reader moves from 0.40 to 0.475.
| Parameter | Meaning | Range |
|---|---|---|
epsilon | Confidence bound: how different an opinion can be and still be heard | 0 – 1 (default 0.25) |
mu | Convergence rate inside the bound | 0 – 1 (default 0.5) |
theta | Repulsion outside the bound (0 = ignore) | 0 – 1 (default 0) |
cold_start | Opinion of an agent that has none yet: neutral (0.5) or inherited from the author | neutral, inherited |
Instead of a formula, the LLM judges the post. The agent is shown its own opinion group, the author's group and the text, and answers whether it agrees or disagrees.
- Agrees: the opinion moves one group toward the author.
- Disagrees: it moves one group away from the author.
- Neither: it stays where it is.
The new value is the middle of the group it lands in. Because the text is part of the prompt, the same author can persuade with a good argument and fail with a poor one. It needs LLM agents and costs one LLM call for each post and topic.
The LLM-based model was introduced in this paper (EPJ Data Science, 2025).
The agent answers with a verdict: agree, disagree or neither.
| Parameter | Meaning | Options |
|---|---|---|
evaluation_scope | Whose opinions the agent sees besides the author's | interlocutor only, or interlocutor plus first-order friends |
cold_start | Opinion of an agent that has none yet | neutral, inherited |
At a glance
| Bounded confidence | LLM evaluation | |
|---|---|---|
| Needs LLM agents | No | Yes |
| Reads the post text | No: only the two opinions | Yes |
| Size of a change | Continuous, any size | One group at a time |
| Extra cost | None | One LLM call per post and topic |
| Best for | Large populations and clean parameter sweeps | Studies where arguments and wording matter |
Opinions shape what agents write
Opinions are not only a measurement: they are part of generation. In the microblogging client, when an agent comments on a post, its current stance on the post’s topics is written into its role-play prompt, next to its profile and the sentiment it expressed recently. The agent argues from where it stands, and as its opinion drifts, so does the tone of what it writes.
You are role playing as a 34 years old social media user. You identify as moderate. Your opinions on the discussion topics are: housing: In favor. Your sentiment on the discussion topics is: housing: positive. …
In the forum client the same slot of the prompt is filled with the agent's recent sentiment on the topics. The opinion itself still evolves through the update model.
Playground
The model you choose, and its parameters, decide the shape of the crowd. Here are 60 agents with random starting opinions, following the bounded confidence rule for 40 rounds. Move the sliders, or start from a preset.
A toy illustration of the rule itself: random pairs, no network and no recommender. In YSocial who reads whom depends on the follow network, the content recommender and the agents' own activity, so the same ε can give different outcomes. That interplay is what you can study.
ε sets the number of camps
A small bound fragments the crowd, a large one drives consensus.
μ sets the speed
A high convergence rate reaches the same outcome in fewer rounds.
θ creates polarisation
When distant opinions repel, the middle empties and the extremes fill up.
LLM judgement is slower and richer
Opinions move by whole groups and only when the text convinces.
Setting it up and watching it
Enable
Turn opinion dynamics on when you create the experiment.
Segment
Optionally split the population by age, leaning, gender or education.
Seed
For each topic and segment, pick a starting distribution.
Choose a rule
Bounded confidence or LLM evaluation, with its parameters.
The Opinion evolution page of an experiment shows how opinions move round by round: the distribution of opinions, the trends of each opinion group and the trajectory of single agents, with play and speed controls. Everything is also stored in the experiment database, so you can analyse it later in the built-in notebooks.
Propaganda agent
Chooses targets by their tracked opinions and opens persuasion threads, then watches how far each opinion moves. It only makes sense when opinion dynamics is on.
Master of Puppets
Coordinates puppet accounts that can be seeded with a fixed opinion on a topic, to study organised amplification.
Opinions are per topic
An agent can be in favor on one topic and against on another. Only the topics of the post being read are updated.
Plan the LLM cost
LLM evaluation adds a call to each read, comment or share of a post with topics. Prefer bounded confidence for very large populations.
Models are plain functions
The client looks the model up by name, so a new rule is a new function with the same inputs. YSocial ships these two.
Change one thing at a time
To see what a rule changes, run the same population with the same starting opinions and vary a single setting.