ScarRhine commited on
Commit
154e581
·
1 Parent(s): a41f1fe

model wise summary on 30 sessions each

Browse files
exports/founder_genomes/comparison_ollama_mistral_latest_vs_ollama_deepseek_coder_6p7b_20260426_080120.png ADDED

Git LFS Details

  • SHA256: 743db57511343b66c33cd75fc60c187ea53a7dcd47d59062a38d46784120ff90
  • Pointer size: 131 Bytes
  • Size of remote file: 604 kB
exports/founder_genomes/genome_ollama_deepseek_coder_6p7b_20260426_080026.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "profile": {
3
+ "company_valuation": 0.153,
4
+ "series_a_success": 0.0,
5
+ "runway_management": 0.381,
6
+ "product_velocity": 0.2,
7
+ "customer_retention": 0.567,
8
+ "team_morale": 0.776,
9
+ "cofounder_alignment": 0.805,
10
+ "personal_crisis_handling": 0.5,
11
+ "decision_coherence": 0.88,
12
+ "company_brain_quality": 0.903,
13
+ "pivot_execution": 0.5
14
+ },
15
+ "metadata": {
16
+ "episode_count": 30,
17
+ "avg_difficulty": 1.0,
18
+ "avg_days_survived": 30.0,
19
+ "strengths": [
20
+ "Brain",
21
+ "Coherence",
22
+ "Alignment"
23
+ ],
24
+ "weaknesses": [
25
+ "Velocity",
26
+ "Valuation",
27
+ "Series A"
28
+ ],
29
+ "timestamp": "2026-04-26T08:00:26.167513"
30
+ }
31
+ }
exports/founder_genomes/genome_ollama_deepseek_coder_6p7b_20260426_080026.png ADDED

Git LFS Details

  • SHA256: e8cf5d326f902af12d1cab2672787bf027c3b3e1c769ec3c6ceca2d0813d0b1c
  • Pointer size: 131 Bytes
  • Size of remote file: 453 kB
exports/founder_genomes/genome_ollama_mistral_latest_20260426_072711.json ADDED
File without changes
exports/founder_genomes/genome_ollama_mistral_latest_20260426_072825.json ADDED
File without changes
frontend/src/app/postmortem/page.tsx CHANGED
@@ -478,11 +478,16 @@ export default function PostmortemPage() {
478
  }, []);
479
 
480
  const handleLoadScenario = useCallback(async (scenarioId: string) => {
481
- if (!episodeId) {
482
- // Spin up a session first
 
483
  await reset(difficulty, seed);
 
 
 
 
 
484
  }
485
- const eid = episodeId ?? `ep-${Math.random().toString(36).substring(2, 9)}`;
486
  setLoadingId(scenarioId);
487
  setError(null);
488
  try {
 
478
  }, []);
479
 
480
  const handleLoadScenario = useCallback(async (scenarioId: string) => {
481
+ let eid = episodeId;
482
+ if (!eid) {
483
+ // Spin up a session first. Then read the newly created episodeId from the store.
484
  await reset(difficulty, seed);
485
+ eid = useGenesisStore.getState().episodeId;
486
+ }
487
+ if (!eid) {
488
+ setError("Failed to start a new session. Is the GENESIS server running?");
489
+ return;
490
  }
 
491
  setLoadingId(scenarioId);
492
  setError(null);
493
  try {
outputs/evals/reward_curves.png CHANGED

Git LFS Details

  • SHA256: 5b6b46c9fe9409ba3a46ca01e91ac7833e28b9e2da9b5c9143620b8858b9b310
  • Pointer size: 130 Bytes
  • Size of remote file: 76.1 kB

Git LFS Details

  • SHA256: a023e00499f04df209e6d6ef8b369daee9f78d74981e234c11d0c4ccaa93aa31
  • Pointer size: 131 Bytes
  • Size of remote file: 187 kB
outputs/evals/reward_summary.json CHANGED
@@ -1,11 +1,27 @@
1
  {
2
- "mode": "representative_run_seed_42",
3
- "note": "Generated from seeded simulation; real Colab run produces similar trajectory.",
4
- "num_baseline_episodes": 6,
5
- "num_trained_episodes": 12,
6
- "baseline_avg_final_reward": 0.3241,
7
- "trained_avg_final_reward": 0.5696,
8
- "improvement_pct": 75.78,
9
- "best_trained_reward": 0.7139,
10
- "worst_baseline_reward": 0.1955
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
 
1
  {
2
+ "num_sessions_with_history": 70,
3
+ "avg_final_reward": 0.451,
4
+ "best_final_reward": 0.5022,
5
+ "worst_final_reward": 0.2875,
6
+ "improvement_over_baseline": null,
7
+ "by_model_id": {
8
+ "ollama_mistral_latest": {
9
+ "num_sessions": 31,
10
+ "avg_final_reward": 0.4707,
11
+ "best_final_reward": 0.5022,
12
+ "worst_final_reward": 0.4278
13
+ },
14
+ "ollama_deepseek_coder_6p7b": {
15
+ "num_sessions": 30,
16
+ "avg_final_reward": 0.4604,
17
+ "best_final_reward": 0.4911,
18
+ "worst_final_reward": 0.4178
19
+ },
20
+ "unknown": {
21
+ "num_sessions": 9,
22
+ "avg_final_reward": 0.3519,
23
+ "best_final_reward": 0.463,
24
+ "worst_final_reward": 0.2875
25
+ }
26
+ }
27
  }
rollout_ollama.py CHANGED
@@ -19,6 +19,7 @@ import uuid
19
  from typing import Any, Dict, Optional, Tuple
20
 
21
  import requests
 
22
 
23
 
24
  def _safe_json_obj(text: str) -> Optional[Dict[str, Any]]:
@@ -63,26 +64,49 @@ def ollama_generate(
63
  prompt: str,
64
  temperature: float = 0.7,
65
  top_p: float = 0.95,
 
 
 
 
66
  ) -> str:
67
  """
68
  Calls Ollama HTTP API (/api/generate). Uses non-streaming for simplicity.
69
  """
70
- resp = requests.post(
71
- f"{base_url}/api/generate",
72
- json={
73
- "model": model,
74
- "prompt": prompt,
75
- "stream": False,
76
- "options": {
77
- "temperature": temperature,
78
- "top_p": top_p,
79
- },
80
- },
81
- timeout=300,
82
- )
83
- resp.raise_for_status()
84
- data = resp.json()
85
- return (data.get("response") or "").strip()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
 
88
  def main():
@@ -95,6 +119,10 @@ def main():
95
  parser.add_argument("--episodes", type=int, default=10)
96
  parser.add_argument("--days", type=int, default=30)
97
  parser.add_argument("--seed-start", type=int, default=2000)
 
 
 
 
98
  parser.add_argument("--export-genome", action="store_true")
99
  args = parser.parse_args()
100
 
@@ -127,7 +155,15 @@ def main():
127
  break
128
 
129
  prompt = _build_ceo_prompt(briefing)
130
- completion = ollama_generate(args.ollama_url, args.ollama_model, prompt)
 
 
 
 
 
 
 
 
131
  parsed = _safe_json_obj(completion) or {}
132
 
133
  decision_type = str(parsed.get("decision_type") or "tactical").lower()
 
19
  from typing import Any, Dict, Optional, Tuple
20
 
21
  import requests
22
+ from requests.exceptions import ReadTimeout, ConnectionError as RequestsConnectionError
23
 
24
 
25
  def _safe_json_obj(text: str) -> Optional[Dict[str, Any]]:
 
64
  prompt: str,
65
  temperature: float = 0.7,
66
  top_p: float = 0.95,
67
+ timeout_s: int = 300,
68
+ max_tokens: Optional[int] = 256,
69
+ num_ctx: Optional[int] = 4096,
70
+ retries: int = 2,
71
  ) -> str:
72
  """
73
  Calls Ollama HTTP API (/api/generate). Uses non-streaming for simplicity.
74
  """
75
+ url = f"{base_url}/api/generate"
76
+
77
+ # Retry strategy: first try normal; if it times out, retry with shorter output.
78
+ last_err: Optional[Exception] = None
79
+ for attempt in range(retries + 1):
80
+ effective_max = max_tokens
81
+ effective_timeout = timeout_s
82
+ if attempt >= 1:
83
+ # Make retries more likely to return quickly
84
+ effective_timeout = max(timeout_s, 900)
85
+ if effective_max is None:
86
+ effective_max = 128
87
+ else:
88
+ effective_max = max(64, int(effective_max * 0.6))
89
+
90
+ options: Dict[str, Any] = {"temperature": temperature, "top_p": top_p}
91
+ if effective_max is not None:
92
+ options["num_predict"] = int(effective_max)
93
+ if num_ctx is not None:
94
+ options["num_ctx"] = int(num_ctx)
95
+
96
+ try:
97
+ resp = requests.post(
98
+ url,
99
+ json={"model": model, "prompt": prompt, "stream": False, "options": options},
100
+ timeout=effective_timeout,
101
+ )
102
+ resp.raise_for_status()
103
+ data = resp.json()
104
+ return (data.get("response") or "").strip()
105
+ except (ReadTimeout, RequestsConnectionError, requests.HTTPError) as e:
106
+ last_err = e
107
+ time.sleep(1.0 + attempt * 0.5)
108
+
109
+ raise last_err if last_err else RuntimeError("Ollama request failed with unknown error")
110
 
111
 
112
  def main():
 
119
  parser.add_argument("--episodes", type=int, default=10)
120
  parser.add_argument("--days", type=int, default=30)
121
  parser.add_argument("--seed-start", type=int, default=2000)
122
+ parser.add_argument("--ollama-timeout", type=int, default=900, help="HTTP timeout per generation (seconds).")
123
+ parser.add_argument("--ollama-retries", type=int, default=2, help="Retries on timeout/connection errors.")
124
+ parser.add_argument("--max-tokens", type=int, default=256, help="Max tokens to generate per day.")
125
+ parser.add_argument("--num-ctx", type=int, default=4096, help="Context window sent to Ollama.")
126
  parser.add_argument("--export-genome", action="store_true")
127
  args = parser.parse_args()
128
 
 
155
  break
156
 
157
  prompt = _build_ceo_prompt(briefing)
158
+ completion = ollama_generate(
159
+ args.ollama_url,
160
+ args.ollama_model,
161
+ prompt,
162
+ timeout_s=args.ollama_timeout,
163
+ retries=args.ollama_retries,
164
+ max_tokens=args.max_tokens,
165
+ num_ctx=args.num_ctx,
166
+ )
167
  parsed = _safe_json_obj(completion) or {}
168
 
169
  decision_type = str(parsed.get("decision_type") or "tactical").lower()
scripts/plot_rewards.py CHANGED
@@ -96,6 +96,7 @@ def plot_from_sessions(sessions_file: str, output_dir: str) -> dict:
96
  all_rewards: list[list[float]] = []
97
  all_breakdowns: list[list[dict]] = []
98
  episode_labels: list[str] = []
 
99
 
100
  for ep_id, state in sessions.items():
101
  if not hasattr(state, "reward_history") or not state.reward_history:
@@ -103,6 +104,7 @@ def plot_from_sessions(sessions_file: str, output_dir: str) -> dict:
103
  rewards = [float(x) for x in state.reward_history]
104
  all_rewards.append(rewards)
105
  episode_labels.append(f"Ep {ep_id[:6]}")
 
106
  if hasattr(state, "reward_breakdown_history") and state.reward_breakdown_history:
107
  all_breakdowns.append(state.reward_breakdown_history)
108
 
@@ -115,6 +117,7 @@ def plot_from_sessions(sessions_file: str, output_dir: str) -> dict:
115
  fig = _make_figure(
116
  all_rewards=all_rewards,
117
  episode_labels=episode_labels,
 
118
  all_breakdowns=all_breakdowns if all_breakdowns else None,
119
  title="GENESIS — Training Progress",
120
  subtitle="Real session data",
@@ -135,6 +138,36 @@ def plot_from_sessions(sessions_file: str, output_dir: str) -> dict:
135
  return summary
136
 
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  # ---------------------------------------------------------------------------
139
  # Mode 2 – generate representative demo artifacts
140
  # ---------------------------------------------------------------------------
@@ -444,6 +477,7 @@ def generate_demo_artifacts(output_dir: str, seed: int = 42) -> dict:
444
  def _make_figure(
445
  all_rewards: list[list[float]],
446
  episode_labels: list[str],
 
447
  all_breakdowns: Optional[list[list[dict]]],
448
  title: str,
449
  subtitle: str,
@@ -467,30 +501,120 @@ def _make_figure(
467
  spine.set_color(ax_spine_color)
468
  ax.grid(True, color="#1e293b", linestyle="--", linewidth=0.7, alpha=0.8)
469
 
470
- palette = plt.cm.viridis(np.linspace(0.2, 0.9, len(all_rewards)))
 
 
 
 
 
471
 
472
  # Left: per-episode raw + moving average
473
  ax = axes[0]
474
  _style(ax)
475
- for i, (rewards, label) in enumerate(zip(all_rewards, episode_labels)):
476
- days = list(range(1, len(rewards) + 1))
477
- ax.plot(days, rewards, color=palette[i], alpha=0.25, linewidth=0.9)
478
- ma = _moving_average(rewards, 10)
479
- ax.plot(_ma_x(len(rewards), len(ma)), ma,
480
- color=palette[i], linewidth=2.0, label=label)
481
- ax.set_title("Reward per Episode (moving avg)", fontweight="bold")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  ax.set_xlabel("Simulated Day")
483
  ax.set_ylabel("Reward (0–1)")
484
  ax.set_ylim(0, 1.05)
485
- ax.legend(fontsize=8, facecolor="#1e293b", edgecolor=ax_spine_color,
486
- labelcolor=ax_label_color, framealpha=0.9)
487
 
488
  # Right: final reward progression
489
  ax2 = axes[1]
490
  _style(ax2)
491
  finals = [r[-1] for r in all_rewards]
492
  ep_nums = list(range(1, len(finals) + 1))
493
- ax2.scatter(ep_nums, finals, color=GENESIS_PURPLE, s=60, zorder=5)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
  if len(finals) >= 3:
495
  ma_f = _moving_average(finals, min(3, len(finals)))
496
  ax2.plot(_ma_x(len(finals), len(ma_f)), ma_f,
@@ -593,6 +717,23 @@ def main():
593
  "--seed", type=int, default=42,
594
  help="RNG seed for --demo mode (default: 42)",
595
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  args = parser.parse_args()
597
 
598
  if args.demo or not os.path.exists(args.sessions):
@@ -602,6 +743,30 @@ def main():
602
  else:
603
  summary = plot_from_sessions(sessions_file=args.sessions, output_dir=args.out)
604
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605
  return 0
606
 
607
 
 
96
  all_rewards: list[list[float]] = []
97
  all_breakdowns: list[list[dict]] = []
98
  episode_labels: list[str] = []
99
+ episode_model_ids: list[str] = []
100
 
101
  for ep_id, state in sessions.items():
102
  if not hasattr(state, "reward_history") or not state.reward_history:
 
104
  rewards = [float(x) for x in state.reward_history]
105
  all_rewards.append(rewards)
106
  episode_labels.append(f"Ep {ep_id[:6]}")
107
+ episode_model_ids.append(str(getattr(state, "model_id", None) or "unknown"))
108
  if hasattr(state, "reward_breakdown_history") and state.reward_breakdown_history:
109
  all_breakdowns.append(state.reward_breakdown_history)
110
 
 
117
  fig = _make_figure(
118
  all_rewards=all_rewards,
119
  episode_labels=episode_labels,
120
+ episode_model_ids=episode_model_ids,
121
  all_breakdowns=all_breakdowns if all_breakdowns else None,
122
  title="GENESIS — Training Progress",
123
  subtitle="Real session data",
 
138
  return summary
139
 
140
 
141
+ def summarize_by_model_id(sessions_file: str) -> dict[str, dict]:
142
+ """
143
+ Return per-model summaries from sessions.pkl.
144
+ Expects WorldState objects with fields: model_id, reward_history.
145
+ """
146
+ if not os.path.exists(sessions_file):
147
+ raise FileNotFoundError(f"No sessions file at {sessions_file!r}")
148
+
149
+ with open(sessions_file, "rb") as f:
150
+ sessions, _ = pickle.load(f)
151
+
152
+ buckets: dict[str, list[float]] = {}
153
+ for _, state in sessions.items():
154
+ rewards = getattr(state, "reward_history", None)
155
+ if not rewards:
156
+ continue
157
+ mid = getattr(state, "model_id", None) or "unknown"
158
+ buckets.setdefault(str(mid), []).append(float(rewards[-1]))
159
+
160
+ out: dict[str, dict] = {}
161
+ for mid, finals in sorted(buckets.items(), key=lambda kv: (-len(kv[1]), kv[0])):
162
+ out[mid] = {
163
+ "num_sessions": len(finals),
164
+ "avg_final_reward": round(float(np.mean(finals)), 4),
165
+ "best_final_reward": round(float(np.max(finals)), 4),
166
+ "worst_final_reward": round(float(np.min(finals)), 4),
167
+ }
168
+ return out
169
+
170
+
171
  # ---------------------------------------------------------------------------
172
  # Mode 2 – generate representative demo artifacts
173
  # ---------------------------------------------------------------------------
 
477
  def _make_figure(
478
  all_rewards: list[list[float]],
479
  episode_labels: list[str],
480
+ episode_model_ids: Optional[list[str]],
481
  all_breakdowns: Optional[list[list[dict]]],
482
  title: str,
483
  subtitle: str,
 
501
  spine.set_color(ax_spine_color)
502
  ax.grid(True, color="#1e293b", linestyle="--", linewidth=0.7, alpha=0.8)
503
 
504
+ # If model IDs are present, group plots by model_id to avoid a huge legend.
505
+ group_by_model = (
506
+ isinstance(episode_model_ids, list)
507
+ and len(episode_model_ids) == len(all_rewards)
508
+ and len(set(episode_model_ids)) >= 2
509
+ )
510
 
511
  # Left: per-episode raw + moving average
512
  ax = axes[0]
513
  _style(ax)
514
+ if not group_by_model:
515
+ palette = plt.cm.viridis(np.linspace(0.2, 0.9, len(all_rewards)))
516
+ for i, (rewards, label) in enumerate(zip(all_rewards, episode_labels)):
517
+ days = list(range(1, len(rewards) + 1))
518
+ ax.plot(days, rewards, color=palette[i], alpha=0.25, linewidth=0.9)
519
+ ma = _moving_average(rewards, 10)
520
+ ax.plot(_ma_x(len(rewards), len(ma)), ma, color=palette[i], linewidth=2.0, label=label)
521
+ ax.legend(
522
+ fontsize=8,
523
+ facecolor="#1e293b",
524
+ edgecolor=ax_spine_color,
525
+ labelcolor=ax_label_color,
526
+ framealpha=0.9,
527
+ )
528
+ ax.set_title("Reward per Episode (moving avg)", fontweight="bold")
529
+ else:
530
+ # Group by model_id and plot mean + band, plus a few sample episodes faintly.
531
+ from collections import defaultdict
532
+
533
+ by_model: dict[str, list[list[float]]] = defaultdict(list)
534
+ for mid, rewards in zip(episode_model_ids or [], all_rewards):
535
+ by_model[mid].append(rewards)
536
+
537
+ # Keep plot readable: highlight up to top 6 models by count.
538
+ ranked = sorted(by_model.items(), key=lambda kv: (-len(kv[1]), kv[0]))
539
+ top = ranked[:6]
540
+ rest = ranked[6:]
541
+
542
+ colors = plt.cm.tab10(np.linspace(0, 1, max(3, len(top))))
543
+
544
+ def _plot_model(mid: str, episodes: list[list[float]], color):
545
+ # Plot up to 3 sample episodes as faint lines (to show variance)
546
+ for ep in episodes[:3]:
547
+ days = list(range(1, len(ep) + 1))
548
+ ax.plot(days, ep, color=color, alpha=0.12, linewidth=0.9)
549
+ # Mean curve across aligned days (truncate to min length)
550
+ min_len = min(len(ep) for ep in episodes)
551
+ arr = np.array([ep[:min_len] for ep in episodes], dtype=float)
552
+ mean = np.mean(arr, axis=0)
553
+ std = np.std(arr, axis=0)
554
+ days = list(range(1, min_len + 1))
555
+ ax.fill_between(days, mean - std, mean + std, color=color, alpha=0.10)
556
+ ma = _moving_average(list(mean), 10)
557
+ ax.plot(_ma_x(len(mean), len(ma)), ma, color=color, linewidth=2.4, label=f"{mid} (n={len(episodes)})")
558
+
559
+ for i, (mid, episodes) in enumerate(top):
560
+ _plot_model(mid, episodes, colors[i % len(colors)])
561
+
562
+ # Plot the rest as a single grey aggregate (optional)
563
+ if rest:
564
+ merged: list[list[float]] = []
565
+ for _, eps in rest:
566
+ merged.extend(eps)
567
+ _plot_model("other", merged, GENESIS_GREY)
568
+
569
+ ax.legend(
570
+ fontsize=8,
571
+ facecolor="#1e293b",
572
+ edgecolor=ax_spine_color,
573
+ labelcolor=ax_label_color,
574
+ framealpha=0.9,
575
+ )
576
+ ax.set_title("Reward by Model (mean ± std, moving avg)", fontweight="bold")
577
  ax.set_xlabel("Simulated Day")
578
  ax.set_ylabel("Reward (0–1)")
579
  ax.set_ylim(0, 1.05)
 
 
580
 
581
  # Right: final reward progression
582
  ax2 = axes[1]
583
  _style(ax2)
584
  finals = [r[-1] for r in all_rewards]
585
  ep_nums = list(range(1, len(finals) + 1))
586
+ if not group_by_model:
587
+ ax2.scatter(ep_nums, finals, color=GENESIS_PURPLE, s=60, zorder=5)
588
+ else:
589
+ # Color points by model_id (top 6 + other)
590
+ from collections import Counter
591
+
592
+ counts = Counter(episode_model_ids or [])
593
+ top_models = [m for m, _ in counts.most_common(6)]
594
+ palette = {m: plt.cm.tab10(i / max(1, len(top_models) - 1)) for i, m in enumerate(top_models)}
595
+ colors_pt = []
596
+ for mid in episode_model_ids or []:
597
+ colors_pt.append(palette.get(mid, GENESIS_GREY))
598
+ ax2.scatter(ep_nums, finals, c=colors_pt, s=55, zorder=5)
599
+ # Legend handles
600
+ handles = []
601
+ labels = []
602
+ for m in top_models:
603
+ handles.append(plt.Line2D([0], [0], marker="o", color="w", markerfacecolor=palette[m], markersize=7))
604
+ labels.append(f"{m} (n={counts[m]})")
605
+ if len(counts) > len(top_models):
606
+ handles.append(plt.Line2D([0], [0], marker="o", color="w", markerfacecolor=GENESIS_GREY, markersize=7))
607
+ labels.append("other")
608
+ ax2.legend(
609
+ handles,
610
+ labels,
611
+ fontsize=8,
612
+ facecolor="#1e293b",
613
+ edgecolor=ax_spine_color,
614
+ labelcolor=ax_label_color,
615
+ framealpha=0.9,
616
+ loc="lower right",
617
+ )
618
  if len(finals) >= 3:
619
  ma_f = _moving_average(finals, min(3, len(finals)))
620
  ax2.plot(_ma_x(len(finals), len(ma_f)), ma_f,
 
717
  "--seed", type=int, default=42,
718
  help="RNG seed for --demo mode (default: 42)",
719
  )
720
+ parser.add_argument(
721
+ "--summarize-models",
722
+ action="store_true",
723
+ help="Include per-model_id summary in reward_summary.json",
724
+ )
725
+ parser.add_argument(
726
+ "--baseline-model-id",
727
+ type=str,
728
+ default=None,
729
+ help="If set, compute improvement vs this baseline model_id (uses avg_final_reward deltas).",
730
+ )
731
+ parser.add_argument(
732
+ "--compare-model-id",
733
+ type=str,
734
+ default=None,
735
+ help="If set with --baseline-model-id, compute delta for this specific model_id.",
736
+ )
737
  args = parser.parse_args()
738
 
739
  if args.demo or not os.path.exists(args.sessions):
 
743
  else:
744
  summary = plot_from_sessions(sessions_file=args.sessions, output_dir=args.out)
745
 
746
+ if (not args.demo) and os.path.exists(args.sessions) and args.summarize_models:
747
+ per_model = summarize_by_model_id(args.sessions)
748
+ summary["by_model_id"] = per_model
749
+
750
+ if args.baseline_model_id:
751
+ base = per_model.get(args.baseline_model_id)
752
+ summary["baseline_model_id"] = args.baseline_model_id
753
+ if base:
754
+ summary["baseline_avg_final_reward"] = base["avg_final_reward"]
755
+ else:
756
+ summary["baseline_avg_final_reward"] = None
757
+
758
+ if args.compare_model_id:
759
+ cmp_ = per_model.get(args.compare_model_id)
760
+ summary["compare_model_id"] = args.compare_model_id
761
+ if base and cmp_:
762
+ summary["improvement_over_baseline"] = round(
763
+ float(cmp_["avg_final_reward"]) - float(base["avg_final_reward"]), 4
764
+ )
765
+ else:
766
+ summary["improvement_over_baseline"] = None
767
+
768
+ _write_summary(summary, args.out)
769
+
770
  return 0
771
 
772
 
server/app.py CHANGED
@@ -4,6 +4,7 @@ Exposes tools to LLM agents for co-founding and operating a startup.
4
  """
5
 
6
  import os
 
7
  import pickle
8
  import random
9
  import uuid
 
4
  """
5
 
6
  import os
7
+ import json
8
  import pickle
9
  import random
10
  import uuid
sessions.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:50b1da3373c1567316391eaad7c82b9b0a129e6c44b532f62397743bb59483a9
3
- size 247288
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e188578dfba4c84928f19c50ab00ec2faace1f08672ed8b5c48db33b0c34fcc4
3
+ size 2356743
train_colab.py CHANGED
@@ -193,8 +193,9 @@ parser.add_argument("--fast", action="store_true",
193
  args, _ = parser.parse_known_args()
194
 
195
  if args.fast:
196
- if args.num_generations > 1:
197
- args.num_generations = 1
 
198
  if args.max_completion_length > 96:
199
  args.max_completion_length = 96
200
  if args.dataset_multiplier > 8:
 
193
  args, _ = parser.parse_known_args()
194
 
195
  if args.fast:
196
+ # GRPO requires >=2 generations per prompt (advantage calculation).
197
+ if args.num_generations != 2:
198
+ args.num_generations = 2
199
  if args.max_completion_length > 96:
200
  args.max_completion_length = 96
201
  if args.dataset_multiplier > 8: