fix: make KL optimization measured and reversible (#182)

This commit is contained in:
Joseph Magly
2026-08-28 23:11:26 -04:00
parent 173fbeff90
commit 1f428f60cf
6 changed files with 456 additions and 290 deletions
+4 -2
View File
@@ -1240,8 +1240,10 @@ def _format_obliteration_metrics(
icon = "🟢" if ppl < 12 else "🟡" if ppl < 20 else "🔴"
parts.append(f"| Perplexity | **{ppl:.2f}** | {icon} |")
if kl is not None:
icon = "🟢" if kl < 0.05 else "🟡" if kl < 0.1 else "🔴"
parts.append(f"| KL Divergence | **{kl:.4f}** | {icon} |")
kl_budget = metrics.get("kl_budget", getattr(pipeline, "kl_budget", None))
icon = "🟢" if kl_budget is not None and kl <= kl_budget else "🔴"
budget_note = f" / {kl_budget:.4f}" if kl_budget is not None else ""
parts.append(f"| Token KL / Budget | **{kl:.4f}{budget_note}** | {icon} |")
if n_layers > 0:
parts.append(f"| Layers Modified | **{n_layers}** | |")
if load_settings is not None: