Spaces:
Sleeping
Sleeping
model wise summary on 30 sessions each
Browse filesFiles changed (13)
- exports/founder_genomes/comparison_ollama_mistral_latest_vs_ollama_deepseek_coder_6p7b_20260426_080120.pngAdded
- exports/founder_genomes/genome_ollama_deepseek_coder_6p7b_20260426_080026.jsonAdded+31
- exports/founder_genomes/genome_ollama_deepseek_coder_6p7b_20260426_080026.pngAdded
- exports/founder_genomes/genome_ollama_mistral_latest_20260426_072711.jsonAdded
- exports/founder_genomes/genome_ollama_mistral_latest_20260426_072825.jsonAdded
- frontend/src/app/postmortem/page.tsx+8-3
- outputs/evals/reward_curves.png
- outputs/evals/reward_summary.json+25-9
- rollout_ollama.py+53-17
- scripts/plot_rewards.py+176-11
- server/app.py+1
- sessions.pkl+2-2
- train_colab.py+3-2
12345678910111213141516171819202122232425262728293031{ "profile": { "company_valuation": 0.153, "series_a_success": 0.0, "runway_management": 0.381, "product_velocity": 0.2, "customer_retention": 0.567, "team_morale": 0.776, "cofounder_alignment": 0.805, "personal_crisis_handling": 0.5, "decision_coherence": 0.88, "company_brain_quality": 0.903, "pivot_execution": 0.5 }, "metadata": { "episode_count": 30, "avg_difficulty": 1.0, "avg_days_survived": 30.0, "strengths": [ "Brain", "Coherence", "Alignment" ], "weaknesses": [ "Velocity", "Valuation", "Series A" ], "timestamp": "2026-04-26T08:00:26.167513" }}477 unmodified lines478479480481482483484485486487488477 unmodified lines}, []);const handleLoadScenario = useCallback(async (scenarioId: string) => {if (!episodeId) {// Spin up a session firstawait reset(difficulty, seed);}const eid = episodeId ?? `ep-${Math.random().toString(36).substring(2, 9)}`;setLoadingId(scenarioId);setError(null);try {477 unmodified lines478479480481482483484485486487488489490491492493477 unmodified lines}, []);const handleLoadScenario = useCallback(async (scenarioId: string) => {let eid = episodeId;if (!eid) {// Spin up a session first. Then read the newly created episodeId from the store.await reset(difficulty, seed);eid = useGenesisStore.getState().episodeId;}if (!eid) {setError("Failed to start a new session. Is the GENESIS server running?");return;}setLoadingId(scenarioId);setError(null);try {
1234567891011{"mode": "representative_run_seed_42","note": "Generated from seeded simulation; real Colab run produces similar trajectory.","num_baseline_episodes": 6,"num_trained_episodes": 12,"baseline_avg_final_reward": 0.3241,"trained_avg_final_reward": 0.5696,"improvement_pct": 75.78,"best_trained_reward": 0.7139,"worst_baseline_reward": 0.1955}123456789101112131415161718192021222324252627{"num_sessions_with_history": 70,"avg_final_reward": 0.451,"best_final_reward": 0.5022,"worst_final_reward": 0.2875,"improvement_over_baseline": null,"by_model_id": {"ollama_mistral_latest": {"num_sessions": 31,"avg_final_reward": 0.4707,"best_final_reward": 0.5022,"worst_final_reward": 0.4278},"ollama_deepseek_coder_6p7b": {"num_sessions": 30,"avg_final_reward": 0.4604,"best_final_reward": 0.4911,"worst_final_reward": 0.4178},"unknown": {"num_sessions": 9,"avg_final_reward": 0.3519,"best_final_reward": 0.463,"worst_final_reward": 0.2875}}}
18 unmodified lines19202122232438 unmodified lines63646566676869707172737475767778798081828384858687886 unmodified lines959697989910026 unmodified lines12712812913013113213318 unmodified linesfrom typing import Any, Dict, Optional, Tupleimport requestsdef _safe_json_obj(text: str) -> Optional[Dict[str, Any]]:38 unmodified linesprompt: str,temperature: float = 0.7,top_p: float = 0.95,) -> str:"""Calls Ollama HTTP API (/api/generate). Uses non-streaming for simplicity."""resp = requests.post(f"{base_url}/api/generate",json={"model": model,"prompt": prompt,"stream": False,"options": {"temperature": temperature,"top_p": top_p,},},timeout=300,)resp.raise_for_status()data = resp.json()return (data.get("response") or "").strip()def main():6 unmodified linesparser.add_argument("--episodes", type=int, default=10)parser.add_argument("--days", type=int, default=30)parser.add_argument("--seed-start", type=int, default=2000)parser.add_argument("--export-genome", action="store_true")args = parser.parse_args()26 unmodified linesbreakprompt = _build_ceo_prompt(briefing)completion = ollama_generate(args.ollama_url, args.ollama_model, prompt)parsed = _safe_json_obj(completion) or {}decision_type = str(parsed.get("decision_type") or "tactical").lower()18 unmodified lines1920212223242538 unmodified lines6465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111126 unmodified lines11912012112212312412512612712826 unmodified lines15515615715815916016116216316416516616716816918 unmodified linesfrom typing import Any, Dict, Optional, Tupleimport requestsfrom requests.exceptions import ReadTimeout, ConnectionError as RequestsConnectionErrordef _safe_json_obj(text: str) -> Optional[Dict[str, Any]]:38 unmodified linesprompt: str,temperature: float = 0.7,top_p: float = 0.95,timeout_s: int = 300,max_tokens: Optional[int] = 256,num_ctx: Optional[int] = 4096,retries: int = 2,) -> str:"""Calls Ollama HTTP API (/api/generate). Uses non-streaming for simplicity."""url = f"{base_url}/api/generate"# Retry strategy: first try normal; if it times out, retry with shorter output.last_err: Optional[Exception] = Nonefor attempt in range(retries + 1):effective_max = max_tokenseffective_timeout = timeout_sif attempt >= 1:# Make retries more likely to return quicklyeffective_timeout = max(timeout_s, 900)if effective_max is None:effective_max = 128else:effective_max = max(64, int(effective_max * 0.6))options: Dict[str, Any] = {"temperature": temperature, "top_p": top_p}if effective_max is not None:options["num_predict"] = int(effective_max)if num_ctx is not None:options["num_ctx"] = int(num_ctx)try:resp = requests.post(url,json={"model": model, "prompt": prompt, "stream": False, "options": options},timeout=effective_timeout,)resp.raise_for_status()data = resp.json()return (data.get("response") or "").strip()except (ReadTimeout, RequestsConnectionError, requests.HTTPError) as e:last_err = etime.sleep(1.0 + attempt * 0.5)raise last_err if last_err else RuntimeError("Ollama request failed with unknown error")def main():6 unmodified linesparser.add_argument("--episodes", type=int, default=10)parser.add_argument("--days", type=int, default=30)parser.add_argument("--seed-start", type=int, default=2000)parser.add_argument("--ollama-timeout", type=int, default=900, help="HTTP timeout per generation (seconds).")parser.add_argument("--ollama-retries", type=int, default=2, help="Retries on timeout/connection errors.")parser.add_argument("--max-tokens", type=int, default=256, help="Max tokens to generate per day.")parser.add_argument("--num-ctx", type=int, default=4096, help="Context window sent to Ollama.")parser.add_argument("--export-genome", action="store_true")args = parser.parse_args()26 unmodified linesbreakprompt = _build_ceo_prompt(briefing)completion = ollama_generate(args.ollama_url,args.ollama_model,prompt,timeout_s=args.ollama_timeout,retries=args.ollama_retries,max_tokens=args.max_tokens,num_ctx=args.num_ctx,)parsed = _safe_json_obj(completion) or {}decision_type = str(parsed.get("decision_type") or "tactical").lower()
95 unmodified lines969798991001011 unmodified line1031041051061071086 unmodified lines11511611711811912014 unmodified lines135136137138139140303 unmodified lines44444544644744844917 unmodified lines46746846947047147247347447547647747847948048148248348448548648748848949049149249349449549696 unmodified lines5935945955965975983 unmodified lines60260360460560660795 unmodified linesall_rewards: list[list[float]] = []all_breakdowns: list[list[dict]] = []episode_labels: list[str] = []for ep_id, state in sessions.items():if not hasattr(state, "reward_history") or not state.reward_history:1 unmodified linerewards = [float(x) for x in state.reward_history]all_rewards.append(rewards)episode_labels.append(f"Ep {ep_id[:6]}")if hasattr(state, "reward_breakdown_history") and state.reward_breakdown_history:all_breakdowns.append(state.reward_breakdown_history)6 unmodified linesfig = _make_figure(all_rewards=all_rewards,episode_labels=episode_labels,all_breakdowns=all_breakdowns if all_breakdowns else None,title="GENESIS — Training Progress",subtitle="Real session data",14 unmodified linesreturn summary# ---------------------------------------------------------------------------# Mode 2 – generate representative demo artifacts# ---------------------------------------------------------------------------303 unmodified linesdef _make_figure(all_rewards: list[list[float]],episode_labels: list[str],all_breakdowns: Optional[list[list[dict]]],title: str,subtitle: str,17 unmodified linesspine.set_color(ax_spine_color)ax.grid(True, color="#1e293b", linestyle="--", linewidth=0.7, alpha=0.8)palette = plt.cm.viridis(np.linspace(0.2, 0.9, len(all_rewards)))# Left: per-episode raw + moving averageax = axes[0]_style(ax)for i, (rewards, label) in enumerate(zip(all_rewards, episode_labels)):days = list(range(1, len(rewards) + 1))ax.plot(days, rewards, color=palette[i], alpha=0.25, linewidth=0.9)ma = _moving_average(rewards, 10)ax.plot(_ma_x(len(rewards), len(ma)), ma,color=palette[i], linewidth=2.0, label=label)ax.set_title("Reward per Episode (moving avg)", fontweight="bold")ax.set_xlabel("Simulated Day")ax.set_ylabel("Reward (0–1)")ax.set_ylim(0, 1.05)ax.legend(fontsize=8, facecolor="#1e293b", edgecolor=ax_spine_color,labelcolor=ax_label_color, framealpha=0.9)# Right: final reward progressionax2 = axes[1]_style(ax2)finals = [r[-1] for r in all_rewards]ep_nums = list(range(1, len(finals) + 1))ax2.scatter(ep_nums, finals, color=GENESIS_PURPLE, s=60, zorder=5)if len(finals) >= 3:ma_f = _moving_average(finals, min(3, len(finals)))ax2.plot(_ma_x(len(finals), len(ma_f)), ma_f,96 unmodified lines"--seed", type=int, default=42,help="RNG seed for --demo mode (default: 42)",)args = parser.parse_args()if args.demo or not os.path.exists(args.sessions):3 unmodified lineselse:summary = plot_from_sessions(sessions_file=args.sessions, output_dir=args.out)return 095 unmodified lines969798991001011021 unmodified line1041051061071081091106 unmodified lines11711811912012112212314 unmodified lines138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173303 unmodified lines47747847948048148248317 unmodified lines50150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962096 unmodified lines7177187197207217227237247257267277287297307317327337347357367377387393 unmodified lines74374474574674774874975075175275375475575675775875976076176276376476576676776876977077177295 unmodified linesall_rewards: list[list[float]] = []all_breakdowns: list[list[dict]] = []episode_labels: list[str] = []episode_model_ids: list[str] = []for ep_id, state in sessions.items():if not hasattr(state, "reward_history") or not state.reward_history:1 unmodified linerewards = [float(x) for x in state.reward_history]all_rewards.append(rewards)episode_labels.append(f"Ep {ep_id[:6]}")episode_model_ids.append(str(getattr(state, "model_id", None) or "unknown"))if hasattr(state, "reward_breakdown_history") and state.reward_breakdown_history:all_breakdowns.append(state.reward_breakdown_history)6 unmodified linesfig = _make_figure(all_rewards=all_rewards,episode_labels=episode_labels,episode_model_ids=episode_model_ids,all_breakdowns=all_breakdowns if all_breakdowns else None,title="GENESIS — Training Progress",subtitle="Real session data",14 unmodified linesreturn summarydef summarize_by_model_id(sessions_file: str) -> dict[str, dict]:"""Return per-model summaries from sessions.pkl.Expects WorldState objects with fields: model_id, reward_history."""if not os.path.exists(sessions_file):raise FileNotFoundError(f"No sessions file at {sessions_file!r}")with open(sessions_file, "rb") as f:sessions, _ = pickle.load(f)buckets: dict[str, list[float]] = {}for _, state in sessions.items():rewards = getattr(state, "reward_history", None)if not rewards:continuemid = getattr(state, "model_id", None) or "unknown"buckets.setdefault(str(mid), []).append(float(rewards[-1]))out: dict[str, dict] = {}for mid, finals in sorted(buckets.items(), key=lambda kv: (-len(kv[1]), kv[0])):out[mid] = {"num_sessions": len(finals),"avg_final_reward": round(float(np.mean(finals)), 4),"best_final_reward": round(float(np.max(finals)), 4),"worst_final_reward": round(float(np.min(finals)), 4),}return out# ---------------------------------------------------------------------------# Mode 2 – generate representative demo artifacts# ---------------------------------------------------------------------------303 unmodified linesdef _make_figure(all_rewards: list[list[float]],episode_labels: list[str],episode_model_ids: Optional[list[str]],all_breakdowns: Optional[list[list[dict]]],title: str,subtitle: str,17 unmodified linesspine.set_color(ax_spine_color)ax.grid(True, color="#1e293b", linestyle="--", linewidth=0.7, alpha=0.8)# If model IDs are present, group plots by model_id to avoid a huge legend.group_by_model = (isinstance(episode_model_ids, list)and len(episode_model_ids) == len(all_rewards)and len(set(episode_model_ids)) >= 2)# Left: per-episode raw + moving averageax = axes[0]_style(ax)if not group_by_model:palette = plt.cm.viridis(np.linspace(0.2, 0.9, len(all_rewards)))for i, (rewards, label) in enumerate(zip(all_rewards, episode_labels)):days = list(range(1, len(rewards) + 1))ax.plot(days, rewards, color=palette[i], alpha=0.25, linewidth=0.9)ma = _moving_average(rewards, 10)ax.plot(_ma_x(len(rewards), len(ma)), ma, color=palette[i], linewidth=2.0, label=label)ax.legend(fontsize=8,facecolor="#1e293b",edgecolor=ax_spine_color,labelcolor=ax_label_color,framealpha=0.9,)ax.set_title("Reward per Episode (moving avg)", fontweight="bold")else:# Group by model_id and plot mean + band, plus a few sample episodes faintly.from collections import defaultdictby_model: dict[str, list[list[float]]] = defaultdict(list)for mid, rewards in zip(episode_model_ids or [], all_rewards):by_model[mid].append(rewards)# Keep plot readable: highlight up to top 6 models by count.ranked = sorted(by_model.items(), key=lambda kv: (-len(kv[1]), kv[0]))top = ranked[:6]rest = ranked[6:]colors = plt.cm.tab10(np.linspace(0, 1, max(3, len(top))))def _plot_model(mid: str, episodes: list[list[float]], color):# Plot up to 3 sample episodes as faint lines (to show variance)for ep in episodes[:3]:days = list(range(1, len(ep) + 1))ax.plot(days, ep, color=color, alpha=0.12, linewidth=0.9)# Mean curve across aligned days (truncate to min length)min_len = min(len(ep) for ep in episodes)arr = np.array([ep[:min_len] for ep in episodes], dtype=float)mean = np.mean(arr, axis=0)std = np.std(arr, axis=0)days = list(range(1, min_len + 1))ax.fill_between(days, mean - std, mean + std, color=color, alpha=0.10)ma = _moving_average(list(mean), 10)ax.plot(_ma_x(len(mean), len(ma)), ma, color=color, linewidth=2.4, label=f"{mid} (n={len(episodes)})")for i, (mid, episodes) in enumerate(top):_plot_model(mid, episodes, colors[i % len(colors)])# Plot the rest as a single grey aggregate (optional)if rest:merged: list[list[float]] = []for _, eps in rest:merged.extend(eps)_plot_model("other", merged, GENESIS_GREY)ax.legend(fontsize=8,facecolor="#1e293b",edgecolor=ax_spine_color,labelcolor=ax_label_color,framealpha=0.9,)ax.set_title("Reward by Model (mean ± std, moving avg)", fontweight="bold")ax.set_xlabel("Simulated Day")ax.set_ylabel("Reward (0–1)")ax.set_ylim(0, 1.05)# Right: final reward progressionax2 = axes[1]_style(ax2)finals = [r[-1] for r in all_rewards]ep_nums = list(range(1, len(finals) + 1))if not group_by_model:ax2.scatter(ep_nums, finals, color=GENESIS_PURPLE, s=60, zorder=5)else:# Color points by model_id (top 6 + other)from collections import Countercounts = Counter(episode_model_ids or [])top_models = [m for m, _ in counts.most_common(6)]palette = {m: plt.cm.tab10(i / max(1, len(top_models) - 1)) for i, m in enumerate(top_models)}colors_pt = []for mid in episode_model_ids or []:colors_pt.append(palette.get(mid, GENESIS_GREY))ax2.scatter(ep_nums, finals, c=colors_pt, s=55, zorder=5)# Legend handleshandles = []labels = []for m in top_models:handles.append(plt.Line2D([0], [0], marker="o", color="w", markerfacecolor=palette[m], markersize=7))labels.append(f"{m} (n={counts[m]})")if len(counts) > len(top_models):handles.append(plt.Line2D([0], [0], marker="o", color="w", markerfacecolor=GENESIS_GREY, markersize=7))labels.append("other")ax2.legend(handles,labels,fontsize=8,facecolor="#1e293b",edgecolor=ax_spine_color,labelcolor=ax_label_color,framealpha=0.9,loc="lower right",)if len(finals) >= 3:ma_f = _moving_average(finals, min(3, len(finals)))ax2.plot(_ma_x(len(finals), len(ma_f)), ma_f,96 unmodified lines"--seed", type=int, default=42,help="RNG seed for --demo mode (default: 42)",)parser.add_argument("--summarize-models",action="store_true",help="Include per-model_id summary in reward_summary.json",)parser.add_argument("--baseline-model-id",type=str,default=None,help="If set, compute improvement vs this baseline model_id (uses avg_final_reward deltas).",)parser.add_argument("--compare-model-id",type=str,default=None,help="If set with --baseline-model-id, compute delta for this specific model_id.",)args = parser.parse_args()if args.demo or not os.path.exists(args.sessions):3 unmodified lineselse:summary = plot_from_sessions(sessions_file=args.sessions, output_dir=args.out)if (not args.demo) and os.path.exists(args.sessions) and args.summarize_models:per_model = summarize_by_model_id(args.sessions)summary["by_model_id"] = per_modelif args.baseline_model_id:base = per_model.get(args.baseline_model_id)summary["baseline_model_id"] = args.baseline_model_idif base:summary["baseline_avg_final_reward"] = base["avg_final_reward"]else:summary["baseline_avg_final_reward"] = Noneif args.compare_model_id:cmp_ = per_model.get(args.compare_model_id)summary["compare_model_id"] = args.compare_model_idif base and cmp_:summary["improvement_over_baseline"] = round(float(cmp_["avg_final_reward"]) - float(base["avg_final_reward"]), 4)else:summary["improvement_over_baseline"] = None_write_summary(summary, args.out)return 0
3 unmodified lines4567893 unmodified lines"""import osimport pickleimport randomimport uuid3 unmodified lines456789103 unmodified lines"""import osimport jsonimport pickleimport randomimport uuid
123version https://git-lfs.github.com/spec/v1oid sha256:50b1da3373c1567316391eaad7c82b9b0a129e6c44b532f62397743bb59483a9size 247288123version https://git-lfs.github.com/spec/v1oid sha256:e188578dfba4c84928f19c50ab00ec2faace1f08672ed8b5c48db33b0c34fcc4size 2356743
192 unmodified lines193194195196197198199200192 unmodified linesargs, _ = parser.parse_known_args()if args.fast:if args.num_generations > 1:args.num_generations = 1if args.max_completion_length > 96:args.max_completion_length = 96if args.dataset_multiplier > 8:192 unmodified lines193194195196197198199200201192 unmodified linesargs, _ = parser.parse_known_args()if args.fast:# GRPO requires >=2 generations per prompt (advantage calculation).if args.num_generations != 2:args.num_generations = 2if args.max_completion_length > 96:args.max_completion_length = 96if args.dataset_multiplier > 8:
exports/founder_genomes/comparison_ollama_mistral_latest_vs_ollama_deepseek_coder_6p7b_20260426_080120.pngAdded

Large File Pointer Details
- SHA256: 743db57511343b66c33cd75fc60c187ea53a7dcd47d59062a38d46784120ff90
- Pointer size: 131 Bytes
- Size of remote file: 604 kB
exports/founder_genomes/genome_ollama_deepseek_coder_6p7b_20260426_080026.jsonAdded+31
exports/founder_genomes/genome_ollama_deepseek_coder_6p7b_20260426_080026.pngAdded

Large File Pointer Details
- SHA256: e8cf5d326f902af12d1cab2672787bf027c3b3e1c769ec3c6ceca2d0813d0b1c
- Pointer size: 131 Bytes
- Size of remote file: 453 kB
exports/founder_genomes/genome_ollama_mistral_latest_20260426_072711.jsonAdded
exports/founder_genomes/genome_ollama_mistral_latest_20260426_072825.jsonAdded
frontend/src/app/postmortem/page.tsx+8-3
outputs/evals/reward_curves.png

Large File Pointer Details
- SHA256: 5b6b46c9fe9409ba3a46ca01e91ac7833e28b9e2da9b5c9143620b8858b9b310
- Pointer size: 130 Bytes
- Size of remote file: 76.1 kB

Large File Pointer Details
- SHA256: a023e00499f04df209e6d6ef8b369daee9f78d74981e234c11d0c4ccaa93aa31
- Pointer size: 131 Bytes
- Size of remote file: 187 kB
outputs/evals/reward_summary.json+25-9
rollout_ollama.py+53-17
scripts/plot_rewards.py+176-11
server/app.py+1
sessions.pkl+2-2
train_colab.py+3-2