Download figures/f8_multiagent.py from fahadhafeezofficial/clsa-code: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/datasets/fahadhafeezofficial/clsa-code/resolve/main/figures/f8_multiagent.py
- Command line
-
hf download hf://datasets/fahadhafeezofficial/clsa-code/figures/f8_multiagent.py
-
curl -L -o f8_multiagent.py https://huggingface.co/datasets/fahadhafeezofficial/clsa-code/resolve/main/figures/f8_multiagent.py
1.69 kB
| # Copyright (c) 2026 CLSA contributors | |
| # SPDX-License-Identifier: MIT | |
| """Figure 8: multi-agent divergence over time and governance comparison.""" | |
| from __future__ import annotations | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from common import load, save, style | |
| COLOURS = {"none": "#b03a2e", "message_layer": "#ca6f1e", "restart": "#7f8c8d", | |
| "pause_divergent": "#1f4e79"} | |
| def main() -> None: | |
| style() | |
| res = load("e8_multiagent")["results"] | |
| traces = res["divergence_traces"] | |
| fig, axes = plt.subplots(1, 2, figsize=(7.0, 2.9)) | |
| for gov, ys in traces.items(): | |
| axes[0].plot(range(len(ys)), ys, marker="o", ms=2.5, lw=1.3, | |
| color=COLOURS.get(gov, "#333"), label=gov.replace("_", " ")) | |
| axes[0].set_xlabel("step") | |
| axes[0].set_ylabel("mean belief divergence") | |
| axes[0].legend(fontsize=6.5) | |
| axes[0].set_title("divergence over time", fontsize=8) | |
| govs = list(res["by_governance"]) | |
| harm = [res["by_governance"][g]["total_harm"] for g in govs] | |
| cons = [res["by_governance"][g]["false_consensus_rate"] for g in govs] | |
| x = np.arange(len(govs)) | |
| axes[1].bar(x - 0.2, harm, width=0.4, color="#b03a2e", label="total harm") | |
| axes[1].set_xticks(x) | |
| axes[1].set_xticklabels([g.replace("_", " ") for g in govs], fontsize=6.5, rotation=12) | |
| axes[1].set_ylabel("total harmful actions") | |
| ax2 = axes[1].twinx() | |
| ax2.plot(x + 0.2, cons, marker="o", ms=3, color="#1f4e79", lw=1.2, label="false consensus") | |
| ax2.set_ylabel("false consensus rate") | |
| ax2.grid(False) | |
| axes[1].set_title("governance comparison", fontsize=8) | |
| save(fig, "fig8_multiagent") | |
| if __name__ == "__main__": | |
| main() | |