feat: add evaluation and plotting scripts for CORP-ENV
Browse filesIntroduced eval.py for evaluating CORP-ENV policies with various models and outputting results in JSONL format. Added plot_results.py to generate visualizations from evaluation data, including average terminal rewards and invalid action rates. Updated .gitignore to exclude new plan files and added optional dependencies for plotting and training in pyproject.toml. Enhanced README.md with examples for evaluation and plotting usage, and included a new runbook for Lightning AI and Hugging Face integration.
- .gitignore +1 -0
- README.md +45 -0
- data/processed/h1_seed_clean.jsonl +8 -0
- data/processed/h1_seed_rejected.jsonl +0 -0
- data/raw/h1_seed.jsonl +8 -0
- data/sft/h1_seed.jsonl +0 -0
- docs/lightning_hf_runbook.md +111 -0
- eval.py +292 -0
- plot_results.py +134 -0
- pyproject.toml +18 -0
- results/baseline_eval.jsonl +3 -0
- results/h1_seed_all.jsonl +8 -0
- results/h1_seed_summary.json +16 -0
- results/invalid_action_rate.png +3 -0
- results/model_comparison.png +3 -0
- results/oracle_eval.jsonl +3 -0
- results/reward_curve.png +3 -0
- results/success_by_task.png +3 -0
- scripts/_trajectory_utils.py +436 -0
- scripts/generate_sft_data.py +52 -0
- scripts/prepare_sft_data.py +76 -0
- scripts/verify_examples.py +143 -0
- tests/test_pipeline.py +66 -0
- training/train_grpo.py +224 -0
- training/train_sft.py +119 -0
- uv.lock +0 -0
.gitignore
CHANGED
|
@@ -61,3 +61,4 @@ logs/
|
|
| 61 |
.gitignore
|
| 62 |
.cursor/plans/corp-env_personas_memory_ease_dd6044eb.plan.md
|
| 63 |
\[External] Meta OpenEnv Hackathon Participant Help Guide.pdf
|
|
|
|
|
|
| 61 |
.gitignore
|
| 62 |
.cursor/plans/corp-env_personas_memory_ease_dd6044eb.plan.md
|
| 63 |
\[External] Meta OpenEnv Hackathon Participant Help Guide.pdf
|
| 64 |
+
.cursor/plans/corp-env_hackathon_readiness_9cbb1a3d.plan.md
|
README.md
CHANGED
|
@@ -24,6 +24,11 @@ This repo replaces the earlier Jira-to-Code baseline (preserved as git tag `vali
|
|
| 24 |
| `delegate` | Call a worker (`agent_id` + `payload` task text). |
|
| 25 |
| `update_swd` | RFC **6902 JSON Patch** on the SWD (`payload` = patch JSON array string). |
|
| 26 |
| `query_swd` | Read-only **JSONPath** over the SWD. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
| `finalize` | End episode; terminal reward from verifiers + rubric. |
|
| 28 |
|
| 29 |
## Tasks
|
|
@@ -60,6 +65,46 @@ uv run python inference.py
|
|
| 60 |
uv run python inference.py --tasks e1_launch_readiness --max-steps 25 --swd-trace logs/run.jsonl
|
| 61 |
```
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
## OpenEnv validation
|
| 64 |
|
| 65 |
```powershell
|
|
|
|
| 24 |
| `delegate` | Call a worker (`agent_id` + `payload` task text). |
|
| 25 |
| `update_swd` | RFC **6902 JSON Patch** on the SWD (`payload` = patch JSON array string). |
|
| 26 |
| `query_swd` | Read-only **JSONPath** over the SWD. |
|
| 27 |
+
| `log_reasoning` | Append a structured reasoning note to the SWD. |
|
| 28 |
+
| `log_decision` | Append a decision note to the SWD. |
|
| 29 |
+
| `log_conflict` | Append a conflict object to `conflicts_identified`. |
|
| 30 |
+
| `log_resolution` | Append a conflict-resolution object to `conflict_resolutions`. |
|
| 31 |
+
| `advance_phase` | Move the SWD phase through `analysis`, `decision`, or `execution`. |
|
| 32 |
| `finalize` | End episode; terminal reward from verifiers + rubric. |
|
| 33 |
|
| 34 |
## Tasks
|
|
|
|
| 65 |
uv run python inference.py --tasks e1_launch_readiness --max-steps 25 --swd-trace logs/run.jsonl
|
| 66 |
```
|
| 67 |
|
| 68 |
+
## Example verification and SFT data
|
| 69 |
+
|
| 70 |
+
Replay generated examples against the current environment before training:
|
| 71 |
+
|
| 72 |
+
```powershell
|
| 73 |
+
uv run python scripts/verify_examples.py --input data/raw/e1_m1_examples.jsonl --clean data/processed/e1_m1_clean.jsonl --rejected data/processed/e1_m1_rejected.jsonl
|
| 74 |
+
uv run python scripts/prepare_sft_data.py --input data/processed/e1_m1_clean.jsonl --output data/sft/e1_m1_examples.jsonl
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
Generate a small H1 seed set if needed:
|
| 78 |
+
|
| 79 |
+
```powershell
|
| 80 |
+
uv run python scripts/generate_sft_data.py --tasks h1_acquisition_defence --per-task 8 --output data/raw/h1_seed.jsonl
|
| 81 |
+
uv run python scripts/verify_examples.py --input data/raw/h1_seed.jsonl --clean data/processed/h1_seed_clean.jsonl --rejected data/processed/h1_seed_rejected.jsonl
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
## Training
|
| 85 |
+
|
| 86 |
+
Training scripts are intended for a GPU machine such as Lightning AI H100:
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
pip install -e ".[training]"
|
| 90 |
+
python training/train_sft.py --model Qwen/Qwen2.5-7B-Instruct --data data/sft/e1_m1_examples.jsonl --output outputs/sft_adapter
|
| 91 |
+
python training/train_grpo.py --model Qwen/Qwen2.5-7B-Instruct --adapter outputs/sft_adapter --output outputs/grpo_adapter
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
See [`docs/lightning_hf_runbook.md`](docs/lightning_hf_runbook.md) for the short-session H100 + Hugging Face workflow.
|
| 95 |
+
|
| 96 |
+
## Evaluation and plots
|
| 97 |
+
|
| 98 |
+
Evaluate all model stages through the same environment:
|
| 99 |
+
|
| 100 |
+
```powershell
|
| 101 |
+
uv run python eval.py --policy scripted_weak --label baseline --output results/baseline_eval.jsonl
|
| 102 |
+
uv run python eval.py --policy oracle --label oracle --output results/oracle_eval.jsonl
|
| 103 |
+
uv run python plot_results.py --inputs results/baseline_eval.jsonl results/oracle_eval.jsonl --output-dir results
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
For trained adapters on a GPU box, use `eval.py --policy hf --model <base_model> --adapter <adapter_path>`.
|
| 107 |
+
|
| 108 |
## OpenEnv validation
|
| 109 |
|
| 110 |
```powershell
|
data/processed/h1_seed_clean.jsonl
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"example_id": "seed-h1_acquisition_defence-000", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "108237bb-ff40-416f-9643-4c7996c2f1f3", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 2 |
+
{"example_id": "seed-h1_acquisition_defence-001", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "9e807708-91f0-4721-a641-194f1b542cda", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 3 |
+
{"example_id": "seed-h1_acquisition_defence-002", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "36ef9083-bbbd-489f-a43b-f70d729706a4", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 4 |
+
{"example_id": "seed-h1_acquisition_defence-003", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "44f98cfa-399e-4cdb-8e6a-8556c926fef3", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 5 |
+
{"example_id": "seed-h1_acquisition_defence-004", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "6dfe4890-f94c-4444-b071-0c0ad9adfdd8", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 6 |
+
{"example_id": "seed-h1_acquisition_defence-005", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "e708e971-4f8d-4a5a-8ee5-3eca202b8154", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 7 |
+
{"example_id": "seed-h1_acquisition_defence-006", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "466a243a-f657-4765-828f-4bfa9d08ce32", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 8 |
+
{"example_id": "seed-h1_acquisition_defence-007", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "717c90d4-63a3-4572-a49f-80a468be68c4", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
data/processed/h1_seed_rejected.jsonl
ADDED
|
File without changes
|
data/raw/h1_seed.jsonl
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"example_id": "seed-h1_acquisition_defence-000", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
| 2 |
+
{"example_id": "seed-h1_acquisition_defence-001", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
| 3 |
+
{"example_id": "seed-h1_acquisition_defence-002", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
| 4 |
+
{"example_id": "seed-h1_acquisition_defence-003", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
| 5 |
+
{"example_id": "seed-h1_acquisition_defence-004", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
| 6 |
+
{"example_id": "seed-h1_acquisition_defence-005", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
| 7 |
+
{"example_id": "seed-h1_acquisition_defence-006", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
| 8 |
+
{"example_id": "seed-h1_acquisition_defence-007", "task_id": "h1_acquisition_defence", "source": "scripted_seed", "actions": [{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"action_type": "advance_phase", "payload": "analysis"}, {"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"action_type": "advance_phase", "payload": "decision"}, {"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"action_type": "advance_phase", "payload": "execution"}, {"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}]}
|
data/sft/h1_seed.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
docs/lightning_hf_runbook.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Lightning AI + Hugging Face Runbook
|
| 2 |
+
|
| 3 |
+
This runbook is optimized for short 3-4 hour H100 windows and Hugging Face credits.
|
| 4 |
+
|
| 5 |
+
## 1. Prepare Artifacts Locally
|
| 6 |
+
|
| 7 |
+
```powershell
|
| 8 |
+
uv sync --extra dev --extra plots
|
| 9 |
+
uv run python scripts/generate_sft_data.py --tasks h1_acquisition_defence --per-task 8 --output data/raw/h1_seed.jsonl
|
| 10 |
+
uv run python scripts/verify_examples.py --input data/raw/e1_m1_examples.jsonl --clean data/processed/e1_m1_clean.jsonl --rejected data/processed/e1_m1_rejected.jsonl
|
| 11 |
+
uv run python scripts/verify_examples.py --input data/raw/h1_seed.jsonl --clean data/processed/h1_seed_clean.jsonl --rejected data/processed/h1_seed_rejected.jsonl
|
| 12 |
+
uv run python scripts/prepare_sft_data.py --input data/processed/e1_m1_clean.jsonl --output data/sft/e1_m1_examples.jsonl
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
Keep raw examples untouched. Train only from verified `data/processed/*_clean.jsonl` and `data/sft/*.jsonl`.
|
| 16 |
+
|
| 17 |
+
## 2. Upload Dataset To Hugging Face
|
| 18 |
+
|
| 19 |
+
```powershell
|
| 20 |
+
huggingface-cli login
|
| 21 |
+
huggingface-cli repo create corp-env-data --type dataset
|
| 22 |
+
huggingface-cli upload <your-user-or-org>/corp-env-data data/sft/e1_m1_examples.jsonl data/sft/e1_m1_examples.jsonl --repo-type dataset
|
| 23 |
+
huggingface-cli upload <your-user-or-org>/corp-env-data data/processed/e1_m1_clean.jsonl data/processed/e1_m1_clean.jsonl --repo-type dataset
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Also upload `data/processed/h1_seed_clean.jsonl` if the H1 seed passes verification.
|
| 27 |
+
|
| 28 |
+
## 3. Lightning H100 Session 1: SFT
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
git clone <repo-url> corp_gym
|
| 32 |
+
cd corp_gym
|
| 33 |
+
python -m venv .venv
|
| 34 |
+
source .venv/bin/activate
|
| 35 |
+
pip install -U pip
|
| 36 |
+
pip install -e ".[training]"
|
| 37 |
+
huggingface-cli login
|
| 38 |
+
python training/train_sft.py \
|
| 39 |
+
--model Qwen/Qwen2.5-7B-Instruct \
|
| 40 |
+
--data data/sft/e1_m1_examples.jsonl \
|
| 41 |
+
--output outputs/sft_adapter \
|
| 42 |
+
--epochs 2 \
|
| 43 |
+
--push-to-hub <your-user-or-org>/corp-env-sft-adapter
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
If setup time is short, use a 7B model. If the session is stable and examples are clean, try a 14B model for the SFT demo.
|
| 47 |
+
|
| 48 |
+
## 4. Lightning H100 Session 2: Eval SFT
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
pip install -e ".[training,plots]"
|
| 52 |
+
python eval.py --policy scripted_weak --label baseline --output results/baseline_eval.jsonl
|
| 53 |
+
python eval.py --policy hf \
|
| 54 |
+
--label sft \
|
| 55 |
+
--model Qwen/Qwen2.5-7B-Instruct \
|
| 56 |
+
--adapter outputs/sft_adapter \
|
| 57 |
+
--output results/sft_eval.jsonl
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Push `results/*.jsonl` to Hugging Face or copy them back before the Lightning account expires.
|
| 61 |
+
|
| 62 |
+
## 5. Lightning H100 Session 3: GRPO
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
python training/train_grpo.py \
|
| 66 |
+
--model Qwen/Qwen2.5-7B-Instruct \
|
| 67 |
+
--adapter outputs/sft_adapter \
|
| 68 |
+
--output outputs/grpo_adapter \
|
| 69 |
+
--tasks e1_launch_readiness,m1_budget_reallocation \
|
| 70 |
+
--max-steps 150 \
|
| 71 |
+
--push-to-hub <your-user-or-org>/corp-env-grpo-adapter
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Start with E1/M1. Add H1 only after E1/M1 rewards are non-zero and invalid action rate is low.
|
| 75 |
+
|
| 76 |
+
## 6. Final Eval And Plots
|
| 77 |
+
|
| 78 |
+
```bash
|
| 79 |
+
python eval.py --policy hf \
|
| 80 |
+
--label grpo \
|
| 81 |
+
--model Qwen/Qwen2.5-7B-Instruct \
|
| 82 |
+
--adapter outputs/grpo_adapter \
|
| 83 |
+
--output results/grpo_eval.jsonl
|
| 84 |
+
python plot_results.py \
|
| 85 |
+
--inputs results/baseline_eval.jsonl results/sft_eval.jsonl results/grpo_eval.jsonl \
|
| 86 |
+
--output-dir results
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
Commit or upload the resulting PNGs:
|
| 90 |
+
|
| 91 |
+
- `results/model_comparison.png`
|
| 92 |
+
- `results/success_by_task.png`
|
| 93 |
+
- `results/invalid_action_rate.png`
|
| 94 |
+
- `results/reward_curve.png`
|
| 95 |
+
|
| 96 |
+
## 7. Hugging Face Space
|
| 97 |
+
|
| 98 |
+
Use HF credits for the official hosted OpenEnv environment:
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
uv run openenv validate
|
| 102 |
+
docker build -t corp-env .
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
After pushing the Space, validate it:
|
| 106 |
+
|
| 107 |
+
```bash
|
| 108 |
+
./validate-submission.sh https://<your-space>.hf.space .
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
On Windows, run the validator from WSL or Git Bash.
|
eval.py
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Evaluate CORP-ENV policies through the real OpenEnv environment.
|
| 2 |
+
|
| 3 |
+
Examples:
|
| 4 |
+
uv run python eval.py --policy scripted_weak --output results/baseline_eval.jsonl
|
| 5 |
+
uv run python eval.py --policy oracle --output results/oracle_eval.jsonl
|
| 6 |
+
uv run python eval.py --policy openai --model Qwen/Qwen2.5-7B-Instruct
|
| 7 |
+
uv run python eval.py --policy hf --model outputs/sft_adapter --adapter outputs/grpo_adapter
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import argparse
|
| 13 |
+
import json
|
| 14 |
+
import os
|
| 15 |
+
import sys
|
| 16 |
+
from pathlib import Path
|
| 17 |
+
from typing import Any, Dict, List, Optional
|
| 18 |
+
|
| 19 |
+
from dotenv import load_dotenv
|
| 20 |
+
from openai import OpenAI
|
| 21 |
+
|
| 22 |
+
ROOT = Path(__file__).resolve().parent
|
| 23 |
+
if str(ROOT) not in sys.path:
|
| 24 |
+
sys.path.insert(0, str(ROOT))
|
| 25 |
+
|
| 26 |
+
from corp_env.models import CorpAction # noqa: E402
|
| 27 |
+
from scripts._trajectory_utils import ( # noqa: E402
|
| 28 |
+
DEFAULT_TASKS,
|
| 29 |
+
extract_json_object,
|
| 30 |
+
normalize_action_obj,
|
| 31 |
+
observation_message,
|
| 32 |
+
oracle_actions,
|
| 33 |
+
write_jsonl,
|
| 34 |
+
)
|
| 35 |
+
from server.agents.master_prompts import build_system_prompt # noqa: E402
|
| 36 |
+
from server.environment import CorpEnvironment # noqa: E402
|
| 37 |
+
from server.llm_env import openai_client_kwargs_master # noqa: E402
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def weak_actions(task_id: str) -> List[Dict[str, Any]]:
|
| 41 |
+
"""A deliberately weak, deterministic baseline for no-GPU smoke comparisons."""
|
| 42 |
+
if task_id == "e1_launch_readiness":
|
| 43 |
+
return [
|
| 44 |
+
{
|
| 45 |
+
"action_type": "delegate",
|
| 46 |
+
"agent_id": "qa_engineer",
|
| 47 |
+
"payload": "Give launch status.",
|
| 48 |
+
},
|
| 49 |
+
{"action_type": "finalize", "payload": "GO"},
|
| 50 |
+
]
|
| 51 |
+
if task_id == "m1_budget_reallocation":
|
| 52 |
+
return [
|
| 53 |
+
{
|
| 54 |
+
"action_type": "delegate",
|
| 55 |
+
"agent_id": "dev_lead",
|
| 56 |
+
"payload": "Say whether we need GPUs.",
|
| 57 |
+
},
|
| 58 |
+
{"action_type": "finalize", "payload": json.dumps({"phase_1": "Buy GPUs now."})},
|
| 59 |
+
]
|
| 60 |
+
return [
|
| 61 |
+
{"action_type": "delegate", "agent_id": "cto", "payload": "Assess acquisition offer."},
|
| 62 |
+
{
|
| 63 |
+
"action_type": "finalize",
|
| 64 |
+
"payload": json.dumps(
|
| 65 |
+
{
|
| 66 |
+
"counter_offer": "Ask for more.",
|
| 67 |
+
"deadline": "Soon.",
|
| 68 |
+
"retention_plan": "Keep key staff.",
|
| 69 |
+
}
|
| 70 |
+
),
|
| 71 |
+
},
|
| 72 |
+
]
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class HFPolicy:
|
| 76 |
+
def __init__(self, model: str, adapter: Optional[str], max_new_tokens: int) -> None:
|
| 77 |
+
try:
|
| 78 |
+
import torch
|
| 79 |
+
from peft import PeftModel
|
| 80 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 81 |
+
except ImportError as exc:
|
| 82 |
+
raise SystemExit(
|
| 83 |
+
"HF evaluation requires torch, transformers, and peft. "
|
| 84 |
+
"Install the training extras on the GPU machine."
|
| 85 |
+
) from exc
|
| 86 |
+
|
| 87 |
+
self.torch = torch
|
| 88 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model, trust_remote_code=True)
|
| 89 |
+
self.model = AutoModelForCausalLM.from_pretrained(
|
| 90 |
+
model,
|
| 91 |
+
device_map="auto",
|
| 92 |
+
torch_dtype=torch.bfloat16,
|
| 93 |
+
trust_remote_code=True,
|
| 94 |
+
)
|
| 95 |
+
if adapter:
|
| 96 |
+
self.model = PeftModel.from_pretrained(self.model, adapter)
|
| 97 |
+
self.max_new_tokens = max_new_tokens
|
| 98 |
+
|
| 99 |
+
def complete(self, messages: List[Dict[str, str]]) -> str:
|
| 100 |
+
prompt = self.tokenizer.apply_chat_template(
|
| 101 |
+
messages,
|
| 102 |
+
tokenize=False,
|
| 103 |
+
add_generation_prompt=True,
|
| 104 |
+
)
|
| 105 |
+
inputs = self.tokenizer(prompt, return_tensors="pt").to(self.model.device)
|
| 106 |
+
with self.torch.no_grad():
|
| 107 |
+
out = self.model.generate(
|
| 108 |
+
**inputs,
|
| 109 |
+
max_new_tokens=self.max_new_tokens,
|
| 110 |
+
do_sample=False,
|
| 111 |
+
pad_token_id=self.tokenizer.eos_token_id,
|
| 112 |
+
)
|
| 113 |
+
new_tokens = out[0][inputs["input_ids"].shape[1] :]
|
| 114 |
+
return self.tokenizer.decode(new_tokens, skip_special_tokens=True).strip()
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
class OpenAIPolicy:
|
| 118 |
+
def __init__(self, model: str, max_new_tokens: int) -> None:
|
| 119 |
+
load_dotenv()
|
| 120 |
+
kwargs = openai_client_kwargs_master()
|
| 121 |
+
if not kwargs.get("api_key"):
|
| 122 |
+
raise SystemExit("Set CORP_MASTER_API_KEY, HF_TOKEN, or OPENAI_API_KEY for --policy openai.")
|
| 123 |
+
self.client = OpenAI(**kwargs)
|
| 124 |
+
self.model = model or os.getenv("CORP_MASTER_MODEL") or os.getenv("MODEL_NAME")
|
| 125 |
+
if not self.model:
|
| 126 |
+
raise SystemExit("Pass --model or set CORP_MASTER_MODEL/MODEL_NAME.")
|
| 127 |
+
self.max_new_tokens = max_new_tokens
|
| 128 |
+
|
| 129 |
+
def complete(self, messages: List[Dict[str, str]]) -> str:
|
| 130 |
+
resp = self.client.chat.completions.create(
|
| 131 |
+
model=self.model,
|
| 132 |
+
messages=messages,
|
| 133 |
+
temperature=0.0,
|
| 134 |
+
max_tokens=self.max_new_tokens,
|
| 135 |
+
)
|
| 136 |
+
return (resp.choices[0].message.content or "").strip()
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def run_scripted_episode(task_id: str, actions: List[Dict[str, Any]]) -> Dict[str, Any]:
|
| 140 |
+
env = CorpEnvironment()
|
| 141 |
+
obs = env.reset(task_id=task_id)
|
| 142 |
+
rewards: List[float] = []
|
| 143 |
+
errors: List[str] = []
|
| 144 |
+
for action_obj in actions:
|
| 145 |
+
action = CorpAction.model_validate(action_obj)
|
| 146 |
+
obs = env.step(action)
|
| 147 |
+
rewards.append(float(obs.reward or 0.0))
|
| 148 |
+
if obs.error:
|
| 149 |
+
errors.append(obs.error)
|
| 150 |
+
if obs.done:
|
| 151 |
+
break
|
| 152 |
+
verifier = env.task.verifier(obs.swd)
|
| 153 |
+
return episode_record(task_id, "scripted", env, rewards, errors, obs.swd)
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def run_model_episode(
|
| 157 |
+
*,
|
| 158 |
+
task_id: str,
|
| 159 |
+
policy: Any,
|
| 160 |
+
max_steps: int,
|
| 161 |
+
) -> Dict[str, Any]:
|
| 162 |
+
env = CorpEnvironment()
|
| 163 |
+
obs = env.reset(task_id=task_id)
|
| 164 |
+
messages: List[Dict[str, str]] = [
|
| 165 |
+
{"role": "system", "content": build_system_prompt(obs.master_tier, obs.role)}
|
| 166 |
+
]
|
| 167 |
+
rewards: List[float] = []
|
| 168 |
+
errors: List[str] = []
|
| 169 |
+
invalid_actions = 0
|
| 170 |
+
|
| 171 |
+
for step in range(max_steps):
|
| 172 |
+
messages.append({"role": "user", "content": observation_message(step, obs)})
|
| 173 |
+
raw = policy.complete(messages)
|
| 174 |
+
messages.append({"role": "assistant", "content": raw})
|
| 175 |
+
try:
|
| 176 |
+
action_obj = normalize_action_obj(extract_json_object(raw))
|
| 177 |
+
action = CorpAction.model_validate(action_obj)
|
| 178 |
+
except Exception as exc:
|
| 179 |
+
invalid_actions += 1
|
| 180 |
+
action = CorpAction(action_type="query_swd", payload="$.phase")
|
| 181 |
+
errors.append(f"invalid_action: {exc}")
|
| 182 |
+
obs = env.step(action)
|
| 183 |
+
rewards.append(float(obs.reward or 0.0))
|
| 184 |
+
if obs.error:
|
| 185 |
+
errors.append(obs.error)
|
| 186 |
+
if obs.done:
|
| 187 |
+
break
|
| 188 |
+
|
| 189 |
+
rec = episode_record(task_id, "model", env, rewards, errors, obs.swd)
|
| 190 |
+
rec["invalid_action_count"] += invalid_actions
|
| 191 |
+
return rec
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def episode_record(
|
| 195 |
+
task_id: str,
|
| 196 |
+
policy_kind: str,
|
| 197 |
+
env: CorpEnvironment,
|
| 198 |
+
rewards: List[float],
|
| 199 |
+
errors: List[str],
|
| 200 |
+
swd: Dict[str, Any],
|
| 201 |
+
) -> Dict[str, Any]:
|
| 202 |
+
verifier = env.task.verifier(swd)
|
| 203 |
+
milestones = swd.get("milestones", []) or []
|
| 204 |
+
completed = [m for m in milestones if m.get("status") == "complete"]
|
| 205 |
+
missed = [m for m in milestones if m.get("status") == "missed"]
|
| 206 |
+
terminal_reward = rewards[-1] if rewards else 0.0
|
| 207 |
+
pass_rate = sum(1 for v in verifier.values() if v) / max(len(verifier), 1)
|
| 208 |
+
return {
|
| 209 |
+
"task_id": task_id,
|
| 210 |
+
"policy_kind": policy_kind,
|
| 211 |
+
"steps": env.turn,
|
| 212 |
+
"total_reward": round(sum(rewards), 6),
|
| 213 |
+
"terminal_reward": round(terminal_reward, 6),
|
| 214 |
+
"reward_trace": rewards,
|
| 215 |
+
"verifier_pass_rate": round(pass_rate, 6),
|
| 216 |
+
"passed_checks": [k for k, v in verifier.items() if v],
|
| 217 |
+
"failed_checks": [k for k, v in verifier.items() if not v],
|
| 218 |
+
"milestones_total": len(milestones),
|
| 219 |
+
"milestones_complete": len(completed),
|
| 220 |
+
"milestones_missed": len(missed),
|
| 221 |
+
"invalid_action_count": 0,
|
| 222 |
+
"env_error_count": len(errors),
|
| 223 |
+
"errors": errors,
|
| 224 |
+
"final_swd_version": int(swd.get("swd_version", 0)),
|
| 225 |
+
"success": bool(pass_rate >= 0.99 and not missed),
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def summarize(rows: List[Dict[str, Any]], label: str) -> None:
|
| 230 |
+
by_task = {}
|
| 231 |
+
for row in rows:
|
| 232 |
+
by_task.setdefault(row["task_id"], []).append(row)
|
| 233 |
+
print(f"\n[{label}] {len(rows)} episodes")
|
| 234 |
+
for task_id, task_rows in by_task.items():
|
| 235 |
+
avg_reward = sum(r["terminal_reward"] for r in task_rows) / len(task_rows)
|
| 236 |
+
avg_pass = sum(r["verifier_pass_rate"] for r in task_rows) / len(task_rows)
|
| 237 |
+
success = sum(1 for r in task_rows if r["success"]) / len(task_rows)
|
| 238 |
+
print(
|
| 239 |
+
f"- {task_id}: terminal_reward={avg_reward:.3f} "
|
| 240 |
+
f"pass_rate={avg_pass:.3f} success={success:.3f}"
|
| 241 |
+
)
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def main() -> None:
|
| 245 |
+
parser = argparse.ArgumentParser(description="Evaluate CORP-ENV model stages.")
|
| 246 |
+
parser.add_argument("--policy", choices=["scripted_weak", "oracle", "openai", "hf"], default="scripted_weak")
|
| 247 |
+
parser.add_argument("--label", default="", help="Model stage label written to each row.")
|
| 248 |
+
parser.add_argument("--model", default="", help="OpenAI/HF model id or local model path.")
|
| 249 |
+
parser.add_argument("--adapter", default="", help="Optional PEFT adapter path for --policy hf.")
|
| 250 |
+
parser.add_argument("--tasks", default=",".join(DEFAULT_TASKS))
|
| 251 |
+
parser.add_argument("--episodes", type=int, default=1)
|
| 252 |
+
parser.add_argument("--max-steps", type=int, default=30)
|
| 253 |
+
parser.add_argument("--max-new-tokens", type=int, default=1536)
|
| 254 |
+
parser.add_argument("--output", default="results/eval.jsonl")
|
| 255 |
+
args = parser.parse_args()
|
| 256 |
+
|
| 257 |
+
os.environ.setdefault("CORP_STUB_WORKERS", "1")
|
| 258 |
+
os.environ.setdefault("CORP_DISABLE_LLM_JUDGE", "1")
|
| 259 |
+
|
| 260 |
+
tasks = [t.strip() for t in args.tasks.split(",") if t.strip()]
|
| 261 |
+
rows: List[Dict[str, Any]] = []
|
| 262 |
+
policy: Any = None
|
| 263 |
+
if args.policy == "openai":
|
| 264 |
+
policy = OpenAIPolicy(args.model, args.max_new_tokens)
|
| 265 |
+
elif args.policy == "hf":
|
| 266 |
+
if not args.model:
|
| 267 |
+
raise SystemExit("--policy hf requires --model")
|
| 268 |
+
policy = HFPolicy(args.model, args.adapter or None, args.max_new_tokens)
|
| 269 |
+
|
| 270 |
+
for ep in range(args.episodes):
|
| 271 |
+
for task_id in tasks:
|
| 272 |
+
if args.policy == "scripted_weak":
|
| 273 |
+
row = run_scripted_episode(task_id, weak_actions(task_id))
|
| 274 |
+
elif args.policy == "oracle":
|
| 275 |
+
row = run_scripted_episode(task_id, oracle_actions(task_id, ep))
|
| 276 |
+
else:
|
| 277 |
+
max_steps = args.max_steps * 2 if task_id == "h1_acquisition_defence" else args.max_steps
|
| 278 |
+
row = run_model_episode(task_id=task_id, policy=policy, max_steps=max_steps)
|
| 279 |
+
row["episode_index"] = ep
|
| 280 |
+
row["model_stage"] = args.label or args.policy
|
| 281 |
+
row["model"] = args.model
|
| 282 |
+
row["adapter"] = args.adapter
|
| 283 |
+
rows.append(row)
|
| 284 |
+
|
| 285 |
+
out = Path(args.output)
|
| 286 |
+
write_jsonl(out, rows)
|
| 287 |
+
summarize(rows, args.label or args.policy)
|
| 288 |
+
print(f"\nWrote {out}")
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
if __name__ == "__main__":
|
| 292 |
+
main()
|
plot_results.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Create hackathon result plots from CORP-ENV eval JSONL files."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import argparse
|
| 6 |
+
import json
|
| 7 |
+
from collections import defaultdict
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
from typing import Any, Dict, Iterable, List
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def read_rows(paths: Iterable[str]) -> List[Dict[str, Any]]:
|
| 13 |
+
rows: List[Dict[str, Any]] = []
|
| 14 |
+
for path_s in paths:
|
| 15 |
+
path = Path(path_s)
|
| 16 |
+
with path.open("r", encoding="utf-8") as f:
|
| 17 |
+
for line in f:
|
| 18 |
+
if line.strip():
|
| 19 |
+
row = json.loads(line)
|
| 20 |
+
row.setdefault("model_stage", path.stem.replace("_eval", ""))
|
| 21 |
+
steps = max(float(row.get("steps", 0) or 0), 1.0)
|
| 22 |
+
row["invalid_action_rate"] = float(row.get("invalid_action_count", 0) or 0) / steps
|
| 23 |
+
rows.append(row)
|
| 24 |
+
return rows
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def grouped_mean(rows: List[Dict[str, Any]], metric: str) -> Dict[str, Dict[str, float]]:
|
| 28 |
+
grouped: Dict[str, Dict[str, List[float]]] = defaultdict(lambda: defaultdict(list))
|
| 29 |
+
for row in rows:
|
| 30 |
+
stage = str(row.get("model_stage", "unknown"))
|
| 31 |
+
task = str(row.get("task_id", "unknown"))
|
| 32 |
+
grouped[stage][task].append(float(row.get(metric, 0.0)))
|
| 33 |
+
return {
|
| 34 |
+
stage: {task: sum(vals) / len(vals) for task, vals in by_task.items()}
|
| 35 |
+
for stage, by_task in grouped.items()
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def plot_grouped_bars(
|
| 40 |
+
data: Dict[str, Dict[str, float]],
|
| 41 |
+
title: str,
|
| 42 |
+
ylabel: str,
|
| 43 |
+
output: Path,
|
| 44 |
+
*,
|
| 45 |
+
clamp_unit: bool = True,
|
| 46 |
+
) -> None:
|
| 47 |
+
import matplotlib.pyplot as plt
|
| 48 |
+
|
| 49 |
+
stages = list(data.keys())
|
| 50 |
+
tasks = sorted({task for by_task in data.values() for task in by_task})
|
| 51 |
+
x = list(range(len(tasks)))
|
| 52 |
+
width = 0.8 / max(len(stages), 1)
|
| 53 |
+
|
| 54 |
+
fig, ax = plt.subplots(figsize=(10, 5))
|
| 55 |
+
for idx, stage in enumerate(stages):
|
| 56 |
+
vals = [data[stage].get(task, 0.0) for task in tasks]
|
| 57 |
+
offsets = [pos - 0.4 + width / 2 + idx * width for pos in x]
|
| 58 |
+
ax.bar(offsets, vals, width, label=stage)
|
| 59 |
+
ax.set_title(title)
|
| 60 |
+
ax.set_xlabel("Task")
|
| 61 |
+
ax.set_ylabel(ylabel)
|
| 62 |
+
ax.set_xticks(x)
|
| 63 |
+
ax.set_xticklabels(tasks, rotation=20, ha="right")
|
| 64 |
+
if clamp_unit:
|
| 65 |
+
ax.set_ylim(0, 1.05)
|
| 66 |
+
ax.legend()
|
| 67 |
+
fig.tight_layout()
|
| 68 |
+
fig.savefig(output, dpi=160)
|
| 69 |
+
plt.close(fig)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def plot_reward_curve(rows: List[Dict[str, Any]], output: Path) -> None:
|
| 73 |
+
import matplotlib.pyplot as plt
|
| 74 |
+
|
| 75 |
+
fig, ax = plt.subplots(figsize=(10, 5))
|
| 76 |
+
plotted = False
|
| 77 |
+
for row in rows:
|
| 78 |
+
trace = row.get("reward_trace") or []
|
| 79 |
+
if not trace:
|
| 80 |
+
continue
|
| 81 |
+
label = f"{row.get('model_stage', 'model')}:{row.get('task_id', 'task')}:{row.get('episode_index', 0)}"
|
| 82 |
+
ax.plot(list(range(1, len(trace) + 1)), trace, alpha=0.45, label=label)
|
| 83 |
+
plotted = True
|
| 84 |
+
if not plotted:
|
| 85 |
+
ax.text(0.5, 0.5, "No reward traces found", ha="center", va="center")
|
| 86 |
+
ax.set_title("Episode Reward Traces")
|
| 87 |
+
ax.set_xlabel("Environment step")
|
| 88 |
+
ax.set_ylabel("Step reward")
|
| 89 |
+
if plotted:
|
| 90 |
+
ax.legend(fontsize=7, ncol=2)
|
| 91 |
+
fig.tight_layout()
|
| 92 |
+
fig.savefig(output, dpi=160)
|
| 93 |
+
plt.close(fig)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def main() -> None:
|
| 97 |
+
parser = argparse.ArgumentParser(description="Plot CORP-ENV eval results.")
|
| 98 |
+
parser.add_argument("--inputs", nargs="+", required=True, help="Eval JSONL files.")
|
| 99 |
+
parser.add_argument("--output-dir", default="results")
|
| 100 |
+
args = parser.parse_args()
|
| 101 |
+
|
| 102 |
+
out = Path(args.output_dir)
|
| 103 |
+
out.mkdir(parents=True, exist_ok=True)
|
| 104 |
+
rows = read_rows(args.inputs)
|
| 105 |
+
if not rows:
|
| 106 |
+
raise SystemExit("No rows found in input files.")
|
| 107 |
+
|
| 108 |
+
plot_grouped_bars(
|
| 109 |
+
grouped_mean(rows, "terminal_reward"),
|
| 110 |
+
"Average Terminal Reward By Model Stage",
|
| 111 |
+
"Terminal reward",
|
| 112 |
+
out / "model_comparison.png",
|
| 113 |
+
clamp_unit=True,
|
| 114 |
+
)
|
| 115 |
+
plot_grouped_bars(
|
| 116 |
+
grouped_mean(rows, "verifier_pass_rate"),
|
| 117 |
+
"Verifier Pass Rate By Task",
|
| 118 |
+
"Verifier pass rate",
|
| 119 |
+
out / "success_by_task.png",
|
| 120 |
+
clamp_unit=True,
|
| 121 |
+
)
|
| 122 |
+
plot_grouped_bars(
|
| 123 |
+
grouped_mean(rows, "invalid_action_rate"),
|
| 124 |
+
"Invalid Action Rate By Task",
|
| 125 |
+
"Invalid actions / environment step",
|
| 126 |
+
out / "invalid_action_rate.png",
|
| 127 |
+
clamp_unit=True,
|
| 128 |
+
)
|
| 129 |
+
plot_reward_curve(rows, out / "reward_curve.png")
|
| 130 |
+
print(f"Wrote plots to {out}")
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
if __name__ == "__main__":
|
| 134 |
+
main()
|
pyproject.toml
CHANGED
|
@@ -15,6 +15,24 @@ dependencies = [
|
|
| 15 |
"jsonpath-ng",
|
| 16 |
]
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
[build-system]
|
| 19 |
requires = ["hatchling"]
|
| 20 |
build-backend = "hatchling.build"
|
|
|
|
| 15 |
"jsonpath-ng",
|
| 16 |
]
|
| 17 |
|
| 18 |
+
[project.optional-dependencies]
|
| 19 |
+
dev = [
|
| 20 |
+
"pytest",
|
| 21 |
+
]
|
| 22 |
+
plots = [
|
| 23 |
+
"matplotlib",
|
| 24 |
+
]
|
| 25 |
+
training = [
|
| 26 |
+
"accelerate",
|
| 27 |
+
"bitsandbytes",
|
| 28 |
+
"datasets",
|
| 29 |
+
"peft",
|
| 30 |
+
"torch",
|
| 31 |
+
"transformers",
|
| 32 |
+
"trl",
|
| 33 |
+
"unsloth",
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
[build-system]
|
| 37 |
requires = ["hatchling"]
|
| 38 |
build-backend = "hatchling.build"
|
results/baseline_eval.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"task_id": "e1_launch_readiness", "policy_kind": "scripted", "steps": 2, "total_reward": 0.88, "terminal_reward": 0.59, "reward_trace": [0.29000000000000004, 0.59], "verifier_pass_rate": 1.0, "passed_checks": ["qa_report_present", "final_rec_valid", "no_missed_milestones"], "failed_checks": [], "milestones_total": 2, "milestones_complete": 2, "milestones_missed": 0, "invalid_action_count": 0, "env_error_count": 0, "errors": [], "final_swd_version": 3, "success": true, "episode_index": 0, "model_stage": "baseline", "model": "", "adapter": ""}
|
| 2 |
+
{"task_id": "m1_budget_reallocation", "policy_kind": "scripted", "steps": 2, "total_reward": 0.288333, "terminal_reward": 0.198333, "reward_trace": [0.09000000000000001, 0.19833333333333336], "verifier_pass_rate": 0.166667, "passed_checks": ["phased_plan"], "failed_checks": ["required_agents_consulted", "conflict_logged", "conflict_resolved", "budget_constraint_acknowledged", "reasoning_documented"], "milestones_total": 3, "milestones_complete": 1, "milestones_missed": 0, "invalid_action_count": 0, "env_error_count": 0, "errors": [], "final_swd_version": 3, "success": false, "episode_index": 0, "model_stage": "baseline", "model": "", "adapter": ""}
|
| 3 |
+
{"task_id": "h1_acquisition_defence", "policy_kind": "scripted", "steps": 2, "total_reward": 0.346667, "terminal_reward": 0.256667, "reward_trace": [0.09000000000000001, 0.25666666666666665], "verifier_pass_rate": 0.333333, "passed_checks": ["counter_offer_present", "deadline_present", "retention_addressed", "no_single_agent_copied"], "failed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "timeline_constraint_acknowledged", "all_phases_reached", "swd_version_rich"], "milestones_total": 5, "milestones_complete": 1, "milestones_missed": 0, "invalid_action_count": 0, "env_error_count": 0, "errors": [], "final_swd_version": 3, "success": false, "episode_index": 0, "model_stage": "baseline", "model": "", "adapter": ""}
|
results/h1_seed_all.jsonl
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"example_id": "seed-h1_acquisition_defence-000", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "108237bb-ff40-416f-9643-4c7996c2f1f3", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 2 |
+
{"example_id": "seed-h1_acquisition_defence-001", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "9e807708-91f0-4721-a641-194f1b542cda", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 3 |
+
{"example_id": "seed-h1_acquisition_defence-002", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "36ef9083-bbbd-489f-a43b-f70d729706a4", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 4 |
+
{"example_id": "seed-h1_acquisition_defence-003", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "44f98cfa-399e-4cdb-8e6a-8556c926fef3", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 5 |
+
{"example_id": "seed-h1_acquisition_defence-004", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "6dfe4890-f94c-4444-b071-0c0ad9adfdd8", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 6 |
+
{"example_id": "seed-h1_acquisition_defence-005", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "e708e971-4f8d-4a5a-8ee5-3eca202b8154", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 7 |
+
{"example_id": "seed-h1_acquisition_defence-006", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "466a243a-f657-4765-828f-4bfa9d08ce32", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
| 8 |
+
{"example_id": "seed-h1_acquisition_defence-007", "task_id": "h1_acquisition_defence", "status": "clean", "reject_reason": "", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "missed_milestones": [], "invalid_action_count": 0, "env_error_count": 0, "final_swd_version": 17, "actions": [{"metadata": {}, "action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."}, {"metadata": {}, "action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."}, {"metadata": {}, "action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c1\", \"summary\": \"CTO valuation ambition conflicts with CFO runway and cash constraints.\", \"source_agents\": [\"cto\", \"cfo\"]}"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."}, {"metadata": {}, "action_type": "log_conflict", "payload": "{\"id\": \"c2\", \"summary\": \"A slow process increases CHRO retention risk for key engineering talent.\", \"source_agents\": [\"chro\", \"cto\"]}"}, {"metadata": {}, "action_type": "log_resolution", "payload": "{\"conflict_id\": \"c1\", \"resolution_type\": \"bounded_counter\", \"text\": \"Ask above the CFO ceiling but set a fast deadline and walk-down logic.\"}"}, {"metadata": {}, "action_type": "advance_phase", "payload": "analysis"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."}, {"metadata": {}, "action_type": "advance_phase", "payload": "decision"}, {"metadata": {}, "action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."}, {"metadata": {}, "action_type": "advance_phase", "payload": "execution"}, {"metadata": {}, "action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."}, {"metadata": {}, "action_type": "finalize", "payload": "{\"counter_offer\": \"Open at 3.2x with a board-approved walk-down floor near 2.6x.\", \"deadline\": \"Force a decision inside 45 days to preserve cash runway and reduce retention risk.\", \"retention_plan\": \"Offer retention grants and role clarity for critical engineering leaders.\"}"}], "final_swd": {"episode_id": "717c90d4-63a3-4572-a49f-80a468be68c4", "scenario": "As CEO, a competitor offers 2.3x valuation. Reconcile contradictory advisor views from the CTO, CFO, and CHRO into a single strategy: counter_offer, deadline, and retention_plan. Advance phase through execution, log multiple conflicts with typed resolutions, and maintain a dense reasoning_log across turns.", "phase": "execution", "milestones": [{"id": "m1", "label": "All three agent_reports present (dev, finance, hr)", "due_by_turn": 6, "status": "complete", "owner": "master", "output": null}, {"id": "m2", "label": ">=2 conflicts_identified referencing advisors", "due_by_turn": 10, "status": "complete", "owner": "master", "output": null}, {"id": "m3", "label": "conflict_resolutions entry includes resolution_type", "due_by_turn": 15, "status": "complete", "owner": "master", "output": null}, {"id": "m4", "label": "final_recommendation has counter_offer, deadline, retention_plan", "due_by_turn": 20, "status": "complete", "owner": "master", "output": null}, {"id": "m5", "label": "reasoning_log >=5 entries with distinct turn values", "due_by_turn": 22, "status": "complete", "owner": "master", "output": null}], "agent_reports": {"dev": "Engineering readout: feature branch merged, canary healthy, load tests within SLO. Residual risk: third-party API quota - mitigation: cache + backoff.\n\n(Task focus: Assess IP leverage and technical moat.\n\nCONFIDENTIAL: Our stack is ~18 months ahead; acquirer cannot replicate quickly - strategic ask should be ~3.5x with extended IP lock-up.)", "hr": "HR sign-off: on-call roster staffed for the target window; contingent workers briefed. Policy check: overtime pre-approved for the T-48h window only.\n\n(Task focus: Assess retention risk and people constraints.\n\nCONFIDENTIAL: Key engineering talent has competing offers; ~60% retention risk if the process drags beyond 90 days without retention incentives.)", "finance": "Finance: launch opex within Q envelope; contingency fund intact. ROI breakeven projected at 10 weeks post-launch under base case.\n\n(Task focus: Assess cash runway and valuation ceiling.\n\nCONFIDENTIAL: Cash runway ~7 months at current burn; board unlikely to approve 3.5x ask - realistic ceiling ~2.6x without new financing.)", "qa": null}, "decisions": [{"turn": 12, "summary": "Proceed with a counter that acknowledges 7 month runway and cash limits."}], "conflicts_identified": [{"id": "c1", "summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.", "source_agents": ["cto", "cfo"], "turn": 5}, {"id": "c2", "summary": "A slow process increases CHRO retention risk for key engineering talent.", "source_agents": ["chro", "cto"], "turn": 7}], "conflict_resolutions": [{"conflict_id": "c1", "resolution_type": "bounded_counter", "text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.", "turn": 8}], "reasoning_log": [{"turn": 4, "text": "CTO input supports a higher counter because the IP moat is meaningful."}, {"turn": 6, "text": "CFO input limits how long the negotiation can remain open."}, {"turn": 10, "text": "The 7 month runway makes delay costly and should shape the deadline."}, {"turn": 13, "text": "Retention incentives are required before the market reads uncertainty."}, {"turn": 15, "text": "Final recommendation integrates valuation, deadline, and retention plan."}], "final_recommendation": {"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.", "deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.", "retention_plan": "Offer retention grants and role clarity for critical engineering leaders."}, "swd_version": 17}}
|
results/h1_seed_summary.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"total": 8,
|
| 3 |
+
"by_status": {
|
| 4 |
+
"clean": 8
|
| 5 |
+
},
|
| 6 |
+
"by_reject_reason": {
|
| 7 |
+
"clean": 8
|
| 8 |
+
},
|
| 9 |
+
"by_task": {
|
| 10 |
+
"h1_acquisition_defence": {
|
| 11 |
+
"clean": 8
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"clean_avg_terminal_reward": 1.05,
|
| 15 |
+
"clean_avg_verifier_pass_rate": 1.0
|
| 16 |
+
}
|
results/invalid_action_rate.png
ADDED
|
Git LFS Details
|
results/model_comparison.png
ADDED
|
Git LFS Details
|
results/oracle_eval.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"task_id": "e1_launch_readiness", "policy_kind": "scripted", "steps": 4, "total_reward": 1.58, "terminal_reward": 0.91, "reward_trace": [0.29000000000000004, 0.19, 0.19, 0.9099999999999999], "verifier_pass_rate": 1.0, "passed_checks": ["qa_report_present", "final_rec_valid", "no_missed_milestones"], "failed_checks": [], "milestones_total": 2, "milestones_complete": 2, "milestones_missed": 0, "invalid_action_count": 0, "env_error_count": 0, "errors": [], "final_swd_version": 5, "success": true, "episode_index": 0, "model_stage": "oracle", "model": "", "adapter": ""}
|
| 2 |
+
{"task_id": "m1_budget_reallocation", "policy_kind": "scripted", "steps": 6, "total_reward": 2.093333, "terminal_reward": 0.943333, "reward_trace": [0.09000000000000001, 0.29000000000000004, 0.19, 0.19, 0.39, 0.9433333333333334], "verifier_pass_rate": 1.0, "passed_checks": ["required_agents_consulted", "conflict_logged", "conflict_resolved", "phased_plan", "budget_constraint_acknowledged", "reasoning_documented"], "failed_checks": [], "milestones_total": 3, "milestones_complete": 3, "milestones_missed": 0, "invalid_action_count": 0, "env_error_count": 0, "errors": [], "final_swd_version": 7, "success": true, "episode_index": 0, "model_stage": "oracle", "model": "", "adapter": ""}
|
| 3 |
+
{"task_id": "h1_acquisition_defence", "policy_kind": "scripted", "steps": 16, "total_reward": 4.7, "terminal_reward": 1.05, "reward_trace": [0.09000000000000001, 0.09000000000000001, 0.29000000000000004, 0.19, 0.19, 0.19, 0.39, 0.39, 0.29000000000000004, 0.19, 0.29000000000000004, 0.19, 0.19, 0.29000000000000004, 0.39, 1.05], "verifier_pass_rate": 1.0, "passed_checks": ["all_agents_consulted", "multi_conflict_logged", "conflict_explicitly_resolved", "resolution_has_type", "rich_reasoning_log", "counter_offer_present", "deadline_present", "retention_addressed", "timeline_constraint_acknowledged", "no_single_agent_copied", "all_phases_reached", "swd_version_rich"], "failed_checks": [], "milestones_total": 5, "milestones_complete": 5, "milestones_missed": 0, "invalid_action_count": 0, "env_error_count": 0, "errors": [], "final_swd_version": 17, "success": true, "episode_index": 0, "model_stage": "oracle", "model": "", "adapter": ""}
|
results/reward_curve.png
ADDED
|
Git LFS Details
|
results/success_by_task.png
ADDED
|
Git LFS Details
|
scripts/_trajectory_utils.py
ADDED
|
@@ -0,0 +1,436 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Shared utilities for CORP-ENV data prep, verification, and evaluation."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
import re
|
| 8 |
+
import sys
|
| 9 |
+
from dataclasses import dataclass
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
from typing import Any, Dict, Iterable, List, Optional
|
| 12 |
+
|
| 13 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 14 |
+
if str(ROOT) not in sys.path:
|
| 15 |
+
sys.path.insert(0, str(ROOT))
|
| 16 |
+
|
| 17 |
+
from corp_env.models import CorpAction, CorpObservation # noqa: E402
|
| 18 |
+
from server.agents.master_prompts import build_system_prompt # noqa: E402
|
| 19 |
+
from server.environment import CorpEnvironment # noqa: E402
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
DEFAULT_TASKS = ("e1_launch_readiness", "m1_budget_reallocation", "h1_acquisition_defence")
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
@dataclass
|
| 26 |
+
class ReplayResult:
|
| 27 |
+
example_id: str
|
| 28 |
+
task_id: str
|
| 29 |
+
status: str
|
| 30 |
+
reject_reason: str
|
| 31 |
+
actions: List[Dict[str, Any]]
|
| 32 |
+
steps: int
|
| 33 |
+
total_reward: float
|
| 34 |
+
terminal_reward: float
|
| 35 |
+
verifier_result: Dict[str, bool]
|
| 36 |
+
missed_milestones: List[str]
|
| 37 |
+
invalid_action_count: int
|
| 38 |
+
env_error_count: int
|
| 39 |
+
final_swd_version: int
|
| 40 |
+
final_swd: Dict[str, Any]
|
| 41 |
+
|
| 42 |
+
@property
|
| 43 |
+
def verifier_pass_rate(self) -> float:
|
| 44 |
+
if not self.verifier_result:
|
| 45 |
+
return 0.0
|
| 46 |
+
return sum(1 for v in self.verifier_result.values() if v) / len(self.verifier_result)
|
| 47 |
+
|
| 48 |
+
def to_record(self) -> Dict[str, Any]:
|
| 49 |
+
failed = [k for k, v in self.verifier_result.items() if not v]
|
| 50 |
+
passed = [k for k, v in self.verifier_result.items() if v]
|
| 51 |
+
return {
|
| 52 |
+
"example_id": self.example_id,
|
| 53 |
+
"task_id": self.task_id,
|
| 54 |
+
"status": self.status,
|
| 55 |
+
"reject_reason": self.reject_reason,
|
| 56 |
+
"steps": self.steps,
|
| 57 |
+
"total_reward": round(self.total_reward, 6),
|
| 58 |
+
"terminal_reward": round(self.terminal_reward, 6),
|
| 59 |
+
"verifier_pass_rate": round(self.verifier_pass_rate, 6),
|
| 60 |
+
"passed_checks": passed,
|
| 61 |
+
"failed_checks": failed,
|
| 62 |
+
"missed_milestones": self.missed_milestones,
|
| 63 |
+
"invalid_action_count": self.invalid_action_count,
|
| 64 |
+
"env_error_count": self.env_error_count,
|
| 65 |
+
"final_swd_version": self.final_swd_version,
|
| 66 |
+
"actions": self.actions,
|
| 67 |
+
"final_swd": self.final_swd,
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def read_jsonl(path: Path) -> Iterable[Dict[str, Any]]:
|
| 72 |
+
with path.open("r", encoding="utf-8") as f:
|
| 73 |
+
for line_no, line in enumerate(f, start=1):
|
| 74 |
+
line = line.strip()
|
| 75 |
+
if not line:
|
| 76 |
+
continue
|
| 77 |
+
try:
|
| 78 |
+
obj = json.loads(line)
|
| 79 |
+
except json.JSONDecodeError as exc:
|
| 80 |
+
yield {
|
| 81 |
+
"example_id": f"{path.stem}:{line_no}",
|
| 82 |
+
"task_id": "",
|
| 83 |
+
"actions": [],
|
| 84 |
+
"_load_error": f"invalid JSONL line {line_no}: {exc}",
|
| 85 |
+
}
|
| 86 |
+
continue
|
| 87 |
+
obj.setdefault("example_id", f"{path.stem}:{line_no}")
|
| 88 |
+
yield obj
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def write_jsonl(path: Path, rows: Iterable[Dict[str, Any]]) -> None:
|
| 92 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 93 |
+
with path.open("w", encoding="utf-8") as f:
|
| 94 |
+
for row in rows:
|
| 95 |
+
f.write(json.dumps(row, ensure_ascii=False) + "\n")
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def extract_json_object(text: str) -> Dict[str, Any]:
|
| 99 |
+
cleaned = text.strip()
|
| 100 |
+
cleaned = re.sub(r"^```(?:json)?\s*", "", cleaned)
|
| 101 |
+
cleaned = re.sub(r"\s*```\s*$", "", cleaned).strip()
|
| 102 |
+
try:
|
| 103 |
+
obj = json.loads(cleaned)
|
| 104 |
+
if isinstance(obj, dict):
|
| 105 |
+
return obj
|
| 106 |
+
except json.JSONDecodeError:
|
| 107 |
+
pass
|
| 108 |
+
start = cleaned.find("{")
|
| 109 |
+
if start == -1:
|
| 110 |
+
raise ValueError("no JSON object found")
|
| 111 |
+
depth = 0
|
| 112 |
+
in_string = False
|
| 113 |
+
escape_next = False
|
| 114 |
+
for idx in range(start, len(cleaned)):
|
| 115 |
+
ch = cleaned[idx]
|
| 116 |
+
if escape_next:
|
| 117 |
+
escape_next = False
|
| 118 |
+
continue
|
| 119 |
+
if ch == "\\" and in_string:
|
| 120 |
+
escape_next = True
|
| 121 |
+
continue
|
| 122 |
+
if ch == '"':
|
| 123 |
+
in_string = not in_string
|
| 124 |
+
continue
|
| 125 |
+
if in_string:
|
| 126 |
+
continue
|
| 127 |
+
if ch == "{":
|
| 128 |
+
depth += 1
|
| 129 |
+
elif ch == "}":
|
| 130 |
+
depth -= 1
|
| 131 |
+
if depth == 0:
|
| 132 |
+
obj = json.loads(cleaned[start : idx + 1])
|
| 133 |
+
if not isinstance(obj, dict):
|
| 134 |
+
raise ValueError("extracted JSON is not an object")
|
| 135 |
+
return obj
|
| 136 |
+
raise ValueError("unbalanced JSON object")
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def normalize_action_obj(raw: Any) -> Dict[str, Any]:
|
| 140 |
+
if isinstance(raw, str):
|
| 141 |
+
raw = extract_json_object(raw)
|
| 142 |
+
if not isinstance(raw, dict):
|
| 143 |
+
raise ValueError("action must be a JSON object or string containing one")
|
| 144 |
+
raw = dict(raw)
|
| 145 |
+
raw.pop("thought", None)
|
| 146 |
+
if "payload" in raw and not isinstance(raw["payload"], str):
|
| 147 |
+
raw["payload"] = json.dumps(raw["payload"], ensure_ascii=False)
|
| 148 |
+
raw.setdefault("payload", "")
|
| 149 |
+
if raw.get("agent_id") == "":
|
| 150 |
+
raw["agent_id"] = None
|
| 151 |
+
return CorpAction.model_validate(raw).model_dump(mode="json", exclude_none=True)
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def extract_actions(example: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 155 |
+
candidates: Any = (
|
| 156 |
+
example.get("actions")
|
| 157 |
+
or example.get("trajectory")
|
| 158 |
+
or example.get("steps")
|
| 159 |
+
or example.get("messages")
|
| 160 |
+
)
|
| 161 |
+
if candidates is None:
|
| 162 |
+
raise ValueError("example has no actions/trajectory/steps/messages")
|
| 163 |
+
|
| 164 |
+
raw_actions: List[Any] = []
|
| 165 |
+
if candidates and isinstance(candidates, list) and isinstance(candidates[0], dict):
|
| 166 |
+
if "role" in candidates[0]:
|
| 167 |
+
raw_actions = [
|
| 168 |
+
m.get("content", "")
|
| 169 |
+
for m in candidates
|
| 170 |
+
if m.get("role") == "assistant" and m.get("content")
|
| 171 |
+
]
|
| 172 |
+
elif "action" in candidates[0]:
|
| 173 |
+
raw_actions = [step.get("action") for step in candidates]
|
| 174 |
+
else:
|
| 175 |
+
raw_actions = candidates
|
| 176 |
+
elif isinstance(candidates, list):
|
| 177 |
+
raw_actions = candidates
|
| 178 |
+
else:
|
| 179 |
+
raise ValueError("trajectory container must be a list")
|
| 180 |
+
|
| 181 |
+
return [normalize_action_obj(action) for action in raw_actions]
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def observation_message(step: int, obs: CorpObservation) -> str:
|
| 185 |
+
parts = [
|
| 186 |
+
f"--- Step {step} ---",
|
| 187 |
+
f"Role: {obs.role} (tier: {obs.master_tier})",
|
| 188 |
+
f"Task: {obs.task_description}",
|
| 189 |
+
f"Available agents: {', '.join(obs.available_agents)}",
|
| 190 |
+
f"Turn: {obs.turn} tokens_used: {obs.tokens_used}/{obs.token_budget}",
|
| 191 |
+
]
|
| 192 |
+
if obs.available_actions:
|
| 193 |
+
parts.append("Available actions:\n- " + "\n- ".join(obs.available_actions))
|
| 194 |
+
if obs.next_step_hint:
|
| 195 |
+
parts.append(f"Next-step hint: {obs.next_step_hint}")
|
| 196 |
+
if obs.recent_actions:
|
| 197 |
+
parts.append("Recent actions: " + " | ".join(obs.recent_actions))
|
| 198 |
+
parts.append(f"SWD:\n{json.dumps(obs.swd, indent=2, ensure_ascii=False)[:12000]}")
|
| 199 |
+
if obs.agent_last_output:
|
| 200 |
+
parts.append(f"Last worker output:\n{obs.agent_last_output[:4000]}")
|
| 201 |
+
if obs.query_result is not None:
|
| 202 |
+
parts.append(f"Query result: {json.dumps(obs.query_result, ensure_ascii=False)[:2000]}")
|
| 203 |
+
if obs.error:
|
| 204 |
+
parts.append(f"Error: {obs.error}")
|
| 205 |
+
parts.append(f"Reward (last step): {obs.reward}")
|
| 206 |
+
parts.append("Respond with your next JSON action.")
|
| 207 |
+
return "\n".join(parts)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def actions_to_sft_messages(task_id: str, actions: List[Dict[str, Any]]) -> List[Dict[str, str]]:
|
| 211 |
+
env = CorpEnvironment()
|
| 212 |
+
obs = env.reset(task_id=task_id)
|
| 213 |
+
messages: List[Dict[str, str]] = [
|
| 214 |
+
{"role": "system", "content": build_system_prompt(obs.master_tier, obs.role)}
|
| 215 |
+
]
|
| 216 |
+
for idx, action_obj in enumerate(actions):
|
| 217 |
+
messages.append({"role": "user", "content": observation_message(idx, obs)})
|
| 218 |
+
messages.append(
|
| 219 |
+
{
|
| 220 |
+
"role": "assistant",
|
| 221 |
+
"content": json.dumps(action_obj, ensure_ascii=False),
|
| 222 |
+
}
|
| 223 |
+
)
|
| 224 |
+
obs = env.step(CorpAction.model_validate(action_obj))
|
| 225 |
+
if obs.done:
|
| 226 |
+
break
|
| 227 |
+
return messages
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
def keep_decision(task_id: str, terminal_reward: float, verifier: Dict[str, bool], missed: List[str]) -> str:
|
| 231 |
+
pass_count = sum(1 for v in verifier.values() if v)
|
| 232 |
+
total = max(len(verifier), 1)
|
| 233 |
+
if missed:
|
| 234 |
+
return "missed_milestones"
|
| 235 |
+
if task_id == "e1_launch_readiness":
|
| 236 |
+
if terminal_reward >= 0.65 and pass_count == total:
|
| 237 |
+
return ""
|
| 238 |
+
return "below_e1_threshold"
|
| 239 |
+
if task_id == "m1_budget_reallocation":
|
| 240 |
+
if terminal_reward >= 0.70 and pass_count >= 5:
|
| 241 |
+
return ""
|
| 242 |
+
return "below_m1_threshold"
|
| 243 |
+
if task_id == "h1_acquisition_defence":
|
| 244 |
+
if terminal_reward >= 0.65 and pass_count >= 7:
|
| 245 |
+
return ""
|
| 246 |
+
return "below_h1_threshold"
|
| 247 |
+
return "" if terminal_reward >= 0.65 else "below_generic_threshold"
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
def replay_actions(
|
| 251 |
+
*,
|
| 252 |
+
example_id: str,
|
| 253 |
+
task_id: str,
|
| 254 |
+
actions: List[Dict[str, Any]],
|
| 255 |
+
strict_thresholds: bool = True,
|
| 256 |
+
) -> ReplayResult:
|
| 257 |
+
os.environ.setdefault("CORP_STUB_WORKERS", "1")
|
| 258 |
+
os.environ.setdefault("CORP_DISABLE_LLM_JUDGE", "1")
|
| 259 |
+
|
| 260 |
+
env = CorpEnvironment()
|
| 261 |
+
obs = env.reset(task_id=task_id)
|
| 262 |
+
total_reward = 0.0
|
| 263 |
+
terminal_reward = 0.0
|
| 264 |
+
invalid_action_count = 0
|
| 265 |
+
env_error_count = 0
|
| 266 |
+
reject_reason = ""
|
| 267 |
+
|
| 268 |
+
for idx, action_obj in enumerate(actions, start=1):
|
| 269 |
+
try:
|
| 270 |
+
action = CorpAction.model_validate(action_obj)
|
| 271 |
+
except Exception as exc:
|
| 272 |
+
invalid_action_count += 1
|
| 273 |
+
reject_reason = f"invalid_action_at_step_{idx}: {exc}"
|
| 274 |
+
break
|
| 275 |
+
|
| 276 |
+
obs = env.step(action)
|
| 277 |
+
reward = float(obs.reward or 0.0)
|
| 278 |
+
total_reward += reward
|
| 279 |
+
terminal_reward = reward
|
| 280 |
+
if obs.error:
|
| 281 |
+
env_error_count += 1
|
| 282 |
+
if obs.done:
|
| 283 |
+
break
|
| 284 |
+
|
| 285 |
+
final_swd = obs.swd
|
| 286 |
+
verifier = env.task.verifier(final_swd)
|
| 287 |
+
missed = [
|
| 288 |
+
str(m.get("id"))
|
| 289 |
+
for m in final_swd.get("milestones", []) or []
|
| 290 |
+
if m.get("status") == "missed"
|
| 291 |
+
]
|
| 292 |
+
if not reject_reason:
|
| 293 |
+
if not actions:
|
| 294 |
+
reject_reason = "empty_trajectory"
|
| 295 |
+
elif not obs.done:
|
| 296 |
+
reject_reason = "trajectory_did_not_terminate"
|
| 297 |
+
elif actions[-1].get("action_type") != "finalize" and not env.episode_metadata.get("finalized"):
|
| 298 |
+
reject_reason = "missing_finalize"
|
| 299 |
+
elif env_error_count:
|
| 300 |
+
reject_reason = "environment_errors"
|
| 301 |
+
elif strict_thresholds:
|
| 302 |
+
reject_reason = keep_decision(task_id, terminal_reward, verifier, missed)
|
| 303 |
+
|
| 304 |
+
status = "clean" if not reject_reason else "rejected"
|
| 305 |
+
return ReplayResult(
|
| 306 |
+
example_id=example_id,
|
| 307 |
+
task_id=task_id,
|
| 308 |
+
status=status,
|
| 309 |
+
reject_reason=reject_reason,
|
| 310 |
+
actions=actions,
|
| 311 |
+
steps=env.turn,
|
| 312 |
+
total_reward=total_reward,
|
| 313 |
+
terminal_reward=terminal_reward,
|
| 314 |
+
verifier_result=verifier,
|
| 315 |
+
missed_milestones=missed,
|
| 316 |
+
invalid_action_count=invalid_action_count,
|
| 317 |
+
env_error_count=env_error_count,
|
| 318 |
+
final_swd_version=int(final_swd.get("swd_version", 0)),
|
| 319 |
+
final_swd=final_swd,
|
| 320 |
+
)
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
def oracle_actions(task_id: str, variant: int = 0) -> List[Dict[str, Any]]:
|
| 324 |
+
if task_id == "e1_launch_readiness":
|
| 325 |
+
rec = "NO_GO" if variant % 2 == 0 else "GO"
|
| 326 |
+
return [
|
| 327 |
+
{
|
| 328 |
+
"action_type": "delegate",
|
| 329 |
+
"agent_id": "qa_engineer",
|
| 330 |
+
"payload": "Report launch test status, blockers, and gate recommendation.",
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"action_type": "log_reasoning",
|
| 334 |
+
"payload": "QA evidence is the controlling launch gate; final call should reflect blocker risk.",
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"action_type": "log_decision",
|
| 338 |
+
"payload": f"Use QA gate evidence and finalize as {rec}.",
|
| 339 |
+
},
|
| 340 |
+
{"action_type": "finalize", "payload": rec},
|
| 341 |
+
]
|
| 342 |
+
if task_id == "m1_budget_reallocation":
|
| 343 |
+
phase = {
|
| 344 |
+
"phase_1": "Buy a constrained GPU block for the highest-priority training runs.",
|
| 345 |
+
"phase_2": "Expand only after finance confirms runway and measured utilization.",
|
| 346 |
+
"guardrail": "Cap spend, report weekly burn, and pause if runway drops below target.",
|
| 347 |
+
}
|
| 348 |
+
return [
|
| 349 |
+
{
|
| 350 |
+
"action_type": "delegate",
|
| 351 |
+
"agent_id": "dev_lead",
|
| 352 |
+
"payload": "Estimate minimum GPU capacity needed for the next model-training milestone.",
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"action_type": "delegate",
|
| 356 |
+
"agent_id": "fpa_manager",
|
| 357 |
+
"payload": "State the budget, runway, and spend constraints for GPU cluster time.",
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"action_type": "log_reasoning",
|
| 361 |
+
"payload": "The plan must balance model training urgency with budget, cost, spend, cash, runway, and burn constraints.",
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"action_type": "log_conflict",
|
| 365 |
+
"payload": json.dumps(
|
| 366 |
+
{
|
| 367 |
+
"id": "c1",
|
| 368 |
+
"summary": "Engineering wants more GPU capacity than finance can approve immediately.",
|
| 369 |
+
"source_agents": ["dev_lead", "fpa_manager"],
|
| 370 |
+
}
|
| 371 |
+
),
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"action_type": "log_resolution",
|
| 375 |
+
"payload": json.dumps(
|
| 376 |
+
{
|
| 377 |
+
"conflict_id": "c1",
|
| 378 |
+
"resolution_type": "phased_budget",
|
| 379 |
+
"text": "Approve a capped phase_1 GPU purchase with weekly finance review.",
|
| 380 |
+
}
|
| 381 |
+
),
|
| 382 |
+
},
|
| 383 |
+
{"action_type": "finalize", "payload": json.dumps(phase)},
|
| 384 |
+
]
|
| 385 |
+
if task_id == "h1_acquisition_defence":
|
| 386 |
+
final = {
|
| 387 |
+
"counter_offer": "Open at 3.2x with a board-approved walk-down floor near 2.6x.",
|
| 388 |
+
"deadline": "Force a decision inside 45 days to preserve cash runway and reduce retention risk.",
|
| 389 |
+
"retention_plan": "Offer retention grants and role clarity for critical engineering leaders.",
|
| 390 |
+
}
|
| 391 |
+
return [
|
| 392 |
+
{"action_type": "delegate", "agent_id": "cto", "payload": "Assess IP leverage and technical moat."},
|
| 393 |
+
{"action_type": "delegate", "agent_id": "cfo", "payload": "Assess cash runway and valuation ceiling."},
|
| 394 |
+
{"action_type": "delegate", "agent_id": "chro", "payload": "Assess retention risk and people constraints."},
|
| 395 |
+
{"action_type": "log_reasoning", "payload": "CTO input supports a higher counter because the IP moat is meaningful."},
|
| 396 |
+
{
|
| 397 |
+
"action_type": "log_conflict",
|
| 398 |
+
"payload": json.dumps(
|
| 399 |
+
{
|
| 400 |
+
"id": "c1",
|
| 401 |
+
"summary": "CTO valuation ambition conflicts with CFO runway and cash constraints.",
|
| 402 |
+
"source_agents": ["cto", "cfo"],
|
| 403 |
+
}
|
| 404 |
+
),
|
| 405 |
+
},
|
| 406 |
+
{"action_type": "log_reasoning", "payload": "CFO input limits how long the negotiation can remain open."},
|
| 407 |
+
{
|
| 408 |
+
"action_type": "log_conflict",
|
| 409 |
+
"payload": json.dumps(
|
| 410 |
+
{
|
| 411 |
+
"id": "c2",
|
| 412 |
+
"summary": "A slow process increases CHRO retention risk for key engineering talent.",
|
| 413 |
+
"source_agents": ["chro", "cto"],
|
| 414 |
+
}
|
| 415 |
+
),
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"action_type": "log_resolution",
|
| 419 |
+
"payload": json.dumps(
|
| 420 |
+
{
|
| 421 |
+
"conflict_id": "c1",
|
| 422 |
+
"resolution_type": "bounded_counter",
|
| 423 |
+
"text": "Ask above the CFO ceiling but set a fast deadline and walk-down logic.",
|
| 424 |
+
}
|
| 425 |
+
),
|
| 426 |
+
},
|
| 427 |
+
{"action_type": "advance_phase", "payload": "analysis"},
|
| 428 |
+
{"action_type": "log_reasoning", "payload": "The 7 month runway makes delay costly and should shape the deadline."},
|
| 429 |
+
{"action_type": "advance_phase", "payload": "decision"},
|
| 430 |
+
{"action_type": "log_decision", "payload": "Proceed with a counter that acknowledges 7 month runway and cash limits."},
|
| 431 |
+
{"action_type": "log_reasoning", "payload": "Retention incentives are required before the market reads uncertainty."},
|
| 432 |
+
{"action_type": "advance_phase", "payload": "execution"},
|
| 433 |
+
{"action_type": "log_reasoning", "payload": "Final recommendation integrates valuation, deadline, and retention plan."},
|
| 434 |
+
{"action_type": "finalize", "payload": json.dumps(final)},
|
| 435 |
+
]
|
| 436 |
+
raise ValueError(f"unknown task_id: {task_id}")
|
scripts/generate_sft_data.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Generate small verifier-friendly seed trajectories for CORP-ENV.
|
| 2 |
+
|
| 3 |
+
This is not meant to replace your generated E1/M1 examples. Use it to create
|
| 4 |
+
missing coverage, especially H1 seeds, then pass the output through
|
| 5 |
+
`scripts/verify_examples.py` before SFT.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from __future__ import annotations
|
| 9 |
+
|
| 10 |
+
import argparse
|
| 11 |
+
import sys
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
from typing import Any, Dict, List
|
| 14 |
+
|
| 15 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 16 |
+
if str(ROOT) not in sys.path:
|
| 17 |
+
sys.path.insert(0, str(ROOT))
|
| 18 |
+
|
| 19 |
+
from scripts._trajectory_utils import DEFAULT_TASKS, oracle_actions, write_jsonl # noqa: E402
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def build_examples(tasks: List[str], per_task: int) -> List[Dict[str, Any]]:
|
| 23 |
+
rows: List[Dict[str, Any]] = []
|
| 24 |
+
for task_id in tasks:
|
| 25 |
+
for idx in range(per_task):
|
| 26 |
+
rows.append(
|
| 27 |
+
{
|
| 28 |
+
"example_id": f"seed-{task_id}-{idx:03d}",
|
| 29 |
+
"task_id": task_id,
|
| 30 |
+
"source": "scripted_seed",
|
| 31 |
+
"actions": oracle_actions(task_id, idx),
|
| 32 |
+
}
|
| 33 |
+
)
|
| 34 |
+
return rows
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def main() -> None:
|
| 38 |
+
parser = argparse.ArgumentParser(description="Generate CORP-ENV seed trajectories.")
|
| 39 |
+
parser.add_argument("--tasks", default="h1_acquisition_defence")
|
| 40 |
+
parser.add_argument("--per-task", type=int, default=8)
|
| 41 |
+
parser.add_argument("--output", default="data/raw/h1_seed.jsonl")
|
| 42 |
+
args = parser.parse_args()
|
| 43 |
+
|
| 44 |
+
tasks = [t.strip() for t in args.tasks.split(",") if t.strip()] or list(DEFAULT_TASKS)
|
| 45 |
+
rows = build_examples(tasks, args.per_task)
|
| 46 |
+
write_jsonl(Path(args.output), rows)
|
| 47 |
+
print(f"Wrote {len(rows)} seed trajectories to {args.output}")
|
| 48 |
+
print("Next: run scripts/verify_examples.py on this file before using it for SFT.")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
if __name__ == "__main__":
|
| 52 |
+
main()
|
scripts/prepare_sft_data.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Convert verified CORP-ENV trajectories into chat-format SFT JSONL.
|
| 2 |
+
|
| 3 |
+
Input should usually be `data/processed/e1_m1_clean.jsonl` from
|
| 4 |
+
`scripts/verify_examples.py`. Each output row is compatible with TRL-style chat
|
| 5 |
+
SFT datasets:
|
| 6 |
+
|
| 7 |
+
{"task_id": "...", "example_id": "...", "messages": [...]}
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import argparse
|
| 13 |
+
import sys
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
from typing import Any, Dict, List
|
| 16 |
+
|
| 17 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 18 |
+
if str(ROOT) not in sys.path:
|
| 19 |
+
sys.path.insert(0, str(ROOT))
|
| 20 |
+
|
| 21 |
+
from scripts._trajectory_utils import ( # noqa: E402
|
| 22 |
+
actions_to_sft_messages,
|
| 23 |
+
extract_actions,
|
| 24 |
+
read_jsonl,
|
| 25 |
+
write_jsonl,
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def convert_example(example: Dict[str, Any], min_pass_rate: float) -> Dict[str, Any] | None:
|
| 30 |
+
if example.get("status") and example.get("status") != "clean":
|
| 31 |
+
return None
|
| 32 |
+
pass_rate = float(example.get("verifier_pass_rate", 1.0))
|
| 33 |
+
if pass_rate < min_pass_rate:
|
| 34 |
+
return None
|
| 35 |
+
task_id = str(example.get("task_id") or example.get("task") or "")
|
| 36 |
+
if not task_id:
|
| 37 |
+
return None
|
| 38 |
+
actions = extract_actions(example)
|
| 39 |
+
messages = actions_to_sft_messages(task_id, actions)
|
| 40 |
+
return {
|
| 41 |
+
"example_id": str(example.get("example_id") or example.get("id") or "unknown"),
|
| 42 |
+
"task_id": task_id,
|
| 43 |
+
"messages": messages,
|
| 44 |
+
"num_actions": len(actions),
|
| 45 |
+
"terminal_reward": example.get("terminal_reward"),
|
| 46 |
+
"verifier_pass_rate": example.get("verifier_pass_rate"),
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def main() -> None:
|
| 51 |
+
parser = argparse.ArgumentParser(description="Prepare chat SFT data from verified examples.")
|
| 52 |
+
parser.add_argument("--input", default="data/processed/e1_m1_clean.jsonl")
|
| 53 |
+
parser.add_argument("--output", default="data/sft/e1_m1_examples.jsonl")
|
| 54 |
+
parser.add_argument("--min-pass-rate", type=float, default=0.80)
|
| 55 |
+
args = parser.parse_args()
|
| 56 |
+
|
| 57 |
+
rows: List[Dict[str, Any]] = []
|
| 58 |
+
skipped = 0
|
| 59 |
+
for example in read_jsonl(Path(args.input)):
|
| 60 |
+
try:
|
| 61 |
+
row = convert_example(example, args.min_pass_rate)
|
| 62 |
+
except Exception as exc:
|
| 63 |
+
skipped += 1
|
| 64 |
+
print(f"skip {example.get('example_id', 'unknown')}: {exc}")
|
| 65 |
+
continue
|
| 66 |
+
if row is None:
|
| 67 |
+
skipped += 1
|
| 68 |
+
continue
|
| 69 |
+
rows.append(row)
|
| 70 |
+
|
| 71 |
+
write_jsonl(Path(args.output), rows)
|
| 72 |
+
print(f"Wrote {len(rows)} SFT conversations to {args.output}; skipped {skipped}.")
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__":
|
| 76 |
+
main()
|
scripts/verify_examples.py
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Replay generated examples against the current CORP-ENV implementation.
|
| 2 |
+
|
| 3 |
+
The script keeps only trajectories that parse as `CorpAction`, run through
|
| 4 |
+
`CorpEnvironment`, terminate with `finalize`, and meet task-specific thresholds.
|
| 5 |
+
|
| 6 |
+
Example:
|
| 7 |
+
uv run python scripts/verify_examples.py \
|
| 8 |
+
--input data/raw/e1_m1_examples.jsonl \
|
| 9 |
+
--clean data/processed/e1_m1_clean.jsonl \
|
| 10 |
+
--rejected data/processed/e1_m1_rejected.jsonl \
|
| 11 |
+
--summary results/example_verification_summary.json
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
from __future__ import annotations
|
| 15 |
+
|
| 16 |
+
import argparse
|
| 17 |
+
import json
|
| 18 |
+
import sys
|
| 19 |
+
from collections import Counter, defaultdict
|
| 20 |
+
from pathlib import Path
|
| 21 |
+
from typing import Any, Dict, List
|
| 22 |
+
|
| 23 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 24 |
+
if str(ROOT) not in sys.path:
|
| 25 |
+
sys.path.insert(0, str(ROOT))
|
| 26 |
+
|
| 27 |
+
from scripts._trajectory_utils import ( # noqa: E402
|
| 28 |
+
extract_actions,
|
| 29 |
+
read_jsonl,
|
| 30 |
+
replay_actions,
|
| 31 |
+
write_jsonl,
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def verify_one(example: Dict[str, Any], strict_thresholds: bool) -> Dict[str, Any]:
|
| 36 |
+
example_id = str(example.get("example_id") or example.get("id") or "unknown")
|
| 37 |
+
task_id = str(example.get("task_id") or example.get("task") or "")
|
| 38 |
+
if example.get("_load_error"):
|
| 39 |
+
return {
|
| 40 |
+
"example_id": example_id,
|
| 41 |
+
"task_id": task_id,
|
| 42 |
+
"status": "rejected",
|
| 43 |
+
"reject_reason": example["_load_error"],
|
| 44 |
+
"actions": [],
|
| 45 |
+
}
|
| 46 |
+
if not task_id:
|
| 47 |
+
return {
|
| 48 |
+
"example_id": example_id,
|
| 49 |
+
"task_id": task_id,
|
| 50 |
+
"status": "rejected",
|
| 51 |
+
"reject_reason": "missing_task_id",
|
| 52 |
+
"actions": [],
|
| 53 |
+
}
|
| 54 |
+
try:
|
| 55 |
+
actions = extract_actions(example)
|
| 56 |
+
except Exception as exc:
|
| 57 |
+
return {
|
| 58 |
+
"example_id": example_id,
|
| 59 |
+
"task_id": task_id,
|
| 60 |
+
"status": "rejected",
|
| 61 |
+
"reject_reason": f"action_extraction_failed: {exc}",
|
| 62 |
+
"actions": [],
|
| 63 |
+
}
|
| 64 |
+
try:
|
| 65 |
+
result = replay_actions(
|
| 66 |
+
example_id=example_id,
|
| 67 |
+
task_id=task_id,
|
| 68 |
+
actions=actions,
|
| 69 |
+
strict_thresholds=strict_thresholds,
|
| 70 |
+
)
|
| 71 |
+
except Exception as exc:
|
| 72 |
+
return {
|
| 73 |
+
"example_id": example_id,
|
| 74 |
+
"task_id": task_id,
|
| 75 |
+
"status": "rejected",
|
| 76 |
+
"reject_reason": f"replay_failed: {exc}",
|
| 77 |
+
"actions": actions,
|
| 78 |
+
}
|
| 79 |
+
return result.to_record()
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def summarize(records: List[Dict[str, Any]]) -> Dict[str, Any]:
|
| 83 |
+
by_status = Counter(r["status"] for r in records)
|
| 84 |
+
by_reason = Counter(r.get("reject_reason") or "clean" for r in records)
|
| 85 |
+
by_task: Dict[str, Counter] = defaultdict(Counter)
|
| 86 |
+
for row in records:
|
| 87 |
+
by_task[row.get("task_id", "unknown")][row["status"]] += 1
|
| 88 |
+
clean = [r for r in records if r["status"] == "clean"]
|
| 89 |
+
return {
|
| 90 |
+
"total": len(records),
|
| 91 |
+
"by_status": dict(by_status),
|
| 92 |
+
"by_reject_reason": dict(by_reason),
|
| 93 |
+
"by_task": {task: dict(counts) for task, counts in by_task.items()},
|
| 94 |
+
"clean_avg_terminal_reward": (
|
| 95 |
+
round(sum(float(r.get("terminal_reward", 0.0)) for r in clean) / len(clean), 6)
|
| 96 |
+
if clean
|
| 97 |
+
else 0.0
|
| 98 |
+
),
|
| 99 |
+
"clean_avg_verifier_pass_rate": (
|
| 100 |
+
round(sum(float(r.get("verifier_pass_rate", 0.0)) for r in clean) / len(clean), 6)
|
| 101 |
+
if clean
|
| 102 |
+
else 0.0
|
| 103 |
+
),
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def main() -> None:
|
| 108 |
+
parser = argparse.ArgumentParser(description="Verify generated CORP-ENV examples.")
|
| 109 |
+
parser.add_argument("--input", required=True, help="Raw or normalized examples JSONL.")
|
| 110 |
+
parser.add_argument("--clean", default="data/processed/e1_m1_clean.jsonl")
|
| 111 |
+
parser.add_argument("--rejected", default="data/processed/e1_m1_rejected.jsonl")
|
| 112 |
+
parser.add_argument("--all-records", default="results/example_verification_all.jsonl")
|
| 113 |
+
parser.add_argument("--summary", default="results/example_verification_summary.json")
|
| 114 |
+
parser.add_argument(
|
| 115 |
+
"--lenient",
|
| 116 |
+
action="store_true",
|
| 117 |
+
help="Only require replay validity; do not apply task reward/pass thresholds.",
|
| 118 |
+
)
|
| 119 |
+
args = parser.parse_args()
|
| 120 |
+
|
| 121 |
+
records = [
|
| 122 |
+
verify_one(example, strict_thresholds=not args.lenient)
|
| 123 |
+
for example in read_jsonl(Path(args.input))
|
| 124 |
+
]
|
| 125 |
+
clean = [r for r in records if r["status"] == "clean"]
|
| 126 |
+
rejected = [r for r in records if r["status"] != "clean"]
|
| 127 |
+
|
| 128 |
+
write_jsonl(Path(args.clean), clean)
|
| 129 |
+
write_jsonl(Path(args.rejected), rejected)
|
| 130 |
+
write_jsonl(Path(args.all_records), records)
|
| 131 |
+
|
| 132 |
+
summary = summarize(records)
|
| 133 |
+
summary_path = Path(args.summary)
|
| 134 |
+
summary_path.parent.mkdir(parents=True, exist_ok=True)
|
| 135 |
+
summary_path.write_text(json.dumps(summary, indent=2, ensure_ascii=False), encoding="utf-8")
|
| 136 |
+
|
| 137 |
+
print(json.dumps(summary, indent=2, ensure_ascii=False))
|
| 138 |
+
print(f"\nClean examples: {args.clean}")
|
| 139 |
+
print(f"Rejected examples: {args.rejected}")
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
if __name__ == "__main__":
|
| 143 |
+
main()
|
tests/test_pipeline.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import unittest
|
| 5 |
+
|
| 6 |
+
from scripts._trajectory_utils import oracle_actions, replay_actions
|
| 7 |
+
from server.environment import CorpEnvironment
|
| 8 |
+
from server.verifiers import verify_e1, verify_m1
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class PipelineSmokeTests(unittest.TestCase):
|
| 12 |
+
def setUp(self) -> None:
|
| 13 |
+
os.environ["CORP_STUB_WORKERS"] = "1"
|
| 14 |
+
os.environ["CORP_DISABLE_LLM_JUDGE"] = "1"
|
| 15 |
+
|
| 16 |
+
def test_oracle_e1_replays_cleanly(self) -> None:
|
| 17 |
+
result = replay_actions(
|
| 18 |
+
example_id="test-e1",
|
| 19 |
+
task_id="e1_launch_readiness",
|
| 20 |
+
actions=oracle_actions("e1_launch_readiness"),
|
| 21 |
+
)
|
| 22 |
+
self.assertEqual(result.status, "clean")
|
| 23 |
+
self.assertGreaterEqual(result.terminal_reward, 0.65)
|
| 24 |
+
self.assertTrue(all(result.verifier_result.values()))
|
| 25 |
+
|
| 26 |
+
def test_oracle_m1_replays_cleanly(self) -> None:
|
| 27 |
+
result = replay_actions(
|
| 28 |
+
example_id="test-m1",
|
| 29 |
+
task_id="m1_budget_reallocation",
|
| 30 |
+
actions=oracle_actions("m1_budget_reallocation"),
|
| 31 |
+
)
|
| 32 |
+
self.assertEqual(result.status, "clean")
|
| 33 |
+
self.assertGreaterEqual(result.verifier_pass_rate, 5 / 6)
|
| 34 |
+
|
| 35 |
+
def test_invalid_trajectory_is_rejected(self) -> None:
|
| 36 |
+
result = replay_actions(
|
| 37 |
+
example_id="bad",
|
| 38 |
+
task_id="e1_launch_readiness",
|
| 39 |
+
actions=[{"action_type": "finalize", "payload": "GO"}],
|
| 40 |
+
)
|
| 41 |
+
self.assertEqual(result.status, "rejected")
|
| 42 |
+
|
| 43 |
+
def test_verifier_e1_requires_qa_and_final(self) -> None:
|
| 44 |
+
env = CorpEnvironment()
|
| 45 |
+
swd = env.reset(task_id="e1_launch_readiness").swd
|
| 46 |
+
checks = verify_e1(swd)
|
| 47 |
+
self.assertFalse(checks["qa_report_present"])
|
| 48 |
+
self.assertFalse(checks["final_rec_valid"])
|
| 49 |
+
|
| 50 |
+
def test_verifier_m1_budget_terms(self) -> None:
|
| 51 |
+
swd = {
|
| 52 |
+
"agent_reports": {"dev": "ok", "finance": "ok"},
|
| 53 |
+
"conflicts_identified": [{"id": "c1"}],
|
| 54 |
+
"conflict_resolutions": [{"conflict_id": "c1"}],
|
| 55 |
+
"decisions": [],
|
| 56 |
+
"reasoning_log": [{"turn": 1, "text": "budget and runway are constrained"}],
|
| 57 |
+
"final_recommendation": {"phase_1": "limited GPU purchase"},
|
| 58 |
+
}
|
| 59 |
+
checks = verify_m1(swd)
|
| 60 |
+
self.assertTrue(checks["required_agents_consulted"])
|
| 61 |
+
self.assertTrue(checks["budget_constraint_acknowledged"])
|
| 62 |
+
self.assertTrue(checks["phased_plan"])
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
if __name__ == "__main__":
|
| 66 |
+
unittest.main()
|
training/train_grpo.py
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""GRPO/RLVR training for CORP-ENV with verifier rewards.
|
| 2 |
+
|
| 3 |
+
This script is intended for short Lightning AI H100 windows after SFT:
|
| 4 |
+
|
| 5 |
+
python training/train_grpo.py \
|
| 6 |
+
--model Qwen/Qwen2.5-7B-Instruct \
|
| 7 |
+
--adapter outputs/sft_adapter \
|
| 8 |
+
--examples data/processed/e1_m1_clean.jsonl \
|
| 9 |
+
--output outputs/grpo_adapter
|
| 10 |
+
|
| 11 |
+
The reward function recreates the environment state from a verified action prefix,
|
| 12 |
+
applies the sampled next action, and returns the real environment reward plus
|
| 13 |
+
penalties for invalid JSON/actions.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
from __future__ import annotations
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import json
|
| 20 |
+
import os
|
| 21 |
+
import sys
|
| 22 |
+
from pathlib import Path
|
| 23 |
+
from typing import Any, Dict, List
|
| 24 |
+
|
| 25 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 26 |
+
if str(ROOT) not in sys.path:
|
| 27 |
+
sys.path.insert(0, str(ROOT))
|
| 28 |
+
|
| 29 |
+
from corp_env.models import CorpAction # noqa: E402
|
| 30 |
+
from scripts._trajectory_utils import ( # noqa: E402
|
| 31 |
+
DEFAULT_TASKS,
|
| 32 |
+
extract_actions,
|
| 33 |
+
extract_json_object,
|
| 34 |
+
observation_message,
|
| 35 |
+
oracle_actions,
|
| 36 |
+
read_jsonl,
|
| 37 |
+
)
|
| 38 |
+
from server.agents.master_prompts import build_system_prompt # noqa: E402
|
| 39 |
+
from server.environment import CorpEnvironment # noqa: E402
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def prompt_for_prefix(task_id: str, prefix_actions: List[Dict[str, Any]]) -> List[Dict[str, str]]:
|
| 43 |
+
env = CorpEnvironment()
|
| 44 |
+
obs = env.reset(task_id=task_id)
|
| 45 |
+
messages = [{"role": "system", "content": build_system_prompt(obs.master_tier, obs.role)}]
|
| 46 |
+
for step, action_obj in enumerate(prefix_actions):
|
| 47 |
+
messages.append({"role": "user", "content": observation_message(step, obs)})
|
| 48 |
+
messages.append({"role": "assistant", "content": json.dumps(action_obj, ensure_ascii=False)})
|
| 49 |
+
obs = env.step(CorpAction.model_validate(action_obj))
|
| 50 |
+
if obs.done:
|
| 51 |
+
break
|
| 52 |
+
messages.append({"role": "user", "content": observation_message(len(prefix_actions), obs)})
|
| 53 |
+
return messages
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def build_prompt_dataset(examples_path: str, tasks: List[str], repeats: int) -> List[Dict[str, Any]]:
|
| 57 |
+
rows: List[Dict[str, Any]] = []
|
| 58 |
+
path = Path(examples_path)
|
| 59 |
+
if path.exists():
|
| 60 |
+
examples = list(read_jsonl(path))
|
| 61 |
+
for example in examples:
|
| 62 |
+
if example.get("status") and example.get("status") != "clean":
|
| 63 |
+
continue
|
| 64 |
+
task_id = str(example.get("task_id") or "")
|
| 65 |
+
if task_id not in tasks:
|
| 66 |
+
continue
|
| 67 |
+
actions = extract_actions(example)
|
| 68 |
+
for idx in range(len(actions)):
|
| 69 |
+
prefix = actions[:idx]
|
| 70 |
+
rows.append(
|
| 71 |
+
{
|
| 72 |
+
"prompt": prompt_for_prefix(task_id, prefix),
|
| 73 |
+
"task_id": task_id,
|
| 74 |
+
"prefix_actions": json.dumps(prefix, ensure_ascii=False),
|
| 75 |
+
}
|
| 76 |
+
)
|
| 77 |
+
if rows:
|
| 78 |
+
return rows
|
| 79 |
+
|
| 80 |
+
for _ in range(repeats):
|
| 81 |
+
for task_id in tasks:
|
| 82 |
+
actions = oracle_actions(task_id)
|
| 83 |
+
for idx in range(len(actions)):
|
| 84 |
+
prefix = actions[:idx]
|
| 85 |
+
rows.append(
|
| 86 |
+
{
|
| 87 |
+
"prompt": prompt_for_prefix(task_id, prefix),
|
| 88 |
+
"task_id": task_id,
|
| 89 |
+
"prefix_actions": json.dumps(prefix, ensure_ascii=False),
|
| 90 |
+
}
|
| 91 |
+
)
|
| 92 |
+
return rows
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def environment_reward(
|
| 96 |
+
completions: List[Any],
|
| 97 |
+
task_id: List[str],
|
| 98 |
+
prefix_actions: List[str],
|
| 99 |
+
**_: Any,
|
| 100 |
+
) -> List[float]:
|
| 101 |
+
rewards: List[float] = []
|
| 102 |
+
for completion, tid, prefix_raw in zip(completions, task_id, prefix_actions):
|
| 103 |
+
env = CorpEnvironment()
|
| 104 |
+
obs = env.reset(task_id=tid)
|
| 105 |
+
try:
|
| 106 |
+
prefix = json.loads(prefix_raw)
|
| 107 |
+
for action_obj in prefix:
|
| 108 |
+
obs = env.step(CorpAction.model_validate(action_obj))
|
| 109 |
+
if obs.done:
|
| 110 |
+
break
|
| 111 |
+
except Exception:
|
| 112 |
+
rewards.append(-0.25)
|
| 113 |
+
continue
|
| 114 |
+
|
| 115 |
+
text = completion
|
| 116 |
+
if isinstance(completion, list) and completion:
|
| 117 |
+
text = completion[0].get("content", "")
|
| 118 |
+
elif isinstance(completion, dict):
|
| 119 |
+
text = completion.get("content", "")
|
| 120 |
+
try:
|
| 121 |
+
obj = extract_json_object(str(text))
|
| 122 |
+
obj.pop("thought", None)
|
| 123 |
+
if "payload" in obj and not isinstance(obj["payload"], str):
|
| 124 |
+
obj["payload"] = json.dumps(obj["payload"], ensure_ascii=False)
|
| 125 |
+
action = CorpAction.model_validate(obj)
|
| 126 |
+
except Exception:
|
| 127 |
+
rewards.append(-0.25)
|
| 128 |
+
continue
|
| 129 |
+
obs = env.step(action)
|
| 130 |
+
reward = float(obs.reward or 0.0)
|
| 131 |
+
if obs.error:
|
| 132 |
+
reward -= 0.15
|
| 133 |
+
rewards.append(max(-1.0, min(1.0, reward)))
|
| 134 |
+
return rewards
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def main() -> None:
|
| 138 |
+
parser = argparse.ArgumentParser(description="Train CORP-ENV GRPO adapter.")
|
| 139 |
+
parser.add_argument("--model", default="Qwen/Qwen2.5-7B-Instruct")
|
| 140 |
+
parser.add_argument("--adapter", default="outputs/sft_adapter")
|
| 141 |
+
parser.add_argument("--examples", default="data/processed/e1_m1_clean.jsonl")
|
| 142 |
+
parser.add_argument("--output", default="outputs/grpo_adapter")
|
| 143 |
+
parser.add_argument("--tasks", default="e1_launch_readiness,m1_budget_reallocation")
|
| 144 |
+
parser.add_argument("--repeats", type=int, default=128)
|
| 145 |
+
parser.add_argument("--max-prompt-length", type=int, default=8192)
|
| 146 |
+
parser.add_argument("--max-completion-length", type=int, default=1024)
|
| 147 |
+
parser.add_argument("--lr", type=float, default=5e-6)
|
| 148 |
+
parser.add_argument("--batch-size", type=int, default=1)
|
| 149 |
+
parser.add_argument("--grad-accum", type=int, default=8)
|
| 150 |
+
parser.add_argument("--generations", type=int, default=4)
|
| 151 |
+
parser.add_argument("--max-steps", type=int, default=150)
|
| 152 |
+
parser.add_argument("--push-to-hub", default="")
|
| 153 |
+
args = parser.parse_args()
|
| 154 |
+
|
| 155 |
+
os.environ.setdefault("CORP_STUB_WORKERS", "1")
|
| 156 |
+
os.environ.setdefault("CORP_DISABLE_LLM_JUDGE", "1")
|
| 157 |
+
|
| 158 |
+
try:
|
| 159 |
+
from datasets import Dataset
|
| 160 |
+
from peft import PeftModel
|
| 161 |
+
from trl import GRPOConfig, GRPOTrainer
|
| 162 |
+
from unsloth import FastLanguageModel
|
| 163 |
+
except ImportError as exc:
|
| 164 |
+
raise SystemExit(
|
| 165 |
+
"GRPO training requires unsloth, trl, datasets, and peft. On Lightning AI, install with:\n"
|
| 166 |
+
" pip install -U unsloth trl datasets accelerate peft bitsandbytes transformers"
|
| 167 |
+
) from exc
|
| 168 |
+
|
| 169 |
+
tasks = [t.strip() for t in args.tasks.split(",") if t.strip()] or list(DEFAULT_TASKS)
|
| 170 |
+
rows = build_prompt_dataset(args.examples, tasks, args.repeats)
|
| 171 |
+
dataset = Dataset.from_list(rows)
|
| 172 |
+
|
| 173 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 174 |
+
model_name=args.model,
|
| 175 |
+
max_seq_length=args.max_prompt_length + args.max_completion_length,
|
| 176 |
+
dtype=None,
|
| 177 |
+
load_in_4bit=True,
|
| 178 |
+
)
|
| 179 |
+
if args.adapter:
|
| 180 |
+
model = PeftModel.from_pretrained(model, args.adapter, is_trainable=True)
|
| 181 |
+
else:
|
| 182 |
+
model = FastLanguageModel.get_peft_model(
|
| 183 |
+
model,
|
| 184 |
+
r=32,
|
| 185 |
+
target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
|
| 186 |
+
lora_alpha=32,
|
| 187 |
+
lora_dropout=0.0,
|
| 188 |
+
bias="none",
|
| 189 |
+
use_gradient_checkpointing="unsloth",
|
| 190 |
+
random_state=3407,
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
config = GRPOConfig(
|
| 194 |
+
output_dir=args.output,
|
| 195 |
+
learning_rate=args.lr,
|
| 196 |
+
per_device_train_batch_size=args.batch_size,
|
| 197 |
+
gradient_accumulation_steps=args.grad_accum,
|
| 198 |
+
num_generations=args.generations,
|
| 199 |
+
max_prompt_length=args.max_prompt_length,
|
| 200 |
+
max_completion_length=args.max_completion_length,
|
| 201 |
+
max_steps=args.max_steps,
|
| 202 |
+
logging_steps=5,
|
| 203 |
+
save_steps=25,
|
| 204 |
+
save_total_limit=3,
|
| 205 |
+
bf16=True,
|
| 206 |
+
report_to="none",
|
| 207 |
+
)
|
| 208 |
+
trainer = GRPOTrainer(
|
| 209 |
+
model=model,
|
| 210 |
+
processing_class=tokenizer,
|
| 211 |
+
reward_funcs=environment_reward,
|
| 212 |
+
args=config,
|
| 213 |
+
train_dataset=dataset,
|
| 214 |
+
)
|
| 215 |
+
trainer.train()
|
| 216 |
+
trainer.save_model(args.output)
|
| 217 |
+
tokenizer.save_pretrained(args.output)
|
| 218 |
+
|
| 219 |
+
if args.push_to_hub:
|
| 220 |
+
trainer.push_to_hub(args.push_to_hub)
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
if __name__ == "__main__":
|
| 224 |
+
main()
|
training/train_sft.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""LoRA/QLoRA SFT for CORP-ENV action-format warm start.
|
| 2 |
+
|
| 3 |
+
Run on Lightning AI H100, not on the local lightweight environment:
|
| 4 |
+
|
| 5 |
+
python training/train_sft.py \
|
| 6 |
+
--model Qwen/Qwen2.5-7B-Instruct \
|
| 7 |
+
--data data/sft/e1_m1_examples.jsonl \
|
| 8 |
+
--output outputs/sft_adapter \
|
| 9 |
+
--push-to-hub your-org/corp-env-sft-adapter
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from __future__ import annotations
|
| 13 |
+
|
| 14 |
+
import argparse
|
| 15 |
+
import json
|
| 16 |
+
from pathlib import Path
|
| 17 |
+
from typing import Dict, List
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def load_text_rows(path: Path, tokenizer: object) -> List[Dict[str, str]]:
|
| 21 |
+
rows: List[Dict[str, str]] = []
|
| 22 |
+
with path.open("r", encoding="utf-8") as f:
|
| 23 |
+
for line in f:
|
| 24 |
+
if not line.strip():
|
| 25 |
+
continue
|
| 26 |
+
obj = json.loads(line)
|
| 27 |
+
messages = obj["messages"]
|
| 28 |
+
text = tokenizer.apply_chat_template(
|
| 29 |
+
messages,
|
| 30 |
+
tokenize=False,
|
| 31 |
+
add_generation_prompt=False,
|
| 32 |
+
)
|
| 33 |
+
rows.append({"text": text})
|
| 34 |
+
return rows
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def main() -> None:
|
| 38 |
+
parser = argparse.ArgumentParser(description="Train CORP-ENV SFT LoRA adapter.")
|
| 39 |
+
parser.add_argument("--model", default="Qwen/Qwen2.5-7B-Instruct")
|
| 40 |
+
parser.add_argument("--data", default="data/sft/e1_m1_examples.jsonl")
|
| 41 |
+
parser.add_argument("--output", default="outputs/sft_adapter")
|
| 42 |
+
parser.add_argument("--max-seq-length", type=int, default=8192)
|
| 43 |
+
parser.add_argument("--epochs", type=float, default=2.0)
|
| 44 |
+
parser.add_argument("--batch-size", type=int, default=1)
|
| 45 |
+
parser.add_argument("--grad-accum", type=int, default=8)
|
| 46 |
+
parser.add_argument("--lr", type=float, default=2e-4)
|
| 47 |
+
parser.add_argument("--save-steps", type=int, default=50)
|
| 48 |
+
parser.add_argument("--push-to-hub", default="")
|
| 49 |
+
args = parser.parse_args()
|
| 50 |
+
|
| 51 |
+
try:
|
| 52 |
+
from datasets import Dataset
|
| 53 |
+
from trl import SFTConfig, SFTTrainer
|
| 54 |
+
from unsloth import FastLanguageModel
|
| 55 |
+
except ImportError as exc:
|
| 56 |
+
raise SystemExit(
|
| 57 |
+
"SFT training requires datasets, trl, and unsloth. On Lightning AI, install with:\n"
|
| 58 |
+
" pip install -U unsloth trl datasets accelerate peft bitsandbytes transformers"
|
| 59 |
+
) from exc
|
| 60 |
+
|
| 61 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 62 |
+
model_name=args.model,
|
| 63 |
+
max_seq_length=args.max_seq_length,
|
| 64 |
+
dtype=None,
|
| 65 |
+
load_in_4bit=True,
|
| 66 |
+
)
|
| 67 |
+
model = FastLanguageModel.get_peft_model(
|
| 68 |
+
model,
|
| 69 |
+
r=32,
|
| 70 |
+
target_modules=[
|
| 71 |
+
"q_proj",
|
| 72 |
+
"k_proj",
|
| 73 |
+
"v_proj",
|
| 74 |
+
"o_proj",
|
| 75 |
+
"gate_proj",
|
| 76 |
+
"up_proj",
|
| 77 |
+
"down_proj",
|
| 78 |
+
],
|
| 79 |
+
lora_alpha=32,
|
| 80 |
+
lora_dropout=0.0,
|
| 81 |
+
bias="none",
|
| 82 |
+
use_gradient_checkpointing="unsloth",
|
| 83 |
+
random_state=3407,
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
dataset = Dataset.from_list(load_text_rows(Path(args.data), tokenizer))
|
| 87 |
+
config = SFTConfig(
|
| 88 |
+
output_dir=args.output,
|
| 89 |
+
dataset_text_field="text",
|
| 90 |
+
max_seq_length=args.max_seq_length,
|
| 91 |
+
per_device_train_batch_size=args.batch_size,
|
| 92 |
+
gradient_accumulation_steps=args.grad_accum,
|
| 93 |
+
num_train_epochs=args.epochs,
|
| 94 |
+
learning_rate=args.lr,
|
| 95 |
+
warmup_ratio=0.05,
|
| 96 |
+
lr_scheduler_type="cosine",
|
| 97 |
+
logging_steps=5,
|
| 98 |
+
save_steps=args.save_steps,
|
| 99 |
+
save_total_limit=3,
|
| 100 |
+
bf16=True,
|
| 101 |
+
packing=False,
|
| 102 |
+
report_to="none",
|
| 103 |
+
)
|
| 104 |
+
trainer = SFTTrainer(
|
| 105 |
+
model=model,
|
| 106 |
+
tokenizer=tokenizer,
|
| 107 |
+
train_dataset=dataset,
|
| 108 |
+
args=config,
|
| 109 |
+
)
|
| 110 |
+
trainer.train()
|
| 111 |
+
trainer.save_model(args.output)
|
| 112 |
+
tokenizer.save_pretrained(args.output)
|
| 113 |
+
|
| 114 |
+
if args.push_to_hub:
|
| 115 |
+
trainer.push_to_hub(args.push_to_hub)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
if __name__ == "__main__":
|
| 119 |
+
main()
|
uv.lock
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|