This paper introduces discourse_simulator, an open-source framework that combines LLMs with agent-based modelling. It offers a new way to simulate how public attitudes toward immigration change over time in response to salient events like protests, controversies, or policy debates. Large language models (LLMs) are used to generate social media posts, interpret opinions, and model how ideas spread through social networks. Unlike traditional agent-based models that rely on fixed, rule-based opinion updates and cannot generate natural language or consider current events, this approach integrates multidimensional sociological belief structures and real-world event timelines. This framework is wrapped into an open-source Python package that integrates generative agents into a small-world network topology and a live news retrieval system. discourse_sim is purpose-built as a social science research instrument specifically for studying attitude dynamics, polarisation, and belief evolution following real-world critical events. Unlike other LLM Agent Swarm frameworks, which treat the simulations as a prediction black box, discourse_sim treats it as a theory-testing instrument, which is fundamentally a different epistemological stance for studying social science problems. The paper further demonstrates the framework by modelling the Dublin anti-immigration march on April 26, 2025, with N=100 agents over a 15-day simulation. Package link: https://pypi.org/project/discourse-sim/
翻译:本文介绍 discourse_simulator——一个将大语言模型与智能体建模相结合的开源框架。该框架提供了一种新方法,用于模拟公众对移民的态度如何随着抗议、争议或政策辩论等重大事件的发生而随时间演变。研究利用大语言模型生成社交媒体帖子、解读观点,并建模思想在社会网络中的传播过程。不同于依赖固定规则更新观点、无法生成自然语言或考虑时事的传统智能体模型,本方法整合了多维度的社会学信念结构与真实世界事件时间线。该框架封装为一个开源 Python 包,将生成式智能体集成至小世界网络拓扑结构与实时新闻检索系统中。discourse_sim 专门作为社会科学研究工具而设计,用于研究真实世界重大事件后的态度动态、极化现象与信念演化。相较于将模拟视为预测黑箱的其他大语言模型智能体集群框架,discourse_sim 将其视为理论检验工具——这本质上是一种研究社会科学问题的认识论立场差异。论文进一步通过建模2025年4月26日都柏林反移民游行进行了框架演示,模拟采用N=100个智能体,持续15天。包链接:https://pypi.org/project/discourse-sim/