Improve agent search through meta-RL: generate multiple episodes sequentially, each building on prior attempts with explicit self-reflection. Use turn-level RLOO advantage estimation to provide dense credit without value models.
Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Improve agent search through meta-RL: generate multiple episodes sequentially, each building on prior attempts with explicit self-reflection. Use turn-level RLOO advantage estimation to provide dense credit without value models.
Technique: Cross-Episode Meta-Learning via In-Context Self-Reflection
Standard agent search treats each attempt independently—the model sees no feedback from failed attempts. Meta-RL-Search (MR-Search) inverts this: each new episode is conditioned on the full trajectory of prior attempts, with explicit reflections grounding the learning process. This transforms disconnected search tries into progressively informed exploration.
Rather than external process reward models, the approach uses turn-level RLOO advantage estimation to credit intermediate steps within each episode.
Core Concept
MR-Search operates through three principles:
Cross-Episode Learning: Each episode conditions on prior trajectories and reflections
Explicit Self-Reflection: Generate reflections explaining what was learned after each attempt
Turn-Level Advantage: Use RLOO to credit intermediate decisions within episodes
This enables 9-19% relative improvement over outcome-only RL without auxiliary models.
Architecture Overview
Agent policy: Base LLM for reasoning
Reflection generator: Creates actionable insights after each attempt
In-context memory: Accumulates trajectories and reflections
RLOO critic: Estimates advantages at turn granularity
Episode orchestrator: Sequences attempts with conditioning
Implementation Steps
Step 1: Generate Trajectory with Explicit Reflection
f"""Question: {question}
Trajectory:
{' '.join(trajectory)}
Final Answer: {answer}
What approach or reasoning pattern should inform the next attempt? (1-2 sentences)"""
self
100
return
def
_extract_final_answer
self, trajectory
"""Extract answer from trajectory."""
' '
if
"Final Answer:"
in
return
"Final Answer:"
1
return
1
def
_evaluate_answer
self, answer, question
"""Evaluate correctness (external)."""
# Placeholder: use external evaluator
return
1.0
if
self
else
0.0
def
_is_correct
self, answer
# External verification logic
return
True
# Placeholder
Step 2: RLOO Advantage Estimation at Turn Level
Compute advantages for intermediate steps within each episode.
classTurnLevelRLOOEstimator:
def__init__(self, model, tokenizer):
self.model = model
self.tokenizer = tokenizer
defcompute_turn_advantages(self, episode, baseline_episodes=None):
"""
Estimate advantages for each turn using leave-one-out estimation.
episode: SearchEpisode
baseline_episodes: list of baseline episodes for comparison
"""
trajectory = episode.trajectory
episode_reward = episode.reward
num_turns = len(trajectory)
# RLOO: recompute trajectory without each turn
turn_logprobs = []
turn_counterfactuals = []
for leave_out_idx inrange(num_turns):
# Reconstruct trajectory without this turn
modified_traj = [
trajectory[i] for i inrange(num_turns)
if i != leave_out_idx
]
# Recompute log probs for this modified trajectory
context = '\n'.join(modified_traj)
model_output = self.model.compute_log_probs(context, trajectory[leave_out_idx])
turn_logprobs.append(model_output)
# Evaluate counterfactual: what would reward be without this step?# Approximate: remove step, continue trajectory
modified_full_traj = modified_traj + trajectory[leave_out_idx + 1:]
final_answer = self._extract_answer(modified_full_traj)
counterfactual_reward = self._evaluate(final_answer)
turn_counterfactuals.append(counterfactual_reward)
# Advantages: actual - counterfactual
advantages = []
for i inrange(num_turns):
advantage = episode_reward - turn_counterfactuals[i]
advantages.append(advantage)
return torch.tensor(advantages)
def_extract_answer(self, trajectory):
full_text = ' '.join(trajectory)
if"Final Answer:"in full_text:
return full_text.split("Final Answer:")[-1].strip()
return full_text
def_evaluate(self, answer):
# External evaluationreturn1.0ifself._is_correct(answer) else0.0def_is_correct(self, answer):
returnTrue# Placeholder
Step 3: Sequential Episode Generation with Meta-Learning
Generate K episodes per question, each informed by prior attempts.