"""Figures for paper H (PNG for the HTML build, PDF for print).""" import json, os import matplotlib; matplotlib.use("Agg") import matplotlib.pyplot as plt import pandas as pd os.makedirs("figures", exist_ok=True) plt.rcParams.update({"font.family": "DejaVu Sans", "font.size": 9, "axes.spines.top": False, "axes.spines.right": False, "axes.edgecolor": "#999999", "axes.labelcolor": "#333333", "xtick.color": "#555555", "ytick.color": "#555555", "axes.grid": True, "grid.color": "#e6e6e6", "grid.linewidth": 0.6}) C = {"US": "#257de0", "CN": "#f47230", "Europe": "#00b894", "Other": "#f2a600", "unattributed": "#b3b3b3"} EU = {"DE", "FR", "GB", "FI", "CH", "PT", "PL", "NL", "SE", "IT", "ES"} def save(name): plt.tight_layout() plt.savefig(f"figures/{name}.png", dpi=220, metadata={"Software": None}) plt.savefig(f"figures/{name}.pdf", metadata={"Creator": None, "Producer": None, "CreationDate": None}) plt.close() def grouped(f): mon = pd.read_csv(f, index_col=0) mon = mon[(mon.index >= "2023-01") & (mon.index <= "2026-10")] g = pd.DataFrame({"US": mon.get("US", 0), "CN": mon.get("CN", 0), "Europe": mon[[c for c in mon if c in EU]].sum(1), "Other": mon[[c for c in mon if c not in EU | {"US", "CN", "unattributed"}]].sum(1), "unattributed": mon.get("unattributed", 0)}) return (g.div(g.sum(1), axis=0) * 100).rolling(3, min_periods=1).mean() # Fig 1: headline - share of new derivatives by country of the root model, two ways of counting fig, axes = plt.subplots(1, 2, figsize=(9.6, 3.7), sharey=True) for ax, f, t in [(axes[0], "results/derivatives_by_month_country.csv", "a) models uploaded"), (axes[1], "results/uploaders_by_month_country.csv", "b) distinct uploader accounts")]: roll = grouped(f); x = pd.to_datetime(roll.index) for k in ["US", "CN", "Europe", "Other"]: ax.plot(x, roll[k], color=C[k], lw=2) ax.text(x[-1] + pd.Timedelta(days=12), roll[k].iloc[-1], f"{k} {roll[k].iloc[-1]:.0f}%", color="#333333", va="center", fontsize=8) ax.set_xlim(x[0], x[-1] + pd.Timedelta(days=170)); ax.set_ylim(0, 85) ax.set_title(t, loc="left", fontsize=9.5) ax.tick_params(axis="x", labelrotation=30) axes[0].set_ylabel("share of month's derivatives (%)") fig.suptitle("Country of the root model behind each new open model (3-month rolling mean)", x=0.01, ha="left", fontsize=10.5) save("fig_country_share") # Fig 2: top families, monthly new derivatives fam = pd.read_csv("results/derivatives_by_month_top_families.csv", index_col=0) fam = fam[(fam.index >= "2023-01") & (fam.index <= "2026-10")] names = {"Qwen": ("Qwen (Alibaba)", "#f47230"), "meta-llama": ("Llama (Meta)", "#257de0"), "google": ("Gemma & others (Google)", "#00b894"), "black-forest-labs": ("FLUX (Black Forest Labs)", "#6a4ce2"), "mistralai": ("Mistral", "#ee7fac"), "deepseek-ai": ("DeepSeek", "#ec4647")} fig, ax = plt.subplots(figsize=(7.2, 3.6)) for k, (lab, col) in names.items(): if k not in fam: continue s = fam[k].rolling(3, min_periods=1).mean() / 1000 ax.plot(pd.to_datetime(fam.index), s, color=col, lw=2, label=lab) ax.set_ylabel("new derivatives per month (thousands)") ax.legend(frameon=False, fontsize=8, loc="upper left") ax.set_title("New derivative models per month, by base family (3-month rolling mean)", loc="left", fontsize=10) save("fig_families") # Fig 3: concentration - top organisations org = pd.read_csv("results/derivatives_by_organisation.csv", index_col=0).iloc[:, 0] top = org.head(15)[::-1] / org.sum() * 100 fig, ax = plt.subplots(figsize=(7.2, 4.2)) ax.barh(top.index.str.replace("unattributed:", "(unmapped) "), top.values, color="#257de0", height=0.62) for i, v in enumerate(top.values): ax.text(v + 0.3, i, f"{v:.1f}%", va="center", fontsize=8, color="#333333") ax.set_xlabel("share of all derivative models (%)"); ax.grid(axis="y", visible=False) ax.set_title("Fifteen organisations seed most of the open model ecosystem", loc="left", fontsize=10) save("fig_concentration") # Fig 4: licence relabelling lic = pd.read_csv("results/licence_drift.csv", index_col=0) lic = lic[[c for c in ("permissive", "restrictive", "none") if c in lic] + ["n"]] sel = [l for l in ["llama2", "llama3", "llama3.1", "llama3.2", "llama3.3", "gemma", "flux-1-dev-non-commercial-license", "other"] if l in lic.index] p = lic.loc[sel].drop(columns="n") p = p.div(p.sum(1), axis=0)[::-1] * 100 fig, ax = plt.subplots(figsize=(7.2, 3.4)) left = 0 cols = {"permissive": "#ec4647", "restrictive": "#257de0", "none": "#c9c9c9"} labs = {"permissive": "relabelled permissive (Apache/MIT/...)", "restrictive": "kept a restrictive licence", "none": "no licence declared"} for k in p.columns: ax.barh(p.index, p[k], left=left, color=cols[k], height=0.62, label=labs[k], edgecolor="white", linewidth=1.5) left = left + p[k] ax.set_xlabel("share of descendants (%)"); ax.grid(axis="y", visible=False); ax.set_xlim(0, 100) ax.legend(frameon=False, fontsize=8, ncol=3, loc="upper center", bbox_to_anchor=(0.5, -0.2)) ax.set_title("Licence declared by descendants of models under restrictive licences", loc="left", fontsize=10) save("fig_licence") print("ok")