agents_scaling_up/AgentSociety2 精读笔记.md

一句话总结:AgentSociety2 把“AI social scientist”和“silicon participants”放进同一个 Integrated Research Environment,通过 skill/workspace/harness、agentic environment、CodeGenRouter 和数据资产层,把社会科学假设转成可执行、可审计、可复现的仿真实验。

TL;DR 速览

tags: [agent-society, ai-scientist, social-simulation, computational-social-science, codegenrouter, human-in-the-loop] related: [[Agentic-Design-Patterns 精读笔记]], [[AgentX_Towards Agent-Driven Self-Iteration of Industrial Recommender Systems 精读笔记]], [[Exploring Recommender System Evaluation_A Multi-Modal User 精读笔记]]


摘要

[!PDF|] AgentSociety2.pdf, p.1

Here we introduce AgentSociety2, an Integrated Research Environment (IRE) for executable social science.

AgentSociety2 的核心不是“让 LLM 扮演社会人”,而是把社会科学研究流程本身也 agent 化:文献检索、假设生成、实验配置、仿真执行、结果分析、论文生成都在一个 workspace 内留下可审计 artifacts。

[!PDF|] AgentSociety2.pdf, p.7

Specifically, the platform supports simulations involving up to 10,000 agents and 100 million interactions

这组数字说明作者不是只做小规模 demo,而是在强调平台级扩展性。但社会仿真规模扩大后,可信度不自动提高,所以论文后半部分专门讨论 realism 和 methodological safeguards。


1 核心定位:从 social simulation 到 Integrated Research Environment

AgentSociety2.pdf, p.8

Figure 2 是全篇最关键的定位图: 1. AgentSociety-1:重点是社会仿真平台,LLM agents 主要作为 silicon participants。 2. AgentSociety2:把 AI social scientists 加进同一运行时,形成闭环研究环境。 3. 闭环变化:从“仿真实验只是研究流程的一环”变成“研究问题 -> 假设 -> 实验 -> 仿真 -> 解释 -> 写作”都可执行。

[!tip] 什么是 Integrated Research Environment (IRE)? IRE 可以理解为社会科学版的 agent-native IDE。它不只是聊天助手,也不只是仿真器,而是有 workspace、状态机、工具、数据、实验 runner、日志和审批 gate 的研究操作系统。它的目标是降低工程门槛,同时保留社会科学研究对理论、构念、干预和解释的控制权。

三条设计原则

设计原则 核心含义 解决的问题
Dual-role IRE AI social scientists + silicon participants 共处一个 runtime 研究流程和仿真对象脱节
Human-agent collaboration 人类确认关键判断,agent 做流程编排和低层操作 全自动不可信,纯人工工程成本太高
Generative social simulation substrate 把假设实例化为 agent 行为、环境规则、干预和测量 社会科学需要机制解释,不只是预测

[!PDF|] AgentSociety2.pdf, p.9

Human researchers must confirm key transitions and judgement-intensive artifacts

这句话是论文的方法论底线:AI social scientist 是 traceable collaborator,不是替代社会科学家的黑箱自动化系统。


2 Executable Social Experiments:硅基参与者 + agentic environments

2.1 Social Generative Agent:workspace-grounded agent

AgentSociety2.pdf, p.11

Figure 6 展示了每个社会仿真 agent 的内部结构: 1. Profile / State / Memory:个体身份、动态状态和经验记忆。 2. Workspace:每个 agent 独立目录,存放 profile、state、logs、checkpoints 和中间 artifacts。 3. Skill System:Observation、Cognition、Plan、Memory 等能力不是塞进长 prompt,而是作为可按需加载的 skill。 4. ReAct Loop:观察、计划、工具调用、反思、状态更新循环执行。 5. File-system driven management:把临时上下文外部化,便于长时程仿真和审计。

[!tip] 为什么 workspace 比“把历史都塞进 prompt”更重要? 社会仿真是长周期、多 agent、多步骤任务。只靠 context window 会遇到 token 成本、上下文污染、状态丢失和不可审计问题。workspace 把 agent 状态写成持久文件,使每个个体的记忆、计划、日志可以被读取、压缩、恢复和复盘。

2.2 Skill-based agent architecture

AgentSociety2 借鉴了 Claude/Codex 的 skill 机制,把行为能力从全局 prompt 中拆出来:

Skill 功能 在社会仿真中的角色
Observation 感知当前环境并抽取相关信息 “我看到了什么?”
Cognition 解释观察并更新内部状态 “这对我的情绪/偏好/意图意味着什么?”
Plan 把意图和约束转成行动 “下一步该做什么?”
Memory 记录重要经验并支持后续决策 “我之前经历过什么?”

这种设计的关键是 progressive disclosure:先只暴露 skill header,选中后再加载完整 spec。这样既节省 token,也避免每步都把所有行为规则塞给模型。

2.3 Agentic Environment:环境不再只是背景板

AgentSociety2.pdf, p.16

Agentic environment 的设计点: 1. 统一 interface:agent 发自然语言 instruction + structured context,环境返回 text response + structured result。 2. 模块化环境:开发者用 EnvBase@tool() 暴露 observe、statistics、action/intervention 方法。 3. AST / pyi stub:系统解析签名、类型、docstring,生成 compact interface description。 4. CodeGenRouter:把 agent 意图翻译为安全可执行的 Python function calls。

[!PDF|] AgentSociety2.pdf, p.17

it introduces CodeGenRouter, an LLM-assisted routing mechanism that translates agent intentions into validated environment operations

[!tip] 什么是 CodeGenRouter? CodeGenRouter 是自然语言环境接口和确定性环境函数之间的桥。它不是让 agent 直接猜函数名,而是读取环境模块 stub,生成 Python 调用代码,经过安全检查、timeout 检查和执行器运行。对常见 <observe> / <statistics> 请求,它还会预生成或缓存代码,避免每次都调用 LLM。


3 AI Social Scientist:用 harness 管住研究流程

AgentSociety2.pdf, p.20

Figure 9 把 AI social scientist workflow 拆成从 topic scoping 到 report generation 的流程。它的工程关键不在“LLM 会写论文”,而在 harness:

AgentSociety2.pdf, p.22

Harness contract 包含两层: 1. Skill specificationSKILL.md 通过 metadata-first 方式暴露能力,激活后可执行 helper scripts。 2. Pipeline state machine:Literature Search -> Hypothesis Formulation -> Experiment Configuration -> Simulation Execution -> Analysis,每一步都有 status、validate-stage、record-attestation、advance-stage、rollback。

[!tip] 为什么 social science agent 需要 state machine? 社会科学研究不是单个问答任务。假设是否有理论依据、构念如何变量化、干预是否符合研究语义、结果能否支持 claim,都需要阶段 gate。state machine 让 agent 不能跳过必要工序,也让人类研究者知道当前产物来自哪个阶段、谁确认过、还有什么 blocking concern。

3.1 Literature-grounded hypothesis generation

Figure 11 显示假设生成不是“直接让 LLM brainstorm”,而是: 1. 从本地 23,781 篇论文库 + 外部 sources 检索。 2. 去重、排序、相关性过滤。 3. LLM-driven reasoning 生成 research insight。 4. 把 hypothesis 包装成 statement、rationale、scale、agent/environment specification。 5. 通过 logic check、reproducibility、executable design 验证后注册。

[!tip] 为什么不能直接让 LLM 生成社会科学假设? 因为 LLM 可能生成流畅但无理论依据、构念模糊、不可实验化或早已被研究过的命题。AgentSociety2 通过 literature-grounded workflow 把假设绑定到可追踪文献证据,并要求假设最终能映射到 agent、environment、intervention 和 measurement。

3.2 Experiment design -> execution -> analysis -> paper generation

阶段 产物 关键约束
Hypothesis HYPOTHESIS.md、theoretical rationale 要有文献依据和可执行机制
Experiment Design EXPERIMENT.md、experiment groups 构念要映射到 agent/environment/intervention
Configuration init_config.jsonsteps.yamlconfig_params.py schema、路径、模块发现约束
Execution sqlite logs、PID、replay artifacts runner 分离配置生成和仿真执行
Analysis EDA、charts、HTML/Markdown report 结合 research semantics 和 runtime evidence
Paper Generation narrative framework、claim-evidence map、PDF 每个 claim 需要证据审计

最重要的工程点:所有中间产物都落到 workspace,研究不是一次性 chat completion,而是一个可重跑、可审计的 artifact graph。


4 Agentic Data Foundation:数据资产化

AgentSociety2 把数据分成主观通道和客观通道:

通道 初始化内容 作用
Subjective channel 偏好、价值观、风险感知、社会信任、知识背景、记忆材料 决定 agent 如何解释情境和选择行动
Objective channel 年龄、性别、收入、职业、教育、居住地、历史行为、空间位置 决定资源条件、行动边界和交互机会

数据资产层的意义是把零散数据变成有 README、metadata、data directory、package constraints 的可搜索资产。这样 experiment initialization、profile construction、calibration 和 result comparison 都能共享同一套数据语义。

当前数据资产覆盖:ACS/CES/PSID/SHED/SIPP、合成人口、DailyMobility、US disaster mobility、Twitter retweet networks、short-video consumption、FactSet ownership、FinnHub news/OHLC 等。


5 平台性能:CodeGenRouter 是否真的比 function calling 更稳?

论文定义了四个 routing 指标:

\[ IoU(E,A)=\frac{|F(E)\cap F(A)|}{|F(E)\cup F(A)|} \tag{1} \]
\[ NLCS(S_A,S_E)=\frac{LCS(S_A,S_E)}{|S_E|} \tag{2} \]
\[ PAcc=\frac{1}{|E|}\sum_{e\in E}\frac{\# matched\ parameters(e)}{\# required\ parameters(e)} \tag{3} \]
\[ SR=\mathbb{I}[NLCS(S_A,S_E)=1 \land PAcc=1] \tag{4} \]
符号 数学定义 物理含义/通俗解释
\(E\) expected call set 标注的正确函数调用集合
\(A\) actual call set 模型/路由器实际调用集合
\(F(\cdot)\) function-name set 忽略顺序后的函数名集合
\(S_E, S_A\) expected/actual call sequence 正确/实际调用顺序
\(PAcc\) parameter accuracy 参数有没有填对
\(SR\) strict success ratio 顺序和参数都完全正确才算成功

[!tip] 公式 (1)-(4) 深度解读 这组指标不是只问“选对了工具吗”。IoU 看函数集合是否对,NLCS 看顺序是否对,PAcc 看参数是否对,SR 是最严格的端到端成功。

举例:正确流程是 observe_user -> move_to -> get_metric。如果模型调用了 observe_user -> get_metric -> move_to,IoU 可能仍然高,因为函数都选到了;但 NLCS 会下降,因为顺序错了。如果 move_to(location=home) 写成 location=work,PAcc 会下降。SR 要求两者都对,所以更接近“真实能不能跑通”。

设计动机:社会仿真环境调用经常是多步骤、多模块、有前置条件的,普通 function calling 只看函数选择不够。CodeGenRouter 的价值就在于把“意图 -> 多步函数序列 -> 参数 grounding -> 安全执行”作为整体来评估。

AgentSociety2.pdf, p.38

关键结果:

指标 结果
Kimi-K2-Instruct 上 CodeGen SR 0.600
相对最佳 baseline 提升 +31.6%
GLM-4.7 上 CodeGen SR 0.578
相对最佳 baseline 提升 +25.4%
预生成处理例行请求 Run1 74.1%,Run2 70.5%
LLM calls 减少 66.5%
额外 token overhead 平均每 step 每 agent 2,292 input / 184 output tokens

表格解读: 1. CodeGenRouter 在复杂组合调用上更稳,尤其是多模块、多步骤任务。 2. 成本主要增加在 input tokens,因为需要把环境 stub 和上下文喂给模型;缓存可以摊薄成本。 3. 容易任务上不同模型表现接近,说明平台不完全绑定单一模型供应商;难任务仍然强依赖模型能力。


6 七个社会科学案例:平台能力边界

AgentSociety2.pdf, p.39

尺度 案例 研究对象 结论价值
Micro Norms / Metanorms Game 规范形成与惩罚 可复现二阶惩罚增强规范稳定性的定性模式
Micro Public Goods Experiment 公共品贡献 可模拟实验顺序对贡献、信念和收益的影响
Micro Psychological Survey self-bias tasks 对照人类 baseline,检查 LLM agent 心理测量一致性
Meso Information Cocoons 年龄组深度信息茧房 比较真实数据和仿真年龄分布
Meso Opinion Polarization 订阅、算法排序、跨阵营消费 可分解 subscription choice 和 algorithmic ranking 的作用
Macro Daily Mobility 北京日常出行 在活动序列上较好,但空间半径/地点数仍有明显偏差
Macro Disaster Mobility Texas Winter Storm / Camp Fire 与 SafeGraph 灾害迁移曲线做时间形状对齐

6.1 值得注意的偏差不是失败,而是新假设来源

在 polarization 案例中,仿真结果和 Levy field experiment 的差异很有意思:论文指出模拟把 cross-cutting exposure gap 的更大部分归因于 subscription choice,而 Levy 更强调 algorithmic ranking。作者把这解释为环境中 algorithm_filter_strength=0.4 的校准结果。

这说明 AgentSociety2 的正确使用方式不是“模拟结果等于社会真相”,而是: 1. 用仿真复现已知 qualitative pattern。 2. 找到和人类实验/真实数据不一致的位置。 3. 把不一致变成机制假设、参数敏感性分析或外部验证问题。


7 相关工作:AgentSociety2 的位置

7.1 AI Scientist 系统

[!tip] 什么是 AI Scientist? AI Scientist 指用 LLM agent 编排科学研究阶段的系统,通常覆盖文献、假设、实验、分析、写作的一部分。AI Scientist-v2、AI-Researcher、Agent Laboratory、InternAgent-1.5 等多集中在计算机科学或通用科研流程。AgentSociety2 的不同点在于:研究对象不是静态数据集或代码实验,而是由 silicon participants、社会环境、干预和测量共同构成的社会过程。

7.2 LLM Agents as Social Participants

[!tip] 什么是 silicon participants? silicon participants 是用 LLM agent 模拟的人类参与者。它们有 profile、memory、state 和行为规则,可以在实验环境里做选择、回答问卷、互动、移动或消费内容。风险在于:它们可能复现 prompt 偏差或模型偏差,而不是真实人类机制,所以必须和真实数据、实验基准和敏感性分析结合。

7.3 与 AgentX / A/B Agent 的关系

系统 agent 扮演什么角色 reward/evidence 关键风险
AgentSociety2 研究编排者 + 社会参与者 仿真轨迹、真实数据对齐、社会科学解释 仿真真实性和机制有效性
AgentX 推荐系统研发执行者 线上 A/B 结果和业务指标 生产安全、资源冲突、错误归因
A/B Agent 多模态用户模拟器 CTR/CVR/AR 与真实 Recall/NDCG 对齐 模拟用户是否真正代表线上用户

8 风险和方法论护栏

[!PDF|] AgentSociety2.pdf, p.72

This discussion is organized around three levels: formal reliability, simulation realism, and experimental-mechanism validity.

层次 问题 必要护栏
Formal reliability 研究输出是否可追踪、可审计? source、生成过程、人类确认点、artifact lineage
Simulation realism agent 行为和 aggregate outcome 是否像真实人类/社会? calibration benchmark、真实数据对齐、模型/提示/记忆对比
Mechanism validity 仿真实验机制是否真的对应理论机制? replication、ablation、sensitivity analysis、external empirical comparison

核心警告:一个仿真结果看起来真实,不代表机制有效;一个 workflow 可审计,也不代表结论正确。AgentSociety2 只是降低构建和执行实验的成本,不能替代社会科学中的构念效度、外部效度和因果解释。


个人思考

与其他论文的关联

在我的工作中能怎么用

  1. 如果要做推荐策略仿真,可以复用它的三层思想:agent profile/state/memory、environment tool interface、human-reviewed experiment workflow。
  2. 如果要把实验平台 agent 化,应优先建设 workspace artifact 和 state machine,而不是先追求“全自动写结论”。
  3. 对任意 agent 调用内部平台,都可以借鉴 CodeGenRouter:先生成可执行代码,再做安全检查、缓存、timeout 和结构化结果返回。

开放问题/疑问

  1. 10,000 agents / 100M interactions 的成本可接受范围是什么?论文给了 overhead,但实际科研团队是否能负担长期仿真?
  2. 不同 foundation model 的社会行为偏差如何校准?如果模型文化偏差不同,仿真结果会不会强依赖供应商?
  3. “>95% qualitative patterns” 的判定标准需要进一步细化:哪些 pattern 算复现,哪些偏差算 informative deviation?
  4. 当 AI social scientist 参与论文生成时,claim-evidence audit 是否足以防止过度解释?

局限性

  1. 平台很完整,但评估主要是 illustrative studies,距离领域专家长期使用后的外部验证还有距离。
  2. 社会机制的因果解释仍需要真实实验和统计识别,LLM 仿真只能提供机制 rehearsal 和假设生成。
  3. CodeGenRouter 提升了环境调用成功率,但 SR 最高 0.600,说明复杂环境调用仍远未解决。