Skip to content

做什么(One-liner)

N 个 agent 各跑 4D ODE + w 向群体均值耦合 → 计算 herding_index + flash_crash_score → score≥70 记 event。检测策略同调与闪崩风险。Seed=42 硬编码。

怎么用

macro_snapshot_v1 → strategy_homophily_v1 (n_agents=20, coupling=0.05, shocks=[...])
                    → final_metrics {peak_herding, max_crash_score, total_flash_crash_events}
                    → flash_crash_events timeline

核心公式

见 frontmatter formula。三大要素:

  1. Seed=42 初始化: rng.normal 给 agent 初始状态(agent_diversity 控制 w spread)
  2. 耦合: coupling_strength × (mean_w − w_i) 加到 RK4 step 后的 w
  3. 评分: herding_score (40%) + collapse_score (35%) + level_score (25%) → min(100, sum)

假设与适用场景

假设:Seed=42 + 同步 shock + coupling 公式绑定 4D ODE + pinned numpy。

适用:AI-agent herding 压测(BoE / FSB 框架对齐)、Canvas 跨策略羊群效应观察、闪崩 counterfactual。

不适用:实盘、单 agent、非 reflexivity 动力学、超 cap。

已知局限

详见 frontmatter limitations。关键 7 点:seed 硬编码 / caps / shock 同步 / 耦合无阻尼 / x/y/z 分散固定 / scoring 权重固定 / rounding locked。

参考文献

  • Soros (1987) Alchemy of Finance — 反身性
  • FSB (2024-11) AI 金融稳定性报告 — herding 压测框架
  • BoE (2025-04) FS in Focus: AI — 监管压测要求

Golden Test

tests/golden/fixtures/tier4/strategy_homophily/captured_snapshot(seed=42 确定性),1e-8 tolerance。11 tests

5 Scenarios

  • canvas_defaults / small_tight_group / large_loose_group / with_shock_crash / custom_ode_params

6 Contract tests

  • result_structure(top-level + 每步 metrics 键集合)
  • determinism(3 次重跑字节一致)
  • n_agents_cap(500 → clamp 200)
  • n_steps_cap(1000 → clamp 500)
  • flash_crash_threshold(events 集合 = trajectory score≥70 步集合)
  • final_metrics_roll_up(max_crash_score = max(events) 或 0.0)

Changelog

  • 1.0.0 (2026-04-21) — 首次 Active(Tier 4 batch 2.2)

Verifiable intelligence for the decisions that demand scrutiny.