self-evolve-framework 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/skills/skillopt-sleep/SKILL.md +42 -0
- package/template/skills/skillopt-sleep/configs/_base_/default.yaml +103 -0
- package/template/skills/skillopt-sleep/configs/alfworld/default.yaml +29 -0
- package/template/skills/skillopt-sleep/configs/docvqa/default.yaml +28 -0
- package/template/skills/skillopt-sleep/configs/features/soft_gate.yaml +47 -0
- package/template/skills/skillopt-sleep/configs/livemathematicianbench/default.yaml +22 -0
- package/template/skills/skillopt-sleep/configs/officeqa/default.yaml +34 -0
- package/template/skills/skillopt-sleep/configs/searchqa/default.yaml +32 -0
- package/template/skills/skillopt-sleep/configs/spreadsheetbench/default.yaml +34 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/__init__.py +28 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/config.py +282 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/datasets/__init__.py +7 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/datasets/base.py +512 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/engine/__init__.py +9 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/engine/trainer.py +2379 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/__init__.py +1 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/README.md +43 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/config_template.yaml +55 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/env_template.py +151 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/loader_template.py +87 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/__init__.py +5 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/adapter.py +428 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/dataloader.py +123 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/analyst_error.md +55 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/analyst_success.md +33 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_no_history.md +8 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_with_history.md +9 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_with_memory.md +16 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/reflect.py +4 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/rollout.py +366 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/skills/initial.md +45 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/__init__.py +9 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_envs.py +221 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_projection.py +60 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_prompts.py +8 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/config_tw.yaml +145 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/env_base.py +84 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/env_manager.py +139 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/memory.py +87 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/base.py +329 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/__init__.py +1 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/adapter.py +90 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/dataloader.py +61 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/evaluator.py +113 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/analyst_error.md +35 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/analyst_success.md +24 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/rollout_system.md +12 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/rollout.py +391 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/skills/initial.md +11 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/__init__.py +1 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/adapter.py +129 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/dataloader.py +308 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/evaluator.py +62 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/analyst_error.md +37 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/analyst_success.md +25 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/rollout_system.md +12 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/reflect.py +4 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/rollout.py +434 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/skills/initial.md +16 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/__init__.py +1 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/adapter.py +112 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/dataloader.py +71 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/evaluator.py +46 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/analyst_error.md +37 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/analyst_success.md +25 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/rollout_system.md +15 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/rollout.py +799 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/skills/initial.md +15 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/tool_runtime.py +552 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/__init__.py +1 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/adapter.py +96 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/dataloader.py +42 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/evaluator.py +100 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/analyst_error.md +46 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/analyst_success.md +32 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/rollout_system.md +13 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/reflect.py +4 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/rollout.py +494 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/skills/initial.md +3 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/__init__.py +5 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/adapter.py +159 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/codegen_agent.py +731 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/dataloader.py +37 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/evaluator.py +158 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/executor.py +67 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/analyst_error.md +46 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/analyst_success.md +32 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/codegen_system.md +1 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/critical_rules.md +9 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/react_system.md +21 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/react_agent.py +395 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/reflect.py +4 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/rollout.py +979 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/skills/initial.md +56 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/evaluation/__init__.py +13 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/evaluation/gate.py +148 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/__init__.py +15 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/aggregate.py +253 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/reflect.py +635 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/__init__.py +514 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/azure_openai.py +915 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/backend_config.py +185 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/claude_backend.py +371 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/codex_backend.py +666 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/codex_harness.py +1057 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/common.py +229 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/minimax_backend.py +277 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/qwen_backend.py +456 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/router.py +236 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/__init__.py +15 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/appendix.py +156 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/clip.py +109 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/lr_autonomous.py +108 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/meta_skill.py +79 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/rewrite.py +59 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/scheduler.py +127 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/select.py +4 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/skill.py +201 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/skill_aware.py +206 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/slow_update.py +396 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/update_modes.py +135 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/__init__.py +63 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error.md +41 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error_full_rewrite.md +32 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error_rewrite.md +44 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success.md +36 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success_full_rewrite.md +30 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success_rewrite.md +33 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/lr_autonomous.md +20 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure.md +30 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure_full_rewrite.md +28 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure_rewrite.md +26 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final.md +33 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final_full_rewrite.md +28 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final_rewrite.md +25 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success.md +28 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success_full_rewrite.md +28 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success_rewrite.md +25 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/meta_skill.md +40 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/ranking.md +20 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/ranking_rewrite.md +15 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/rewrite_skill.md +25 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/slow_update.md +60 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/scheduler/__init__.py +8 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/types.py +306 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/__init__.py +4 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/json_utils.py +172 -0
- package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/scoring.py +28 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""SearchQA task dataloader."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
from skillopt.datasets.base import SplitDataLoader
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# ── Raw data loading utilities (for preprocessing / standalone eval) ─────
|
|
10
|
+
|
|
11
|
+
def _load_items(path: str) -> list[dict]:
|
|
12
|
+
"""Load items from JSON or JSONL file."""
|
|
13
|
+
with open(path) as f:
|
|
14
|
+
content = f.read().strip()
|
|
15
|
+
try:
|
|
16
|
+
data = json.loads(content)
|
|
17
|
+
if isinstance(data, list):
|
|
18
|
+
return data
|
|
19
|
+
if isinstance(data, dict):
|
|
20
|
+
return data.get("data") or list(data.values())
|
|
21
|
+
except json.JSONDecodeError:
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
items = []
|
|
25
|
+
for line in content.splitlines():
|
|
26
|
+
line = line.strip()
|
|
27
|
+
if line:
|
|
28
|
+
items.append(json.loads(line))
|
|
29
|
+
return items
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# ── Dataloader ───────────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
class SearchQADataLoader(SplitDataLoader):
|
|
35
|
+
"""SearchQA dataloader.
|
|
36
|
+
|
|
37
|
+
Each split directory (train/, val/, test/) contains a .json file —
|
|
38
|
+
a JSON array of question items.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def load_raw_items(self, data_path: str) -> list[dict]:
|
|
42
|
+
return _load_items(data_path)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""SearchQA evaluation metrics: Exact Match, F1, and Substring Match.
|
|
2
|
+
|
|
3
|
+
Normalization follows the SQuAD convention:
|
|
4
|
+
- lowercase
|
|
5
|
+
- remove punctuation
|
|
6
|
+
- remove articles (a, an, the)
|
|
7
|
+
- collapse whitespace
|
|
8
|
+
|
|
9
|
+
Answer extraction looks for <answer>...</answer> XML tags,
|
|
10
|
+
falling back to the last non-empty line of the response.
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import re
|
|
15
|
+
import string
|
|
16
|
+
from collections import Counter
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def normalize_answer(s: str) -> str:
|
|
20
|
+
"""Normalize answer string (SQuAD convention)."""
|
|
21
|
+
s = s.lower()
|
|
22
|
+
s = "".join(ch for ch in s if ch not in string.punctuation)
|
|
23
|
+
s = re.sub(r"\b(a|an|the)\b", " ", s)
|
|
24
|
+
s = " ".join(s.split())
|
|
25
|
+
return s.strip()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def extract_answer(text: str) -> str:
|
|
29
|
+
"""Extract answer from <answer>...</answer> tags.
|
|
30
|
+
|
|
31
|
+
Fallback: last non-empty line, then full response stripped.
|
|
32
|
+
"""
|
|
33
|
+
matches = re.findall(r"<answer>(.*?)</answer>", text, re.DOTALL | re.IGNORECASE)
|
|
34
|
+
if matches:
|
|
35
|
+
return matches[-1].strip()
|
|
36
|
+
lines = [ln.strip() for ln in text.strip().splitlines() if ln.strip()]
|
|
37
|
+
if lines:
|
|
38
|
+
return lines[-1]
|
|
39
|
+
return text.strip()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def exact_match(prediction: str, gold_answers: list[str]) -> float:
|
|
43
|
+
norm_pred = normalize_answer(prediction)
|
|
44
|
+
for gold in gold_answers:
|
|
45
|
+
if normalize_answer(gold) == norm_pred:
|
|
46
|
+
return 1.0
|
|
47
|
+
return 0.0
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def f1_score(prediction: str, gold_answers: list[str]) -> float:
|
|
51
|
+
"""Token-level F1 (SQuAD-style), max across all gold answers."""
|
|
52
|
+
norm_pred = normalize_answer(prediction)
|
|
53
|
+
pred_tokens = norm_pred.split()
|
|
54
|
+
|
|
55
|
+
if not pred_tokens:
|
|
56
|
+
for gold in gold_answers:
|
|
57
|
+
if not normalize_answer(gold).split():
|
|
58
|
+
return 1.0
|
|
59
|
+
return 0.0
|
|
60
|
+
|
|
61
|
+
best_f1 = 0.0
|
|
62
|
+
for gold in gold_answers:
|
|
63
|
+
gold_tokens = normalize_answer(gold).split()
|
|
64
|
+
if not gold_tokens:
|
|
65
|
+
continue
|
|
66
|
+
common = Counter(pred_tokens) & Counter(gold_tokens)
|
|
67
|
+
n_common = sum(common.values())
|
|
68
|
+
if n_common == 0:
|
|
69
|
+
continue
|
|
70
|
+
precision = n_common / len(pred_tokens)
|
|
71
|
+
recall = n_common / len(gold_tokens)
|
|
72
|
+
f1 = 2 * precision * recall / (precision + recall)
|
|
73
|
+
best_f1 = max(best_f1, f1)
|
|
74
|
+
|
|
75
|
+
return best_f1
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def sub_em(prediction: str, gold_answers: list[str]) -> float:
|
|
79
|
+
"""1.0 if any normalized gold is a substring of prediction, or vice versa."""
|
|
80
|
+
norm_pred = normalize_answer(prediction)
|
|
81
|
+
for gold in gold_answers:
|
|
82
|
+
norm_gold = normalize_answer(gold)
|
|
83
|
+
if norm_gold in norm_pred or norm_pred in norm_gold:
|
|
84
|
+
return 1.0
|
|
85
|
+
return 0.0
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def evaluate(prediction_text: str, gold_answers: list[str]) -> dict:
|
|
89
|
+
"""Evaluate a single QA prediction against gold answers.
|
|
90
|
+
|
|
91
|
+
Returns dict with: em, f1, sub_em, predicted_answer, gold_answers.
|
|
92
|
+
"""
|
|
93
|
+
answer = extract_answer(prediction_text)
|
|
94
|
+
return {
|
|
95
|
+
"em": exact_match(answer, gold_answers),
|
|
96
|
+
"f1": f1_score(answer, gold_answers),
|
|
97
|
+
"sub_em": sub_em(answer, gold_answers),
|
|
98
|
+
"predicted_answer": answer,
|
|
99
|
+
"gold_answers": gold_answers,
|
|
100
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
You are an expert failure-analysis agent for question answering tasks.
|
|
2
|
+
|
|
3
|
+
You will be given MULTIPLE failed QA agent responses from a single minibatch
|
|
4
|
+
and the current skill document. Each trajectory includes the agent's response
|
|
5
|
+
and an evaluation result showing the predicted answer vs. the gold answer(s).
|
|
6
|
+
|
|
7
|
+
Your job is to identify the most important COMMON failure patterns across
|
|
8
|
+
the batch and propose a concise set of skill edits.
|
|
9
|
+
|
|
10
|
+
## Failure Type Categories
|
|
11
|
+
- **rule_missing**: the skill lacks a relevant rule for this type of question
|
|
12
|
+
- **rule_wrong**: an existing skill rule is misleading or incorrect
|
|
13
|
+
- **rule_ignored**: the skill has the right rule but the agent did not follow it
|
|
14
|
+
- **answer_format**: the agent found the right information but formatted it incorrectly
|
|
15
|
+
- **other**: none of the above
|
|
16
|
+
|
|
17
|
+
## Analysis Process
|
|
18
|
+
1. Read ALL failed trajectories in the minibatch.
|
|
19
|
+
2. Carefully compare each predicted answer against the gold answer(s) —
|
|
20
|
+
understand exactly WHY the Exact Match failed.
|
|
21
|
+
3. Identify the most prevalent, systematic failure patterns across them.
|
|
22
|
+
4. For each pattern, classify its failure type.
|
|
23
|
+
5. Propose skill edits that address the COMMON patterns — not individual edge cases.
|
|
24
|
+
6. Edits must be generalizable; do not hardcode question-specific values.
|
|
25
|
+
7. Only patch gaps in the skill — do not duplicate existing content.
|
|
26
|
+
|
|
27
|
+
You will be told the maximum number of edits (the budget L). Produce AT MOST L edits,
|
|
28
|
+
focusing on the highest-impact patterns. You may produce fewer if warranted.
|
|
29
|
+
|
|
30
|
+
Respond ONLY with a valid JSON object (no markdown fences, no extra text):
|
|
31
|
+
{
|
|
32
|
+
"batch_size": <number of trajectories analysed>,
|
|
33
|
+
"failure_summary": [
|
|
34
|
+
{"failure_type": "<type>", "count": <int>, "description": "<one-line>"}
|
|
35
|
+
],
|
|
36
|
+
"patch": {
|
|
37
|
+
"reasoning": "<why these edits address the batch's common failures>",
|
|
38
|
+
"edits": [
|
|
39
|
+
{"op": "append", "content": "<markdown to add at end of skill>"},
|
|
40
|
+
{"op": "insert_after", "target": "<exact heading/text to insert after>", "content": "<markdown>"},
|
|
41
|
+
{"op": "replace", "target": "<exact text to replace>", "content": "<replacement>"},
|
|
42
|
+
{"op": "delete", "target": "<exact text to remove>"}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
Only include edits that are needed. "edits" can be an empty list if no patch is warranted.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
You are an expert success-pattern analyst for AI question answering agents.
|
|
2
|
+
|
|
3
|
+
You will be given MULTIPLE successful QA agent responses from a single minibatch
|
|
4
|
+
and the current skill document. Your job is to identify generalizable behavior
|
|
5
|
+
patterns that are COMMON across the batch and worth encoding in the skill.
|
|
6
|
+
|
|
7
|
+
## Rules
|
|
8
|
+
- Only propose patches for patterns NOT already covered in the skill.
|
|
9
|
+
- Focus on patterns that appear across MULTIPLE trajectories in the batch.
|
|
10
|
+
- Be concise. Patterns must generalize beyond specific questions.
|
|
11
|
+
- Prefer reinforcing existing sections over adding new top-level sections.
|
|
12
|
+
- If the agents' success involved a smart reading strategy or disambiguation
|
|
13
|
+
approach, consider reinforcing that in the patch.
|
|
14
|
+
|
|
15
|
+
You will be told the maximum number of edits (the budget L). Produce AT MOST L edits,
|
|
16
|
+
focusing on the most broadly applicable patterns. You may produce fewer if warranted.
|
|
17
|
+
|
|
18
|
+
Respond ONLY with a valid JSON object:
|
|
19
|
+
{
|
|
20
|
+
"batch_size": <number of trajectories analysed>,
|
|
21
|
+
"success_patterns": ["<pattern 1>", "<pattern 2>"],
|
|
22
|
+
"patch": {
|
|
23
|
+
"reasoning": "<why these patterns are worth encoding>",
|
|
24
|
+
"edits": [
|
|
25
|
+
{"op": "append", "content": "<markdown>"},
|
|
26
|
+
{"op": "insert_after", "target": "<heading/text>", "content": "<markdown>"},
|
|
27
|
+
{"op": "replace", "target": "<old text>", "content": "<new text>"},
|
|
28
|
+
{"op": "delete", "target": "<exact text to remove>"}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
"edits" may be empty if the skill already covers all observed patterns.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
You are an expert question answering agent.
|
|
2
|
+
|
|
3
|
+
{skill_section}## Task Format
|
|
4
|
+
You will receive a CONTEXT containing document passages and a QUESTION.
|
|
5
|
+
Read the context carefully and answer the question based on the information provided.
|
|
6
|
+
|
|
7
|
+
## Answer Format
|
|
8
|
+
Think step by step, then provide your final answer inside <answer>...</answer> tags.
|
|
9
|
+
Keep your answer concise — typically a few words or a short phrase.
|
|
10
|
+
Do not repeat the question. Do not include unnecessary explanation in the answer tags.
|
|
11
|
+
|
|
12
|
+
Example:
|
|
13
|
+
<answer>Abraham Lincoln</answer>
|