Harryis commited on
Commit
053bf5c
·
verified ·
1 Parent(s): d5579ad

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. wandb/run-20260112_222347-jo5wgffb/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py +454 -0
  2. wandb/run-20260112_223423-ozob7eqw/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py +454 -0
  3. wandb/run-20260112_223423-ozob7eqw/files/config.yaml +167 -0
  4. wandb/run-20260112_223423-ozob7eqw/files/diff.patch +1248 -0
  5. wandb/run-20260112_223423-ozob7eqw/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch +1248 -0
  6. wandb/run-20260112_223423-ozob7eqw/files/requirements.txt +313 -0
  7. wandb/run-20260112_223423-ozob7eqw/files/wandb-metadata.json +64 -0
  8. wandb/run-20260112_223423-ozob7eqw/files/wandb-summary.json +1 -0
  9. wandb/run-20260112_223643-sgt786ss/files/code/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py +485 -0
  10. wandb/run-20260112_223643-sgt786ss/files/config.yaml +167 -0
  11. wandb/run-20260112_223643-sgt786ss/files/diff.patch +1248 -0
  12. wandb/run-20260112_223643-sgt786ss/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch +1248 -0
  13. wandb/run-20260112_223643-sgt786ss/files/requirements.txt +313 -0
  14. wandb/run-20260112_223643-sgt786ss/files/wandb-metadata.json +64 -0
  15. wandb/run-20260112_223643-sgt786ss/files/wandb-summary.json +1 -0
  16. wandb/run-20260112_223856-d964bhe6/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py +454 -0
  17. wandb/run-20260112_223856-d964bhe6/files/config.yaml +167 -0
  18. wandb/run-20260112_223856-d964bhe6/files/diff.patch +1248 -0
  19. wandb/run-20260112_223856-d964bhe6/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch +1248 -0
  20. wandb/run-20260112_223856-d964bhe6/files/requirements.txt +313 -0
  21. wandb/run-20260112_223856-d964bhe6/files/wandb-metadata.json +64 -0
  22. wandb/run-20260112_223856-d964bhe6/files/wandb-summary.json +1 -0
  23. wandb/run-20260112_224209-62o99t0u/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py +454 -0
  24. wandb/run-20260112_224209-62o99t0u/files/config.yaml +167 -0
  25. wandb/run-20260112_224209-62o99t0u/files/diff.patch +1248 -0
  26. wandb/run-20260112_224209-62o99t0u/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch +1248 -0
  27. wandb/run-20260112_224209-62o99t0u/files/requirements.txt +313 -0
  28. wandb/run-20260112_224209-62o99t0u/files/wandb-metadata.json +64 -0
  29. wandb/run-20260112_224209-62o99t0u/files/wandb-summary.json +1 -0
  30. wandb/run-20260112_224942-jlcvlgih/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py +454 -0
  31. wandb/run-20260112_224942-jlcvlgih/files/config.yaml +167 -0
  32. wandb/run-20260112_224942-jlcvlgih/files/diff.patch +1248 -0
  33. wandb/run-20260112_224942-jlcvlgih/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch +1248 -0
  34. wandb/run-20260112_224942-jlcvlgih/files/requirements.txt +313 -0
  35. wandb/run-20260112_224942-jlcvlgih/files/wandb-metadata.json +64 -0
  36. wandb/run-20260112_224942-jlcvlgih/files/wandb-summary.json +1 -0
  37. wandb/run-20260112_225250-k2i6dnry/files/code/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py +485 -0
  38. wandb/run-20260112_225250-k2i6dnry/files/config.yaml +167 -0
  39. wandb/run-20260112_225250-k2i6dnry/files/diff.patch +1248 -0
  40. wandb/run-20260112_225250-k2i6dnry/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch +1248 -0
  41. wandb/run-20260112_225250-k2i6dnry/files/requirements.txt +313 -0
  42. wandb/run-20260112_225250-k2i6dnry/files/wandb-metadata.json +64 -0
  43. wandb/run-20260112_225250-k2i6dnry/files/wandb-summary.json +1 -0
  44. wandb/run-20260112_225324-locrg3kr/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py +454 -0
  45. wandb/run-20260112_225324-locrg3kr/files/config.yaml +167 -0
  46. wandb/run-20260112_225324-locrg3kr/files/diff.patch +1248 -0
  47. wandb/run-20260112_225324-locrg3kr/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch +1248 -0
  48. wandb/run-20260112_225324-locrg3kr/files/requirements.txt +313 -0
  49. wandb/run-20260112_225324-locrg3kr/files/wandb-metadata.json +64 -0
  50. wandb/run-20260112_225324-locrg3kr/files/wandb-summary.json +1 -0
wandb/run-20260112_222347-jo5wgffb/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Step Penalty & Time Limit Bootstrap for RAGEN Rubik's Cube 2x2
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+ import re
10
+
11
+ import gymnasium as gym
12
+ import numpy as np
13
+ import torch
14
+ import torch.nn as nn
15
+ import torch.optim as optim
16
+ import tyro
17
+
18
+ import sys
19
+ # 假设 ragen 库在当前目录的上两级,请根据实际情况调整
20
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
21
+
22
+ from ragen.env.rubikscube.env import RubiksCube2x2Env
23
+ from ragen.env.rubikscube.config import RubiksCube2x2Config
24
+
25
+
26
+ class RubiksCubeWrapper(gym.Env):
27
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
28
+
29
+ def __init__(self, env: RubiksCube2x2Env):
30
+ super().__init__()
31
+ self._env = env
32
+ self._colors = ['W', 'O', 'G', 'R', 'B', 'Y']
33
+ self._color_to_idx = {c: i for i, c in enumerate(self._colors)}
34
+ self.observation_space = gym.spaces.Box(low=0.0, high=1.0, shape=(24 * len(self._colors),), dtype=np.float32)
35
+ self.action_space = gym.spaces.Discrete(12)
36
+ self._face_pat = re.compile(r"\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])\n\s*\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])")
37
+
38
+ # [关键修改] 每步惩罚
39
+ # 如果20步都没解出来,累计惩罚是 20 * -0.05 = -1.0,抵消掉最后可能获得的 +1.0
40
+ # 这迫使 agent 寻找更短路径
41
+ self.step_penalty = -0.1
42
+
43
+ def _encode_obs(self, text_obs: str) -> np.ndarray:
44
+ faces_order = ["Up (U):", "Left (L):", "Front (F):", "Right (R):", "Back (B):", "Down (D):"]
45
+ lines = text_obs.splitlines()
46
+ blocks: List[str] = []
47
+ i = 0
48
+ while i < len(lines):
49
+ line = lines[i]
50
+ for header in faces_order:
51
+ if line.startswith(header):
52
+ content = line[len(header):].strip()
53
+ next_line = lines[i + 1] if i + 1 < len(lines) else ""
54
+ block = f"{content}\n{next_line}"
55
+ blocks.append(block)
56
+ break
57
+ i += 1
58
+ if len(blocks) != 6:
59
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
60
+ stickers: List[int] = []
61
+ for blk in blocks:
62
+ m = self._face_pat.search(blk)
63
+ if not m:
64
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
65
+ c0, c1, c2, c3 = m.group(1), m.group(2), m.group(3), m.group(4)
66
+ stickers.extend([c0, c1, c2, c3])
67
+ grid = np.zeros((24, len(self._colors)), dtype=np.float32)
68
+ for idx, ch in enumerate(stickers):
69
+ cidx = self._color_to_idx.get(ch, None)
70
+ if cidx is not None:
71
+ grid[idx, cidx] = 1.0
72
+ return grid.reshape(-1)
73
+
74
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
75
+ text_obs = self._env.reset(seed=seed)
76
+ obs = self._encode_obs(text_obs)
77
+ return obs, {}
78
+
79
+ def step(self, action: int):
80
+ mapped = int(action) + 1
81
+ text_obs, reward, done, info = self._env.step(mapped)
82
+ obs = self._encode_obs(text_obs)
83
+ terminated = bool(done)
84
+ truncated = False
85
+
86
+ # [关键修改] 应用惩罚
87
+ # 此时 reward 包含原本的稀疏奖励 (0 或 1) 加上每步惩罚
88
+ reward = float(reward) + self.step_penalty
89
+
90
+ return obs, reward, terminated, truncated, info or {}
91
+
92
+ def render(self):
93
+ return self._env.render()
94
+
95
+ def close(self):
96
+ self._env.close()
97
+
98
+
99
+ @dataclass
100
+ class Args:
101
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
102
+ seed: int = 1
103
+ torch_deterministic: bool = True
104
+ cuda: bool = True
105
+ track: bool = True
106
+ wandb_project_name: str = "cleanRL"
107
+ wandb_entity: str | None = None
108
+ capture_video: bool = False
109
+
110
+ # Algorithm
111
+ env_id: str = "RubiksCube2x2DQN"
112
+ total_timesteps: int = 400_000
113
+ learning_rate: float = 2.5e-4
114
+ gamma: float = 0.99
115
+ batch_size: int = 128
116
+ buffer_size: int = 200_000
117
+ target_network_frequency: int = 4000
118
+ train_frequency: int = 4
119
+ learning_starts: int = 5000
120
+
121
+ # Epsilon-greedy
122
+ start_e: float = 1.0
123
+ end_e: float = 0.05
124
+ exploration_fraction: float = 0.2
125
+
126
+ # Model size
127
+ hidden_size: int = 256
128
+
129
+ # Rubik specific
130
+ scramble_depth: int = 2 # 初始难度
131
+ max_steps_env: int = 20 # 硬性时间限制
132
+
133
+ # Eval
134
+ eval_splits: int = 2
135
+ eval_episodes: int = 4000
136
+
137
+
138
+ def make_env(idx, run_name, seed, scramble_depth, max_steps_env, capture_video=False):
139
+ def thunk():
140
+ # [关键修改] 内部 max_steps 设为 1000,防止 env 内部发出 done=True
141
+ # 我们完全依赖外部 TimeLimit wrapper 来处理超时
142
+ config = RubiksCube2x2Config(scramble_depth=scramble_depth, max_steps=20, render_mode='text')
143
+ env = RubiksCube2x2Env(config)
144
+ env = RubiksCubeWrapper(env)
145
+ # 外部限制设为 20
146
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps_env)
147
+ env = gym.wrappers.RecordEpisodeStatistics(env)
148
+ if capture_video and idx == 0:
149
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
150
+ return env
151
+ return thunk
152
+
153
+
154
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
155
+ torch.nn.init.orthogonal_(layer.weight, std)
156
+ torch.nn.init.constant_(layer.bias, bias_const)
157
+ return layer
158
+
159
+
160
+ class QNetwork(nn.Module):
161
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
162
+ super().__init__()
163
+ self.net = nn.Sequential(
164
+ layer_init(nn.Linear(obs_dim, hidden)),
165
+ nn.ReLU(),
166
+ layer_init(nn.Linear(hidden, hidden)),
167
+ nn.ReLU(),
168
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
169
+ )
170
+
171
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
172
+ return self.net(x)
173
+
174
+
175
+ class ReplayBuffer:
176
+ def __init__(self, capacity: int, obs_shape: Tuple[int, ...]):
177
+ self.capacity = capacity
178
+ self.ptr = 0
179
+ self.full = False
180
+ self.obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
181
+ self.next_obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
182
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
183
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
184
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
185
+
186
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
187
+ i = self.ptr
188
+ self.obs_buf[i] = obs
189
+ self.next_obs_buf[i] = next_obs
190
+ self.act_buf[i] = act
191
+ self.rew_buf[i] = rew
192
+ self.done_buf[i] = 1.0 if done else 0.0
193
+ self.ptr = (self.ptr + 1) % self.capacity
194
+ if self.ptr == 0:
195
+ self.full = True
196
+
197
+ def can_sample(self, batch_size: int) -> bool:
198
+ return (self.capacity if self.full else self.ptr) >= batch_size
199
+
200
+ def sample(self, batch_size: int):
201
+ size = self.capacity if self.full else self.ptr
202
+ idxs = np.random.randint(0, size, size=batch_size)
203
+ return (
204
+ self.obs_buf[idxs],
205
+ self.act_buf[idxs],
206
+ self.rew_buf[idxs],
207
+ self.done_buf[idxs],
208
+ self.next_obs_buf[idxs],
209
+ )
210
+
211
+
212
+ if __name__ == "__main__":
213
+ args = tyro.cli(Args)
214
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
215
+
216
+ if args.track:
217
+ import wandb
218
+ wandb.init(
219
+ project=args.wandb_project_name,
220
+ entity=args.wandb_entity,
221
+ config=vars(args),
222
+ name=run_name,
223
+ monitor_gym=True,
224
+ save_code=True,
225
+ )
226
+ try:
227
+ wandb.define_metric("global_step")
228
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
229
+ wandb.define_metric(prefix, step_metric="global_step")
230
+ except Exception:
231
+ pass
232
+
233
+ random.seed(args.seed)
234
+ np.random.seed(args.seed)
235
+ torch.manual_seed(args.seed)
236
+ torch.backends.cudnn.deterministic = args.torch_deterministic
237
+
238
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
239
+
240
+ env = make_env(0, run_name, args.seed, args.scramble_depth, args.max_steps_env, args.capture_video)()
241
+ obs_shape = env.observation_space.shape
242
+ act_dim = env.action_space.n
243
+
244
+ policy_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
245
+ target_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
246
+ target_net.load_state_dict(policy_net.state_dict())
247
+ target_net.eval()
248
+
249
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
250
+ criterion = nn.SmoothL1Loss()
251
+
252
+ rb = ReplayBuffer(args.buffer_size, obs_shape)
253
+
254
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
255
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
256
+
257
+ # 评估函数
258
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
259
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
260
+ out_dir.mkdir(parents=True, exist_ok=True)
261
+ out_path = out_dir / "trajectories.jsonl"
262
+ env_eval = make_env_fn()
263
+ collected = 0
264
+ summary_returns = []
265
+ summary_success = []
266
+ with out_path.open("w") as f:
267
+ while collected < n_episodes:
268
+ state, _ = env_eval.reset(seed=args.seed + 100000 + collected)
269
+ traj_states = [np.asarray(state).tolist()]
270
+ traj_actions = []
271
+ traj_rewards = []
272
+ traj_dones = []
273
+ traj_success = []
274
+ done = False
275
+ step_count = 0
276
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.max_steps_env)
277
+ while not done:
278
+ with torch.no_grad():
279
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
280
+ action = int(torch.argmax(q, dim=1).item())
281
+ next_state, reward, terminated, truncated, info = env_eval.step(action)
282
+
283
+ traj_actions.append(int(action))
284
+ traj_rewards.append(float(reward))
285
+ step_count += 1
286
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
287
+ traj_dones.append(d)
288
+ traj_success.append(bool((info or {}).get('success', False)))
289
+ state = next_state
290
+ traj_states.append(np.asarray(state).tolist())
291
+ done = d
292
+ ep_ret = float(sum(traj_rewards))
293
+ ep_succ = bool(any(traj_success))
294
+ record = {
295
+ "states": traj_states,
296
+ "actions": traj_actions,
297
+ "rewards": traj_rewards,
298
+ "dones": traj_dones,
299
+ "success": traj_success,
300
+ "episode_return": ep_ret,
301
+ "episode_success": ep_succ,
302
+ }
303
+ f.write(json.dumps(record) + "\n")
304
+ collected += 1
305
+ summary_returns.append(ep_ret)
306
+ summary_success.append(1.0 if ep_succ else 0.0)
307
+ env_eval.close()
308
+ try:
309
+ metrics = {
310
+ "global_step": int(step_tag),
311
+ "episodes": int(n_episodes),
312
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
313
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
314
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
315
+ }
316
+ with (out_dir / "metrics.json").open("w") as mf:
317
+ json.dump(metrics, mf)
318
+ except Exception as e:
319
+ print(f"Warning: failed to write eval metrics: {e}")
320
+
321
+ # 主训练循环
322
+ global_step = 0
323
+ start_time = time.time()
324
+
325
+ obs, _ = env.reset(seed=args.seed)
326
+ ep_return = 0.0
327
+ ep_len = 0
328
+ ep_success_window: List[float] = []
329
+
330
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
331
+
332
+ while global_step < args.total_timesteps:
333
+ epsilon = epsilon_by_step(global_step)
334
+ if np.random.rand() < epsilon or global_step < args.learning_starts:
335
+ action = env.action_space.sample()
336
+ else:
337
+ with torch.no_grad():
338
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
339
+ action = int(torch.argmax(q_values, dim=1).item())
340
+
341
+ next_obs, reward, terminated, truncated, info = env.step(action)
342
+
343
+ # 判断是否需要 Reset (任何结束都 Reset)
344
+ real_done = bool(terminated) or bool(truncated)
345
+
346
+ # [核心逻辑]
347
+ # 1. 即使是 truncated (超时),done 也记为 False,以便进行 bootstrap (计算未来价值)
348
+ # 2. 只有 terminated (真正解开了),done 才记为 True
349
+ # 3. Step Penalty 已经包含在 reward 中,DQN 会学到"为了避免扣分,必须在未来几步内解决"
350
+ rb.add(
351
+ obs.astype(np.float32),
352
+ int(action),
353
+ float(reward),
354
+ bool(terminated), # 注意:只用 terminated
355
+ next_obs.astype(np.float32)
356
+ )
357
+
358
+ obs = next_obs
359
+ ep_return += float(reward)
360
+ ep_len += 1
361
+ global_step += 1
362
+
363
+ # 训练过程
364
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
365
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
366
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
367
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
368
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
369
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
370
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
371
+
372
+ with torch.no_grad():
373
+ next_q = target_net(b_next_obs).max(dim=1)[0]
374
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
375
+
376
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
377
+ loss = criterion(current_q, target_q)
378
+
379
+ optimizer.zero_grad()
380
+ loss.backward()
381
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
382
+ optimizer.step()
383
+
384
+ if args.track:
385
+ try:
386
+ import wandb
387
+ wandb.log({
388
+ "global_step": int(global_step),
389
+ "train/loss": float(loss.item()),
390
+ "charts/epsilon": float(epsilon),
391
+ "perf/SPS": int(global_step / (time.time() - start_time)),
392
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
393
+ }, step=global_step)
394
+ except Exception:
395
+ pass
396
+
397
+ # 结束时 Reset
398
+ if real_done:
399
+ succ = bool((info or {}).get('success', False))
400
+ ep_success_window.append(1.0 if succ else 0.0)
401
+ if len(ep_success_window) > 100:
402
+ ep_success_window.pop(0)
403
+ if args.track:
404
+ try:
405
+ import wandb
406
+ wandb.log({
407
+ "global_step": int(global_step),
408
+ "train/episodic_return": float(ep_return),
409
+ "train/episodic_length": int(ep_len),
410
+ "train/success": float(1.0 if succ else 0.0),
411
+ "train/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) >= 1 else None,
412
+ }, step=global_step)
413
+ except Exception:
414
+ pass
415
+ obs, _ = env.reset()
416
+ ep_return, ep_len = 0.0, 0
417
+
418
+ # 更新目标网络
419
+ if global_step % args.target_network_frequency == 0:
420
+ target_net.load_state_dict(policy_net.state_dict())
421
+
422
+ # 打印日志
423
+ if global_step % 1000 == 0:
424
+ sps = int(global_step / (time.time() - start_time))
425
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
426
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
427
+
428
+ # 评估
429
+ if global_step == 1 or (global_step % eval_every_steps == 0):
430
+ try:
431
+ def eval_thunk():
432
+ # 评估环境也同样设置:内部1000,外部20
433
+ return make_env(0, run_name, args.seed + 9999, args.scramble_depth, args.max_steps_env, False)()
434
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
435
+ if args.track:
436
+ try:
437
+ import wandb
438
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
439
+ if mpath.exists():
440
+ with mpath.open("r") as mf:
441
+ metrics = json.load(mf)
442
+ wandb.log({
443
+ "eval/success_rate": metrics.get("success_rate"),
444
+ "eval/avg_return": metrics.get("avg_return"),
445
+ "eval/std_return": metrics.get("std_return"),
446
+ "eval/episodes": metrics.get("episodes"),
447
+ }, step=global_step)
448
+ except Exception:
449
+ pass
450
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
451
+ except Exception as e:
452
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
453
+
454
+ env.close()
wandb/run-20260112_223423-ozob7eqw/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Step Penalty & Time Limit Bootstrap for RAGEN Rubik's Cube 2x2
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+ import re
10
+
11
+ import gymnasium as gym
12
+ import numpy as np
13
+ import torch
14
+ import torch.nn as nn
15
+ import torch.optim as optim
16
+ import tyro
17
+
18
+ import sys
19
+ # 假设 ragen 库在当前目录的上两级,请根据实际情况调整
20
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
21
+
22
+ from ragen.env.rubikscube.env import RubiksCube2x2Env
23
+ from ragen.env.rubikscube.config import RubiksCube2x2Config
24
+
25
+
26
+ class RubiksCubeWrapper(gym.Env):
27
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
28
+
29
+ def __init__(self, env: RubiksCube2x2Env):
30
+ super().__init__()
31
+ self._env = env
32
+ self._colors = ['W', 'O', 'G', 'R', 'B', 'Y']
33
+ self._color_to_idx = {c: i for i, c in enumerate(self._colors)}
34
+ self.observation_space = gym.spaces.Box(low=0.0, high=1.0, shape=(24 * len(self._colors),), dtype=np.float32)
35
+ self.action_space = gym.spaces.Discrete(12)
36
+ self._face_pat = re.compile(r"\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])\n\s*\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])")
37
+
38
+ # [关键修改] 每步惩罚
39
+ # 如果20步都没解出来,累计惩罚是 20 * -0.05 = -1.0,抵消掉最后可能获得的 +1.0
40
+ # 这迫使 agent 寻找更短路径
41
+ self.step_penalty = -0.1
42
+
43
+ def _encode_obs(self, text_obs: str) -> np.ndarray:
44
+ faces_order = ["Up (U):", "Left (L):", "Front (F):", "Right (R):", "Back (B):", "Down (D):"]
45
+ lines = text_obs.splitlines()
46
+ blocks: List[str] = []
47
+ i = 0
48
+ while i < len(lines):
49
+ line = lines[i]
50
+ for header in faces_order:
51
+ if line.startswith(header):
52
+ content = line[len(header):].strip()
53
+ next_line = lines[i + 1] if i + 1 < len(lines) else ""
54
+ block = f"{content}\n{next_line}"
55
+ blocks.append(block)
56
+ break
57
+ i += 1
58
+ if len(blocks) != 6:
59
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
60
+ stickers: List[int] = []
61
+ for blk in blocks:
62
+ m = self._face_pat.search(blk)
63
+ if not m:
64
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
65
+ c0, c1, c2, c3 = m.group(1), m.group(2), m.group(3), m.group(4)
66
+ stickers.extend([c0, c1, c2, c3])
67
+ grid = np.zeros((24, len(self._colors)), dtype=np.float32)
68
+ for idx, ch in enumerate(stickers):
69
+ cidx = self._color_to_idx.get(ch, None)
70
+ if cidx is not None:
71
+ grid[idx, cidx] = 1.0
72
+ return grid.reshape(-1)
73
+
74
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
75
+ text_obs = self._env.reset(seed=seed)
76
+ obs = self._encode_obs(text_obs)
77
+ return obs, {}
78
+
79
+ def step(self, action: int):
80
+ mapped = int(action) + 1
81
+ text_obs, reward, done, info = self._env.step(mapped)
82
+ obs = self._encode_obs(text_obs)
83
+ terminated = bool(done)
84
+ truncated = False
85
+
86
+ # [关键修改] 应用惩罚
87
+ # 此时 reward 包含原本的稀疏奖励 (0 或 1) 加上每步惩罚
88
+ reward = float(reward) + self.step_penalty
89
+
90
+ return obs, reward, terminated, truncated, info or {}
91
+
92
+ def render(self):
93
+ return self._env.render()
94
+
95
+ def close(self):
96
+ self._env.close()
97
+
98
+
99
+ @dataclass
100
+ class Args:
101
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
102
+ seed: int = 1
103
+ torch_deterministic: bool = True
104
+ cuda: bool = True
105
+ track: bool = True
106
+ wandb_project_name: str = "cleanRL"
107
+ wandb_entity: str | None = None
108
+ capture_video: bool = False
109
+
110
+ # Algorithm
111
+ env_id: str = "RubiksCube2x2DQN"
112
+ total_timesteps: int = 400_000
113
+ learning_rate: float = 2.5e-4
114
+ gamma: float = 0.99
115
+ batch_size: int = 128
116
+ buffer_size: int = 200_000
117
+ target_network_frequency: int = 4000
118
+ train_frequency: int = 4
119
+ learning_starts: int = 5000
120
+
121
+ # Epsilon-greedy
122
+ start_e: float = 1.0
123
+ end_e: float = 0.05
124
+ exploration_fraction: float = 0.2
125
+
126
+ # Model size
127
+ hidden_size: int = 256
128
+
129
+ # Rubik specific
130
+ scramble_depth: int = 3 # 初始难度
131
+ max_steps_env: int = 20 # 硬性时间限制
132
+
133
+ # Eval
134
+ eval_splits: int = 2
135
+ eval_episodes: int = 4000
136
+
137
+
138
+ def make_env(idx, run_name, seed, scramble_depth, max_steps_env, capture_video=False):
139
+ def thunk():
140
+ # [关键修改] 内部 max_steps 设为 1000,防止 env 内部发出 done=True
141
+ # 我们完全依赖外部 TimeLimit wrapper 来处理超时
142
+ config = RubiksCube2x2Config(scramble_depth=scramble_depth, max_steps=20, render_mode='text')
143
+ env = RubiksCube2x2Env(config)
144
+ env = RubiksCubeWrapper(env)
145
+ # 外部限制设为 20
146
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps_env)
147
+ env = gym.wrappers.RecordEpisodeStatistics(env)
148
+ if capture_video and idx == 0:
149
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
150
+ return env
151
+ return thunk
152
+
153
+
154
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
155
+ torch.nn.init.orthogonal_(layer.weight, std)
156
+ torch.nn.init.constant_(layer.bias, bias_const)
157
+ return layer
158
+
159
+
160
+ class QNetwork(nn.Module):
161
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
162
+ super().__init__()
163
+ self.net = nn.Sequential(
164
+ layer_init(nn.Linear(obs_dim, hidden)),
165
+ nn.ReLU(),
166
+ layer_init(nn.Linear(hidden, hidden)),
167
+ nn.ReLU(),
168
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
169
+ )
170
+
171
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
172
+ return self.net(x)
173
+
174
+
175
+ class ReplayBuffer:
176
+ def __init__(self, capacity: int, obs_shape: Tuple[int, ...]):
177
+ self.capacity = capacity
178
+ self.ptr = 0
179
+ self.full = False
180
+ self.obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
181
+ self.next_obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
182
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
183
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
184
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
185
+
186
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
187
+ i = self.ptr
188
+ self.obs_buf[i] = obs
189
+ self.next_obs_buf[i] = next_obs
190
+ self.act_buf[i] = act
191
+ self.rew_buf[i] = rew
192
+ self.done_buf[i] = 1.0 if done else 0.0
193
+ self.ptr = (self.ptr + 1) % self.capacity
194
+ if self.ptr == 0:
195
+ self.full = True
196
+
197
+ def can_sample(self, batch_size: int) -> bool:
198
+ return (self.capacity if self.full else self.ptr) >= batch_size
199
+
200
+ def sample(self, batch_size: int):
201
+ size = self.capacity if self.full else self.ptr
202
+ idxs = np.random.randint(0, size, size=batch_size)
203
+ return (
204
+ self.obs_buf[idxs],
205
+ self.act_buf[idxs],
206
+ self.rew_buf[idxs],
207
+ self.done_buf[idxs],
208
+ self.next_obs_buf[idxs],
209
+ )
210
+
211
+
212
+ if __name__ == "__main__":
213
+ args = tyro.cli(Args)
214
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
215
+
216
+ if args.track:
217
+ import wandb
218
+ wandb.init(
219
+ project=args.wandb_project_name,
220
+ entity=args.wandb_entity,
221
+ config=vars(args),
222
+ name=run_name,
223
+ monitor_gym=True,
224
+ save_code=True,
225
+ )
226
+ try:
227
+ wandb.define_metric("global_step")
228
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
229
+ wandb.define_metric(prefix, step_metric="global_step")
230
+ except Exception:
231
+ pass
232
+
233
+ random.seed(args.seed)
234
+ np.random.seed(args.seed)
235
+ torch.manual_seed(args.seed)
236
+ torch.backends.cudnn.deterministic = args.torch_deterministic
237
+
238
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
239
+
240
+ env = make_env(0, run_name, args.seed, args.scramble_depth, args.max_steps_env, args.capture_video)()
241
+ obs_shape = env.observation_space.shape
242
+ act_dim = env.action_space.n
243
+
244
+ policy_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
245
+ target_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
246
+ target_net.load_state_dict(policy_net.state_dict())
247
+ target_net.eval()
248
+
249
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
250
+ criterion = nn.SmoothL1Loss()
251
+
252
+ rb = ReplayBuffer(args.buffer_size, obs_shape)
253
+
254
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
255
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
256
+
257
+ # 评估函数
258
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
259
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
260
+ out_dir.mkdir(parents=True, exist_ok=True)
261
+ out_path = out_dir / "trajectories.jsonl"
262
+ env_eval = make_env_fn()
263
+ collected = 0
264
+ summary_returns = []
265
+ summary_success = []
266
+ with out_path.open("w") as f:
267
+ while collected < n_episodes:
268
+ state, _ = env_eval.reset(seed=args.seed + 100000 + collected)
269
+ traj_states = [np.asarray(state).tolist()]
270
+ traj_actions = []
271
+ traj_rewards = []
272
+ traj_dones = []
273
+ traj_success = []
274
+ done = False
275
+ step_count = 0
276
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.max_steps_env)
277
+ while not done:
278
+ with torch.no_grad():
279
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
280
+ action = int(torch.argmax(q, dim=1).item())
281
+ next_state, reward, terminated, truncated, info = env_eval.step(action)
282
+
283
+ traj_actions.append(int(action))
284
+ traj_rewards.append(float(reward))
285
+ step_count += 1
286
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
287
+ traj_dones.append(d)
288
+ traj_success.append(bool((info or {}).get('success', False)))
289
+ state = next_state
290
+ traj_states.append(np.asarray(state).tolist())
291
+ done = d
292
+ ep_ret = float(sum(traj_rewards))
293
+ ep_succ = bool(any(traj_success))
294
+ record = {
295
+ "states": traj_states,
296
+ "actions": traj_actions,
297
+ "rewards": traj_rewards,
298
+ "dones": traj_dones,
299
+ "success": traj_success,
300
+ "episode_return": ep_ret,
301
+ "episode_success": ep_succ,
302
+ }
303
+ f.write(json.dumps(record) + "\n")
304
+ collected += 1
305
+ summary_returns.append(ep_ret)
306
+ summary_success.append(1.0 if ep_succ else 0.0)
307
+ env_eval.close()
308
+ try:
309
+ metrics = {
310
+ "global_step": int(step_tag),
311
+ "episodes": int(n_episodes),
312
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
313
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
314
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
315
+ }
316
+ with (out_dir / "metrics.json").open("w") as mf:
317
+ json.dump(metrics, mf)
318
+ except Exception as e:
319
+ print(f"Warning: failed to write eval metrics: {e}")
320
+
321
+ # 主训练循环
322
+ global_step = 0
323
+ start_time = time.time()
324
+
325
+ obs, _ = env.reset(seed=args.seed)
326
+ ep_return = 0.0
327
+ ep_len = 0
328
+ ep_success_window: List[float] = []
329
+
330
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
331
+
332
+ while global_step < args.total_timesteps:
333
+ epsilon = epsilon_by_step(global_step)
334
+ if np.random.rand() < epsilon or global_step < args.learning_starts:
335
+ action = env.action_space.sample()
336
+ else:
337
+ with torch.no_grad():
338
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
339
+ action = int(torch.argmax(q_values, dim=1).item())
340
+
341
+ next_obs, reward, terminated, truncated, info = env.step(action)
342
+
343
+ # 判断是否需要 Reset (任何结束都 Reset)
344
+ real_done = bool(terminated) or bool(truncated)
345
+
346
+ # [核心逻辑]
347
+ # 1. 即使是 truncated (超时),done 也记为 False,以便进行 bootstrap (计算未来价值)
348
+ # 2. 只有 terminated (真正解开了),done 才记为 True
349
+ # 3. Step Penalty 已经包含在 reward 中,DQN 会学到"为了避免扣分,必须在未来几步内解决"
350
+ rb.add(
351
+ obs.astype(np.float32),
352
+ int(action),
353
+ float(reward),
354
+ bool(terminated), # 注意:只用 terminated
355
+ next_obs.astype(np.float32)
356
+ )
357
+
358
+ obs = next_obs
359
+ ep_return += float(reward)
360
+ ep_len += 1
361
+ global_step += 1
362
+
363
+ # 训练过程
364
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
365
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
366
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
367
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
368
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
369
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
370
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
371
+
372
+ with torch.no_grad():
373
+ next_q = target_net(b_next_obs).max(dim=1)[0]
374
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
375
+
376
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
377
+ loss = criterion(current_q, target_q)
378
+
379
+ optimizer.zero_grad()
380
+ loss.backward()
381
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
382
+ optimizer.step()
383
+
384
+ if args.track:
385
+ try:
386
+ import wandb
387
+ wandb.log({
388
+ "global_step": int(global_step),
389
+ "train/loss": float(loss.item()),
390
+ "charts/epsilon": float(epsilon),
391
+ "perf/SPS": int(global_step / (time.time() - start_time)),
392
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
393
+ }, step=global_step)
394
+ except Exception:
395
+ pass
396
+
397
+ # 结束时 Reset
398
+ if real_done:
399
+ succ = bool((info or {}).get('success', False))
400
+ ep_success_window.append(1.0 if succ else 0.0)
401
+ if len(ep_success_window) > 100:
402
+ ep_success_window.pop(0)
403
+ if args.track:
404
+ try:
405
+ import wandb
406
+ wandb.log({
407
+ "global_step": int(global_step),
408
+ "train/episodic_return": float(ep_return),
409
+ "train/episodic_length": int(ep_len),
410
+ "train/success": float(1.0 if succ else 0.0),
411
+ "train/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) >= 1 else None,
412
+ }, step=global_step)
413
+ except Exception:
414
+ pass
415
+ obs, _ = env.reset()
416
+ ep_return, ep_len = 0.0, 0
417
+
418
+ # 更新目标网络
419
+ if global_step % args.target_network_frequency == 0:
420
+ target_net.load_state_dict(policy_net.state_dict())
421
+
422
+ # 打印日志
423
+ if global_step % 1000 == 0:
424
+ sps = int(global_step / (time.time() - start_time))
425
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
426
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
427
+
428
+ # 评估
429
+ if global_step == 1 or (global_step % eval_every_steps == 0):
430
+ try:
431
+ def eval_thunk():
432
+ # 评估环境也同样设置:内部1000,外部20
433
+ return make_env(0, run_name, args.seed + 9999, args.scramble_depth, args.max_steps_env, False)()
434
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
435
+ if args.track:
436
+ try:
437
+ import wandb
438
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
439
+ if mpath.exists():
440
+ with mpath.open("r") as mf:
441
+ metrics = json.load(mf)
442
+ wandb.log({
443
+ "eval/success_rate": metrics.get("success_rate"),
444
+ "eval/avg_return": metrics.get("avg_return"),
445
+ "eval/std_return": metrics.get("std_return"),
446
+ "eval/episodes": metrics.get("episodes"),
447
+ }, step=global_step)
448
+ except Exception:
449
+ pass
450
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
451
+ except Exception as e:
452
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
453
+
454
+ env.close()
wandb/run-20260112_223423-ozob7eqw/files/config.yaml ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.23.0
4
+ code_path: code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
5
+ e:
6
+ 1qvdn1dfs9lrx9hpw1cc1d9q3gh3ht3r:
7
+ args:
8
+ - --track
9
+ codePath: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
10
+ codePathLocal: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
11
+ cpu_count: 64
12
+ cpu_count_logical: 128
13
+ cudaVersion: "13.0"
14
+ disk:
15
+ /:
16
+ total: "2576980377600"
17
+ used: "3724288000"
18
+ email: haoyu-wa22@mails.tsinghua.edu.cn
19
+ executable: /root/local/miniconda3/envs/ragen/bin/python
20
+ git:
21
+ commit: 8d73639b99b38265453f898b8d6af7d4af50d56e
22
+ remote: https://github.com/mll-lab-nu/RAGEN.git
23
+ gpu: NVIDIA H100 80GB HBM3
24
+ gpu_count: 4
25
+ gpu_nvidia:
26
+ - architecture: Hopper
27
+ cudaCores: 16896
28
+ memoryTotal: "85520809984"
29
+ name: NVIDIA H100 80GB HBM3
30
+ uuid: GPU-cff454b9-f118-535b-5e1f-6d503e78e52e
31
+ - architecture: Hopper
32
+ cudaCores: 16896
33
+ memoryTotal: "85520809984"
34
+ name: NVIDIA H100 80GB HBM3
35
+ uuid: GPU-9e77c178-188c-f869-780e-858c20a7d322
36
+ - architecture: Hopper
37
+ cudaCores: 16896
38
+ memoryTotal: "85520809984"
39
+ name: NVIDIA H100 80GB HBM3
40
+ uuid: GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9
41
+ - architecture: Hopper
42
+ cudaCores: 16896
43
+ memoryTotal: "85520809984"
44
+ name: NVIDIA H100 80GB HBM3
45
+ uuid: GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7
46
+ host: pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0
47
+ memory:
48
+ total: "2163639439360"
49
+ os: Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35
50
+ program: /mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
51
+ python: CPython 3.10.19
52
+ root: /mnt/general/wanghy/RAGEN
53
+ startedAt: "2026-01-12T14:34:23.071083Z"
54
+ writerId: 1qvdn1dfs9lrx9hpw1cc1d9q3gh3ht3r
55
+ m:
56
+ - "1": global_step
57
+ "6":
58
+ - 3
59
+ "7": []
60
+ - "2": train/*
61
+ "5": 1
62
+ "6":
63
+ - 1
64
+ "7": []
65
+ - "2": rollout/*
66
+ "5": 1
67
+ "6":
68
+ - 1
69
+ "7": []
70
+ - "2": eval/*
71
+ "5": 1
72
+ "6":
73
+ - 1
74
+ "7": []
75
+ - "2": losses/*
76
+ "5": 1
77
+ "6":
78
+ - 1
79
+ "7": []
80
+ - "2": charts/*
81
+ "5": 1
82
+ "6":
83
+ - 1
84
+ "7": []
85
+ - "2": perf/*
86
+ "5": 1
87
+ "6":
88
+ - 1
89
+ "7": []
90
+ python_version: 3.10.19
91
+ t:
92
+ "1":
93
+ - 1
94
+ - 11
95
+ - 30
96
+ - 49
97
+ - 50
98
+ - 51
99
+ - 105
100
+ "2":
101
+ - 1
102
+ - 11
103
+ - 30
104
+ - 49
105
+ - 50
106
+ - 51
107
+ - 105
108
+ "3":
109
+ - 7
110
+ - 13
111
+ - 16
112
+ - 61
113
+ "4": 3.10.19
114
+ "5": 0.23.0
115
+ "6": 4.57.3
116
+ "12": 0.23.0
117
+ "13": linux-x86_64
118
+ batch_size:
119
+ value: 128
120
+ buffer_size:
121
+ value: 200000
122
+ capture_video:
123
+ value: false
124
+ cuda:
125
+ value: true
126
+ end_e:
127
+ value: 0.05
128
+ env_id:
129
+ value: RubiksCube2x2DQN
130
+ eval_episodes:
131
+ value: 4000
132
+ eval_splits:
133
+ value: 2
134
+ exp_name:
135
+ value: dqn_rubikscube
136
+ exploration_fraction:
137
+ value: 0.2
138
+ gamma:
139
+ value: 0.99
140
+ hidden_size:
141
+ value: 256
142
+ learning_rate:
143
+ value: 0.00025
144
+ learning_starts:
145
+ value: 5000
146
+ max_steps_env:
147
+ value: 20
148
+ scramble_depth:
149
+ value: 3
150
+ seed:
151
+ value: 1
152
+ start_e:
153
+ value: 1
154
+ target_network_frequency:
155
+ value: 4000
156
+ torch_deterministic:
157
+ value: true
158
+ total_timesteps:
159
+ value: 400000
160
+ track:
161
+ value: true
162
+ train_frequency:
163
+ value: 4
164
+ wandb_entity:
165
+ value: null
166
+ wandb_project_name:
167
+ value: cleanRL
wandb/run-20260112_223423-ozob7eqw/files/diff.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_223423-ozob7eqw/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_223423-ozob7eqw/files/requirements.txt ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ colorama==0.4.6
2
+ psutil==7.1.3
3
+ ragen==0.1
4
+ Farama-Notifications==0.0.4
5
+ MarkupSafe==2.1.5
6
+ PyJWT==2.10.1
7
+ PySocks==1.7.1
8
+ absl-py==2.3.1
9
+ accelerate==1.12.0
10
+ aiohappyeyeballs==2.6.1
11
+ aiohttp==3.13.2
12
+ aiohttp-cors==0.8.1
13
+ aiosignal==1.4.0
14
+ airportsdata==20250909
15
+ annotated-doc==0.0.4
16
+ annotated-types==0.7.0
17
+ anthropic==0.75.0
18
+ antlr4-python3-runtime==4.9.3
19
+ anyio==4.12.0
20
+ astor==0.8.1
21
+ asttokens==3.0.1
22
+ async-timeout==5.0.1
23
+ attrs==25.4.0
24
+ beautifulsoup4==4.14.3
25
+ black==25.11.0
26
+ blake3==1.0.8
27
+ blinker==1.9.0
28
+ blis==1.3.3
29
+ cachetools==6.2.2
30
+ catalogue==2.0.10
31
+ certifi==2025.11.12
32
+ cffi==2.0.0
33
+ charset-normalizer==3.4.4
34
+ cleantext==1.1.4
35
+ click==8.2.1
36
+ cloudpathlib==0.23.0
37
+ cloudpickle==3.1.2
38
+ codetiming==1.4.0
39
+ colorama==0.4.6
40
+ coloredlogs==15.0.1
41
+ colorful==0.5.8
42
+ compressed-tensors==0.9.3
43
+ confection==0.1.5
44
+ contourpy==1.3.2
45
+ cryptography==46.0.3
46
+ cupy-cuda12x==13.6.0
47
+ cycler==0.12.1
48
+ cymem==2.0.13
49
+ Cython==3.2.2
50
+ datasets==4.4.1
51
+ debugpy==1.8.17
52
+ decorator==5.2.1
53
+ Deprecated==1.3.1
54
+ depyf==0.18.0
55
+ dill==0.4.0
56
+ diskcache==5.6.3
57
+ distlib==0.4.0
58
+ distro==1.9.0
59
+ dnspython==2.8.0
60
+ docstring_parser==0.17.0
61
+ einops==0.8.1
62
+ email-validator==2.3.0
63
+ eval_type_backport==0.2.2
64
+ exceptiongroup==1.3.1
65
+ executing==2.2.1
66
+ faiss-gpu==1.7.2
67
+ fastapi==0.123.1
68
+ fastapi-cli==0.0.16
69
+ fastapi-cloud-cli==0.5.2
70
+ fastar==0.8.0
71
+ fastrlock==0.8.3
72
+ filelock==3.19.1
73
+ flash_attn==2.8.3
74
+ Flask==3.1.2
75
+ flatbuffers==25.9.23
76
+ fonttools==4.61.0
77
+ frozenlist==1.8.0
78
+ fsspec==2025.9.0
79
+ gdown==5.2.0
80
+ gguf==0.17.1
81
+ gitdb==4.0.12
82
+ GitPython==3.1.45
83
+ google-api-core==2.28.1
84
+ google-auth==2.43.0
85
+ googleapis-common-protos==1.72.0
86
+ grpcio==1.76.0
87
+ gym==0.26.2
88
+ gym-notices==0.1.0
89
+ gym-sokoban==0.0.6
90
+ gymnasium==1.2.2
91
+ h11==0.16.0
92
+ hf-xet==1.2.0
93
+ html2text==2025.4.15
94
+ httpcore==1.0.9
95
+ httptools==0.7.1
96
+ httpx==0.28.1
97
+ httpx-sse==0.4.3
98
+ huggingface-hub==0.36.0
99
+ humanfriendly==10.0
100
+ hydra-core==1.3.2
101
+ idna==3.11
102
+ ImageIO==2.37.2
103
+ importlib_metadata==8.0.0
104
+ interegular==0.3.3
105
+ ipython==8.37.0
106
+ itsdangerous==2.2.0
107
+ jedi==0.19.2
108
+ Jinja2==3.1.6
109
+ jiter==0.12.0
110
+ joblib==1.5.2
111
+ jsonschema==4.25.1
112
+ jsonschema-specifications==2025.9.1
113
+ kimina-client==0.2.1
114
+ kiwisolver==1.4.9
115
+ lark==1.2.2
116
+ llguidance==0.7.30
117
+ llvmlite==0.44.0
118
+ lm-format-enforcer==0.10.12
119
+ loguru==0.7.3
120
+ Markdown==3.10
121
+ markdown-it-py==4.0.0
122
+ matplotlib==3.10.7
123
+ matplotlib-inline==0.2.1
124
+ mcp==1.22.0
125
+ mdurl==0.1.2
126
+ mistral_common==1.8.6
127
+ mpmath==1.3.0
128
+ msgpack==1.1.2
129
+ msgspec==0.20.0
130
+ multidict==6.7.0
131
+ multiprocess==0.70.18
132
+ murmurhash==1.0.15
133
+ mypy_extensions==1.1.0
134
+ nest-asyncio==1.6.0
135
+ networkx==3.3
136
+ ninja==1.13.0
137
+ nltk==3.9.2
138
+ numba==0.61.2
139
+ numpy==1.26.4
140
+ nvidia-cublas-cu12==12.4.5.8
141
+ nvidia-cuda-cupti-cu12==12.4.127
142
+ nvidia-cuda-nvrtc-cu12==12.4.127
143
+ nvidia-cuda-runtime-cu12==12.4.127
144
+ nvidia-cudnn-cu12==9.1.0.70
145
+ nvidia-cufft-cu12==11.2.1.3
146
+ nvidia-curand-cu12==10.3.5.147
147
+ nvidia-cusolver-cu12==11.6.1.9
148
+ nvidia-cusparse-cu12==12.3.1.170
149
+ nvidia-cusparselt-cu12==0.6.2
150
+ nvidia-nccl-cu12==2.21.5
151
+ nvidia-nvjitlink-cu12==12.4.127
152
+ nvidia-nvtx-cu12==12.4.127
153
+ omegaconf==2.3.0
154
+ onnxruntime==1.23.2
155
+ openai==2.8.1
156
+ opencensus==0.11.4
157
+ opencensus-context==0.1.3
158
+ opencv-python-headless==4.12.0.88
159
+ opentelemetry-api==1.38.0
160
+ opentelemetry-exporter-otlp==1.26.0
161
+ opentelemetry-exporter-otlp-proto-common==1.26.0
162
+ opentelemetry-exporter-otlp-proto-grpc==1.26.0
163
+ opentelemetry-exporter-otlp-proto-http==1.26.0
164
+ opentelemetry-exporter-prometheus==0.59b0
165
+ opentelemetry-proto==1.26.0
166
+ opentelemetry-sdk==1.38.0
167
+ opentelemetry-semantic-conventions==0.59b0
168
+ opentelemetry-semantic-conventions-ai==0.4.13
169
+ orjson==3.11.4
170
+ outlines==0.1.11
171
+ outlines_core==0.1.26
172
+ packaging==25.0
173
+ pandas==2.3.3
174
+ parso==0.8.5
175
+ partial-json-parser==0.2.1.1.post7
176
+ pathspec==0.12.1
177
+ peft==0.18.0
178
+ pexpect==4.9.0
179
+ pillow==11.3.0
180
+ pip==25.3
181
+ platformdirs==4.5.0
182
+ preshed==3.0.12
183
+ prometheus_client==0.23.1
184
+ prometheus-fastapi-instrumentator==7.1.0
185
+ prompt_toolkit==3.0.52
186
+ propcache==0.4.1
187
+ proto-plus==1.26.1
188
+ protobuf==4.25.8
189
+ psutil==7.1.3
190
+ ptyprocess==0.7.0
191
+ pure_eval==0.2.3
192
+ py-cpuinfo==9.0.0
193
+ py-spy==0.4.1
194
+ pyarrow==22.0.0
195
+ pyasn1==0.6.1
196
+ pyasn1_modules==0.4.2
197
+ pybind11==3.0.1
198
+ pycountry==24.6.1
199
+ pycparser==2.23
200
+ pydantic==2.12.5
201
+ pydantic_core==2.41.5
202
+ pydantic-extra-types==2.10.6
203
+ pydantic-settings==2.12.0
204
+ pygame==2.6.1
205
+ Pygments==2.19.2
206
+ pyjnius==1.7.0
207
+ pylatexenc==2.10
208
+ pyparsing==3.2.5
209
+ pyserini==1.2.0
210
+ python-dateutil==2.9.0.post0
211
+ python-dotenv==1.2.1
212
+ python-json-logger==4.0.0
213
+ python-multipart==0.0.20
214
+ pytokens==0.3.0
215
+ pytz==2025.2
216
+ PyYAML==6.0.3
217
+ pyzmq==27.1.0
218
+ ragen==0.1
219
+ rank-bm25==0.2.2
220
+ RapidFuzz==3.14.3
221
+ ray==2.52.1
222
+ referencing==0.37.0
223
+ regex==2025.11.3
224
+ requests==2.32.5
225
+ rich==14.2.0
226
+ rich-toolkit==0.17.0
227
+ rignore==0.7.6
228
+ rpds-py==0.30.0
229
+ rsa==4.9.1
230
+ safetensors==0.7.0
231
+ scikit-learn==1.7.2
232
+ scipy==1.15.3
233
+ sentencepiece==0.2.1
234
+ sentry-sdk==2.46.0
235
+ setuptools==80.9.0
236
+ shellingham==1.5.4
237
+ six==1.17.0
238
+ smart_open==7.5.0
239
+ smmap==5.0.2
240
+ sniffio==1.3.1
241
+ soupsieve==2.8
242
+ spacy==3.8.11
243
+ spacy-legacy==3.0.12
244
+ spacy-loggers==1.0.5
245
+ srsly==2.5.2
246
+ sse-starlette==3.0.3
247
+ stack-data==0.6.3
248
+ starlette==0.50.0
249
+ sympy==1.13.1
250
+ tabulate==0.9.0
251
+ tenacity==9.1.2
252
+ tensorboard==2.20.0
253
+ tensorboard-data-server==0.7.2
254
+ tensordict==0.8.3
255
+ thefuzz==0.22.1
256
+ thinc==8.3.10
257
+ threadpoolctl==3.6.0
258
+ tiktoken==0.12.0
259
+ together==1.5.31
260
+ tokenizers==0.22.1
261
+ tomli==2.3.0
262
+ torch==2.6.0+cu124
263
+ torchaudio==2.6.0
264
+ torchdata==0.11.0
265
+ torchvision==0.21.0
266
+ tqdm==4.67.1
267
+ traitlets==5.14.3
268
+ transformers==4.57.3
269
+ triton==3.2.0
270
+ typer==0.19.2
271
+ typer-slim==0.20.0
272
+ typing_extensions==4.15.0
273
+ typing-inspection==0.4.2
274
+ tzdata==2025.2
275
+ urllib3==2.5.0
276
+ uvicorn==0.38.0
277
+ uvloop==0.22.1
278
+ verl==0.5.0.dev0
279
+ virtualenv==20.35.4
280
+ vllm==0.8.5
281
+ wandb==0.23.0
282
+ wasabi==1.1.3
283
+ watchfiles==1.1.1
284
+ wcwidth==0.2.14
285
+ weasel==0.4.3
286
+ websockets==15.0.1
287
+ Werkzeug==3.1.4
288
+ wheel==0.45.1
289
+ wrapt==2.0.1
290
+ xformers==0.0.29.post2
291
+ xgrammar==0.1.18
292
+ xxhash==3.6.0
293
+ yarl==1.22.0
294
+ zipp==3.23.0
295
+ typeguard==4.4.4
296
+ tyro==1.0.3
297
+ verl==0.5.0.dev0
298
+ autocommand==2.2.2
299
+ backports.tarfile==1.2.0
300
+ importlib_metadata==8.0.0
301
+ inflect==7.3.1
302
+ jaraco.collections==5.1.0
303
+ jaraco.context==5.3.0
304
+ jaraco.functools==4.0.1
305
+ jaraco.text==3.12.1
306
+ more-itertools==10.3.0
307
+ packaging==24.2
308
+ platformdirs==4.2.2
309
+ tomli==2.0.1
310
+ typeguard==4.3.0
311
+ typing_extensions==4.12.2
312
+ wheel==0.45.1
313
+ zipp==3.19.2
wandb/run-20260112_223423-ozob7eqw/files/wandb-metadata.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35",
3
+ "python": "CPython 3.10.19",
4
+ "startedAt": "2026-01-12T14:34:23.071083Z",
5
+ "args": [
6
+ "--track"
7
+ ],
8
+ "program": "/mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
9
+ "codePath": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
10
+ "codePathLocal": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
11
+ "git": {
12
+ "remote": "https://github.com/mll-lab-nu/RAGEN.git",
13
+ "commit": "8d73639b99b38265453f898b8d6af7d4af50d56e"
14
+ },
15
+ "email": "haoyu-wa22@mails.tsinghua.edu.cn",
16
+ "root": "/mnt/general/wanghy/RAGEN",
17
+ "host": "pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0",
18
+ "executable": "/root/local/miniconda3/envs/ragen/bin/python",
19
+ "cpu_count": 64,
20
+ "cpu_count_logical": 128,
21
+ "gpu": "NVIDIA H100 80GB HBM3",
22
+ "gpu_count": 4,
23
+ "disk": {
24
+ "/": {
25
+ "total": "2576980377600",
26
+ "used": "3724288000"
27
+ }
28
+ },
29
+ "memory": {
30
+ "total": "2163639439360"
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper",
38
+ "uuid": "GPU-cff454b9-f118-535b-5e1f-6d503e78e52e"
39
+ },
40
+ {
41
+ "name": "NVIDIA H100 80GB HBM3",
42
+ "memoryTotal": "85520809984",
43
+ "cudaCores": 16896,
44
+ "architecture": "Hopper",
45
+ "uuid": "GPU-9e77c178-188c-f869-780e-858c20a7d322"
46
+ },
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper",
52
+ "uuid": "GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9"
53
+ },
54
+ {
55
+ "name": "NVIDIA H100 80GB HBM3",
56
+ "memoryTotal": "85520809984",
57
+ "cudaCores": 16896,
58
+ "architecture": "Hopper",
59
+ "uuid": "GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7"
60
+ }
61
+ ],
62
+ "cudaVersion": "13.0",
63
+ "writerId": "1qvdn1dfs9lrx9hpw1cc1d9q3gh3ht3r"
64
+ }
wandb/run-20260112_223423-ozob7eqw/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"train/loss":0.00112406094558537,"_step":173979,"charts/epsilon":0.05,"eval/episodes":4000,"train/episodic_length":3,"perf/SPS":689,"eval/std_return":0.6024724967788987,"_timestamp":1.7682287212650092e+09,"train/success_rate_100":0.98,"train/success":1,"train/learning_rate":0.00025,"eval/success_rate":0.04625,"_wandb":{"runtime":256},"eval/avg_return":-1.8673750000000005,"train/episodic_return":0.7,"global_step":173979,"_runtime":256.543296735}
wandb/run-20260112_223643-sgt786ss/files/code/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Action Masking for RAGEN Sudoku (4x4, max_step=20)
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+
10
+ import gymnasium as gym
11
+ import numpy as np
12
+ import torch
13
+ import torch.nn as nn
14
+ import torch.optim as optim
15
+ import tyro
16
+
17
+ import sys
18
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
19
+
20
+ from ragen.env.sudoku.env import SudokuEnv
21
+ from ragen.env.sudoku.config import SudokuEnvConfig
22
+
23
+
24
+ class SudokuWrapper(gym.Env):
25
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
26
+
27
+ def __init__(self, env: SudokuEnv, grid_size: int):
28
+ super().__init__()
29
+ self._env = env
30
+ self._size = grid_size
31
+ self._val_dim = self._size + 1
32
+ self._act_n = self._size * self._size * self._size
33
+ self.action_space = gym.spaces.Discrete(self._act_n)
34
+ self.observation_space = gym.spaces.Dict({
35
+ "observation": gym.spaces.Box(low=0.0, high=1.0, shape=(self._size * self._size * self._val_dim,), dtype=np.float32),
36
+ "action_mask": gym.spaces.Box(low=0.0, high=1.0, shape=(self._act_n,), dtype=np.float32)
37
+ })
38
+
39
+ def _encode_obs(self, text_obs: str) -> Dict[str, np.ndarray]:
40
+ vals: List[int] = []
41
+ for line in text_obs.splitlines():
42
+ ls = line.strip()
43
+ if len(ls) == 0:
44
+ continue
45
+ if set(ls) <= {'-'}:
46
+ continue
47
+ tokens = [t for t in ls.split() if t != '|']
48
+ if len(tokens) == 0:
49
+ continue
50
+ for t in tokens:
51
+ if t == '.':
52
+ vals.append(0)
53
+ else:
54
+ try:
55
+ v = int(t)
56
+ except ValueError:
57
+ v = 0
58
+ vals.append(v)
59
+ target = self._size * self._size
60
+ if len(vals) < target:
61
+ vals.extend([0] * (target - len(vals)))
62
+ if len(vals) > target:
63
+ vals = vals[:target]
64
+ grid = np.zeros((target, self._val_dim), dtype=np.float32)
65
+ mask = np.zeros(self._act_n, dtype=np.float32)
66
+ for i, v in enumerate(vals):
67
+ v_clamped = int(v)
68
+ if v_clamped < 0 or v_clamped > self._size:
69
+ v_clamped = 0
70
+ grid[i, v_clamped] = 1.0
71
+ if v_clamped != 0:
72
+ start_idx = i * self._size
73
+ end_idx = start_idx + self._size
74
+ mask[start_idx:end_idx] = 0.0
75
+ cur = np.array(vals, dtype=np.int64).reshape(self._size, self._size)
76
+ box = int(np.sqrt(self._size))
77
+ for i, v in enumerate(vals):
78
+ if int(v) == 0:
79
+ r = i // self._size
80
+ c = i % self._size
81
+ row_vals = set(cur[r, :].tolist())
82
+ col_vals = set(cur[:, c].tolist())
83
+ br = (r // box) * box
84
+ bc = (c // box) * box
85
+ box_vals = set(cur[br:br + box, bc:bc + box].reshape(-1).tolist())
86
+ start_idx = i * self._size
87
+ for num in range(1, self._size + 1):
88
+ if (num not in row_vals) and (num not in col_vals) and (num not in box_vals):
89
+ mask[start_idx + (num - 1)] = 1.0
90
+ if mask.sum() == 0:
91
+ for i, v in enumerate(vals):
92
+ if int(v) == 0:
93
+ start_idx = i * self._size
94
+ end_idx = start_idx + self._size
95
+ mask[start_idx:end_idx] = 1.0
96
+ if mask.sum() == 0:
97
+ mask[:] = 1.0
98
+ return {
99
+ "observation": grid.reshape(-1),
100
+ "action_mask": mask,
101
+ }
102
+
103
+ @staticmethod
104
+ def _decode_action(action_id: int, grid_size: int) -> Tuple[int, int, int]:
105
+ g = grid_size
106
+ row = action_id // (g * g)
107
+ rem = action_id % (g * g)
108
+ col = rem // g
109
+ num = (rem % g) + 1
110
+ return row, col, num
111
+
112
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
113
+ text_obs = self._env.reset(seed=seed)
114
+ obs = self._encode_obs(text_obs)
115
+ return obs, {}
116
+
117
+ def step(self, action: int):
118
+ row, col, num = self._decode_action(int(action), self._size)
119
+ act_str = f"{row + 1},{col + 1},{num}"
120
+ text_obs, reward, done, info = self._env.step(act_str)
121
+ obs = self._encode_obs(text_obs)
122
+ terminated = bool(done)
123
+ truncated = False
124
+ return obs, float(reward), terminated, truncated, info or {}
125
+
126
+ def render(self):
127
+ return self._env.render()
128
+
129
+ def close(self):
130
+ self._env.close()
131
+
132
+
133
+ @dataclass
134
+ class Args:
135
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
136
+ seed: int = 1
137
+ torch_deterministic: bool = True
138
+ cuda: bool = True
139
+ track: bool = True
140
+ wandb_project_name: str = "cleanRL"
141
+ wandb_entity: str | None = None
142
+ capture_video: bool = False
143
+
144
+ # Algorithm
145
+ env_id: str = "SudokuDQN"
146
+ total_timesteps: int = 2_000_000
147
+ learning_rate: float = 3e-4
148
+ gamma: float = 0.99
149
+ batch_size: int = 128
150
+ buffer_size: int = 400_000
151
+ target_network_frequency: int = 4000
152
+ train_frequency: int = 1
153
+ learning_starts: int = 10000
154
+
155
+ # Epsilon-greedy
156
+ start_e: float = 1.0
157
+ end_e: float = 0.05
158
+ exploration_fraction: float = 0.2
159
+
160
+ # Model size
161
+ hidden_size: int = 256
162
+
163
+ # Sudoku specific
164
+ grid_size: int = 4
165
+ difficulty: str = "easy"
166
+
167
+ # Eval
168
+ eval_splits: int = 2
169
+ eval_episodes: int = 4000
170
+
171
+
172
+ def make_env(idx, run_name, seed, grid_size, difficulty, capture_video=False):
173
+ def thunk():
174
+ config = SudokuEnvConfig(
175
+ grid_size=grid_size,
176
+ difficulty=difficulty,
177
+ render_mode='text',
178
+ render_format='simple',
179
+ )
180
+ env = SudokuEnv(config)
181
+ env = SudokuWrapper(env, grid_size)
182
+ max_steps = 20
183
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps)
184
+ env = gym.wrappers.RecordEpisodeStatistics(env)
185
+ if capture_video and idx == 0:
186
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
187
+ return env
188
+ return thunk
189
+
190
+
191
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
192
+ torch.nn.init.orthogonal_(layer.weight, std)
193
+ torch.nn.init.constant_(layer.bias, bias_const)
194
+ return layer
195
+
196
+
197
+ class QNetwork(nn.Module):
198
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
199
+ super().__init__()
200
+ self.net = nn.Sequential(
201
+ layer_init(nn.Linear(obs_dim, hidden)),
202
+ nn.ReLU(),
203
+ layer_init(nn.Linear(hidden, hidden)),
204
+ nn.ReLU(),
205
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
206
+ )
207
+
208
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
209
+ return self.net(x)
210
+
211
+
212
+ class ReplayBuffer:
213
+ def __init__(self, capacity: int, obs_dim: int):
214
+ self.capacity = capacity
215
+ self.ptr = 0
216
+ self.full = False
217
+ self.obs_buf = np.zeros((capacity, obs_dim), dtype=np.float32)
218
+ self.next_obs_buf = np.zeros((capacity, obs_dim), dtype=np.float32)
219
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
220
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
221
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
222
+
223
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
224
+ i = self.ptr
225
+ self.obs_buf[i] = obs
226
+ self.next_obs_buf[i] = next_obs
227
+ self.act_buf[i] = act
228
+ self.rew_buf[i] = rew
229
+ self.done_buf[i] = 1.0 if done else 0.0
230
+ self.ptr = (self.ptr + 1) % self.capacity
231
+ if self.ptr == 0:
232
+ self.full = True
233
+
234
+ def can_sample(self, batch_size: int) -> bool:
235
+ return (self.capacity if self.full else self.ptr) >= batch_size
236
+
237
+ def sample(self, batch_size: int):
238
+ size = self.capacity if self.full else self.ptr
239
+ idxs = np.random.randint(0, size, size=batch_size)
240
+ return (
241
+ self.obs_buf[idxs],
242
+ self.act_buf[idxs],
243
+ self.rew_buf[idxs],
244
+ self.done_buf[idxs],
245
+ self.next_obs_buf[idxs],
246
+ )
247
+
248
+
249
+ if __name__ == "__main__":
250
+ args = tyro.cli(Args)
251
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
252
+
253
+ if args.track:
254
+ import wandb
255
+ wandb.init(
256
+ project=args.wandb_project_name,
257
+ entity=args.wandb_entity,
258
+ config=vars(args),
259
+ name=run_name,
260
+ monitor_gym=True,
261
+ save_code=True,
262
+ )
263
+ try:
264
+ wandb.define_metric("global_step")
265
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
266
+ wandb.define_metric(prefix, step_metric="global_step")
267
+ except Exception:
268
+ pass
269
+
270
+ random.seed(args.seed)
271
+ np.random.seed(args.seed)
272
+ torch.manual_seed(args.seed)
273
+ torch.backends.cudnn.deterministic = args.torch_deterministic
274
+
275
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
276
+
277
+ env = make_env(0, run_name, args.seed, args.grid_size, args.difficulty, args.capture_video)()
278
+ # Flattened grid only from Dict observation
279
+ sample_obs, _ = env.reset(seed=args.seed)
280
+ obs_dim = int(np.prod(sample_obs["observation"].shape))
281
+ act_dim = env.action_space.n
282
+
283
+ policy_net = QNetwork(obs_dim, act_dim, args.hidden_size).to(device)
284
+ target_net = QNetwork(obs_dim, act_dim, args.hidden_size).to(device)
285
+ target_net.load_state_dict(policy_net.state_dict())
286
+ target_net.eval()
287
+
288
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
289
+ criterion = nn.SmoothL1Loss()
290
+
291
+ rb = ReplayBuffer(args.buffer_size, obs_dim)
292
+
293
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
294
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
295
+
296
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
297
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
298
+ out_dir.mkdir(parents=True, exist_ok=True)
299
+ out_path = out_dir / "trajectories.jsonl"
300
+ env_eval = make_env_fn()
301
+ collected = 0
302
+ summary_returns = []
303
+ summary_success = []
304
+ with out_path.open("w") as f:
305
+ while collected < n_episodes:
306
+ obs_dict, _ = env_eval.reset(seed=args.seed + 100000 + collected)
307
+ state = obs_dict['observation']
308
+ mask = obs_dict['action_mask']
309
+ traj_states = [state.tolist()]
310
+ traj_actions = []
311
+ traj_rewards = []
312
+ traj_dones = []
313
+ traj_success = []
314
+ done = False
315
+ step_count = 0
316
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.grid_size * args.grid_size * 6)
317
+ while not done:
318
+ with torch.no_grad():
319
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
320
+ mask_t = torch.tensor(mask, dtype=torch.float32, device=device).unsqueeze(0)
321
+ masked_q = q + (mask_t - 1.0) * 1e8
322
+ action = int(torch.argmax(masked_q, dim=1).item())
323
+ next_obs_dict, reward, terminated, truncated, info = env_eval.step(action)
324
+ traj_actions.append(int(action))
325
+ traj_rewards.append(float(reward))
326
+ step_count += 1
327
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
328
+ traj_dones.append(d)
329
+ traj_success.append(bool((info or {}).get('success', False)))
330
+ state = next_obs_dict['observation']
331
+ mask = next_obs_dict['action_mask']
332
+ traj_states.append(state.tolist())
333
+ done = d
334
+ ep_ret = float(sum(traj_rewards))
335
+ ep_succ = bool(any(traj_success))
336
+ record = {
337
+ "states": traj_states,
338
+ "actions": traj_actions,
339
+ "rewards": traj_rewards,
340
+ "dones": traj_dones,
341
+ "success": traj_success,
342
+ "episode_return": ep_ret,
343
+ "episode_success": ep_succ,
344
+ }
345
+ f.write(json.dumps(record) + "\n")
346
+ collected += 1
347
+ summary_returns.append(ep_ret)
348
+ summary_success.append(1.0 if ep_succ else 0.0)
349
+ env_eval.close()
350
+ try:
351
+ metrics = {
352
+ "global_step": int(step_tag),
353
+ "episodes": int(n_episodes),
354
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
355
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
356
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
357
+ }
358
+ with (out_dir / "metrics.json").open("w") as mf:
359
+ json.dump(metrics, mf)
360
+ except Exception as e:
361
+ print(f"Warning: failed to write eval metrics: {e}")
362
+
363
+ global_step = 0
364
+ start_time = time.time()
365
+
366
+ obs_dict, _ = env.reset(seed=args.seed)
367
+ obs = obs_dict['observation']
368
+ mask = obs_dict['action_mask']
369
+ ep_success_window: List[float] = []
370
+
371
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
372
+
373
+ while global_step < args.total_timesteps:
374
+ epsilon = epsilon_by_step(global_step)
375
+ with torch.no_grad():
376
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
377
+ mask_t = torch.tensor(mask, dtype=torch.float32, device=device).unsqueeze(0)
378
+ masked_q = q_values + (mask_t - 1.0) * 1e8
379
+ greedy_action = int(torch.argmax(masked_q, dim=1).item())
380
+ if (np.random.rand() < epsilon) or (global_step < args.learning_starts):
381
+ valid = np.where(mask > 0.5)[0]
382
+ if len(valid) > 0:
383
+ action = int(np.random.choice(valid))
384
+ else:
385
+ action = int(np.random.randint(0, act_dim))
386
+ else:
387
+ action = greedy_action
388
+
389
+ next_obs_dict, reward, terminated, truncated, info = env.step(action)
390
+ done = bool(terminated) or bool(truncated)
391
+
392
+ next_obs = next_obs_dict['observation']
393
+ next_mask = next_obs_dict['action_mask']
394
+
395
+ rb.add(obs.astype(np.float32), int(action), float(reward), bool(done), next_obs.astype(np.float32))
396
+
397
+ obs = next_obs
398
+ mask = next_mask
399
+ global_step += 1
400
+
401
+ if done:
402
+ succ = bool((info or {}).get('success', False))
403
+ ep_success_window.append(1.0 if succ else 0.0)
404
+ if len(ep_success_window) > 100:
405
+ ep_success_window.pop(0)
406
+ if args.track:
407
+ try:
408
+ import wandb
409
+ wandb.log({
410
+ "global_step": int(global_step),
411
+ "rollout/success": float(1.0 if succ else 0.0),
412
+ "rollout/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else None,
413
+ }, step=global_step)
414
+ except Exception:
415
+ pass
416
+ obs_dict, _ = env.reset()
417
+ obs = obs_dict['observation']
418
+ mask = obs_dict['action_mask']
419
+
420
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
421
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
422
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
423
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
424
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
425
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
426
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
427
+
428
+ with torch.no_grad():
429
+ next_q = target_net(b_next_obs).max(dim=1)[0]
430
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
431
+
432
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
433
+ loss = criterion(current_q, target_q)
434
+
435
+ optimizer.zero_grad()
436
+ loss.backward()
437
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
438
+ optimizer.step()
439
+
440
+ if args.track:
441
+ try:
442
+ import wandb
443
+ wandb.log({
444
+ "global_step": int(global_step),
445
+ "train/loss": float(loss.item()),
446
+ "charts/epsilon": float(epsilon),
447
+ "perf/SPS": int(global_step / (time.time() - start_time)),
448
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
449
+ }, step=global_step)
450
+ except Exception:
451
+ pass
452
+
453
+ if global_step % args.target_network_frequency == 0:
454
+ target_net.load_state_dict(policy_net.state_dict())
455
+
456
+ if global_step % 1000 == 0:
457
+ sps = int(global_step / (time.time() - start_time))
458
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
459
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
460
+
461
+ if global_step == 1 or (global_step % eval_every_steps == 0):
462
+ try:
463
+ def eval_thunk():
464
+ return make_env(0, run_name, args.seed + 9999, args.grid_size, args.difficulty, False)()
465
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
466
+ if args.track:
467
+ try:
468
+ import wandb
469
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
470
+ if mpath.exists():
471
+ with mpath.open("r") as mf:
472
+ metrics = json.load(mf)
473
+ wandb.log({
474
+ "eval/success_rate": metrics.get("success_rate"),
475
+ "eval/avg_return": metrics.get("avg_return"),
476
+ "eval/std_return": metrics.get("std_return"),
477
+ "eval/episodes": metrics.get("episodes"),
478
+ }, step=global_step)
479
+ except Exception:
480
+ pass
481
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
482
+ except Exception as e:
483
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
484
+
485
+ env.close()
wandb/run-20260112_223643-sgt786ss/files/config.yaml ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.23.0
4
+ code_path: code/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
5
+ e:
6
+ shc54txtsp3x3q5ajbrzfnd1sznlb05g:
7
+ args:
8
+ - --track
9
+ codePath: cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
10
+ codePathLocal: cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
11
+ cpu_count: 64
12
+ cpu_count_logical: 128
13
+ cudaVersion: "13.0"
14
+ disk:
15
+ /:
16
+ total: "2576980377600"
17
+ used: "3724296192"
18
+ email: haoyu-wa22@mails.tsinghua.edu.cn
19
+ executable: /root/local/miniconda3/envs/ragen/bin/python
20
+ git:
21
+ commit: 8d73639b99b38265453f898b8d6af7d4af50d56e
22
+ remote: https://github.com/mll-lab-nu/RAGEN.git
23
+ gpu: NVIDIA H100 80GB HBM3
24
+ gpu_count: 4
25
+ gpu_nvidia:
26
+ - architecture: Hopper
27
+ cudaCores: 16896
28
+ memoryTotal: "85520809984"
29
+ name: NVIDIA H100 80GB HBM3
30
+ uuid: GPU-cff454b9-f118-535b-5e1f-6d503e78e52e
31
+ - architecture: Hopper
32
+ cudaCores: 16896
33
+ memoryTotal: "85520809984"
34
+ name: NVIDIA H100 80GB HBM3
35
+ uuid: GPU-9e77c178-188c-f869-780e-858c20a7d322
36
+ - architecture: Hopper
37
+ cudaCores: 16896
38
+ memoryTotal: "85520809984"
39
+ name: NVIDIA H100 80GB HBM3
40
+ uuid: GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9
41
+ - architecture: Hopper
42
+ cudaCores: 16896
43
+ memoryTotal: "85520809984"
44
+ name: NVIDIA H100 80GB HBM3
45
+ uuid: GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7
46
+ host: pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0
47
+ memory:
48
+ total: "2163639439360"
49
+ os: Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35
50
+ program: /mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
51
+ python: CPython 3.10.19
52
+ root: /mnt/general/wanghy/RAGEN
53
+ startedAt: "2026-01-12T14:36:43.218427Z"
54
+ writerId: shc54txtsp3x3q5ajbrzfnd1sznlb05g
55
+ m:
56
+ - "1": global_step
57
+ "6":
58
+ - 3
59
+ "7": []
60
+ - "2": eval/*
61
+ "5": 1
62
+ "6":
63
+ - 1
64
+ "7": []
65
+ - "2": losses/*
66
+ "5": 1
67
+ "6":
68
+ - 1
69
+ "7": []
70
+ - "2": charts/*
71
+ "5": 1
72
+ "6":
73
+ - 1
74
+ "7": []
75
+ - "2": perf/*
76
+ "5": 1
77
+ "6":
78
+ - 1
79
+ "7": []
80
+ - "2": train/*
81
+ "5": 1
82
+ "6":
83
+ - 1
84
+ "7": []
85
+ - "2": rollout/*
86
+ "5": 1
87
+ "6":
88
+ - 1
89
+ "7": []
90
+ python_version: 3.10.19
91
+ t:
92
+ "1":
93
+ - 1
94
+ - 11
95
+ - 30
96
+ - 49
97
+ - 50
98
+ - 51
99
+ - 105
100
+ "2":
101
+ - 1
102
+ - 11
103
+ - 30
104
+ - 49
105
+ - 50
106
+ - 51
107
+ - 105
108
+ "3":
109
+ - 7
110
+ - 13
111
+ - 16
112
+ - 61
113
+ "4": 3.10.19
114
+ "5": 0.23.0
115
+ "6": 4.57.3
116
+ "12": 0.23.0
117
+ "13": linux-x86_64
118
+ batch_size:
119
+ value: 128
120
+ buffer_size:
121
+ value: 400000
122
+ capture_video:
123
+ value: false
124
+ cuda:
125
+ value: true
126
+ difficulty:
127
+ value: easy
128
+ end_e:
129
+ value: 0.05
130
+ env_id:
131
+ value: SudokuDQN
132
+ eval_episodes:
133
+ value: 4000
134
+ eval_splits:
135
+ value: 2
136
+ exp_name:
137
+ value: dqn_sudoku
138
+ exploration_fraction:
139
+ value: 0.2
140
+ gamma:
141
+ value: 0.99
142
+ grid_size:
143
+ value: 4
144
+ hidden_size:
145
+ value: 256
146
+ learning_rate:
147
+ value: 0.0003
148
+ learning_starts:
149
+ value: 10000
150
+ seed:
151
+ value: 1
152
+ start_e:
153
+ value: 1
154
+ target_network_frequency:
155
+ value: 4000
156
+ torch_deterministic:
157
+ value: true
158
+ total_timesteps:
159
+ value: 2000000
160
+ track:
161
+ value: true
162
+ train_frequency:
163
+ value: 1
164
+ wandb_entity:
165
+ value: null
166
+ wandb_project_name:
167
+ value: cleanRL
wandb/run-20260112_223643-sgt786ss/files/diff.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_223643-sgt786ss/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_223643-sgt786ss/files/requirements.txt ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ colorama==0.4.6
2
+ psutil==7.1.3
3
+ ragen==0.1
4
+ Farama-Notifications==0.0.4
5
+ MarkupSafe==2.1.5
6
+ PyJWT==2.10.1
7
+ PySocks==1.7.1
8
+ absl-py==2.3.1
9
+ accelerate==1.12.0
10
+ aiohappyeyeballs==2.6.1
11
+ aiohttp==3.13.2
12
+ aiohttp-cors==0.8.1
13
+ aiosignal==1.4.0
14
+ airportsdata==20250909
15
+ annotated-doc==0.0.4
16
+ annotated-types==0.7.0
17
+ anthropic==0.75.0
18
+ antlr4-python3-runtime==4.9.3
19
+ anyio==4.12.0
20
+ astor==0.8.1
21
+ asttokens==3.0.1
22
+ async-timeout==5.0.1
23
+ attrs==25.4.0
24
+ beautifulsoup4==4.14.3
25
+ black==25.11.0
26
+ blake3==1.0.8
27
+ blinker==1.9.0
28
+ blis==1.3.3
29
+ cachetools==6.2.2
30
+ catalogue==2.0.10
31
+ certifi==2025.11.12
32
+ cffi==2.0.0
33
+ charset-normalizer==3.4.4
34
+ cleantext==1.1.4
35
+ click==8.2.1
36
+ cloudpathlib==0.23.0
37
+ cloudpickle==3.1.2
38
+ codetiming==1.4.0
39
+ colorama==0.4.6
40
+ coloredlogs==15.0.1
41
+ colorful==0.5.8
42
+ compressed-tensors==0.9.3
43
+ confection==0.1.5
44
+ contourpy==1.3.2
45
+ cryptography==46.0.3
46
+ cupy-cuda12x==13.6.0
47
+ cycler==0.12.1
48
+ cymem==2.0.13
49
+ Cython==3.2.2
50
+ datasets==4.4.1
51
+ debugpy==1.8.17
52
+ decorator==5.2.1
53
+ Deprecated==1.3.1
54
+ depyf==0.18.0
55
+ dill==0.4.0
56
+ diskcache==5.6.3
57
+ distlib==0.4.0
58
+ distro==1.9.0
59
+ dnspython==2.8.0
60
+ docstring_parser==0.17.0
61
+ einops==0.8.1
62
+ email-validator==2.3.0
63
+ eval_type_backport==0.2.2
64
+ exceptiongroup==1.3.1
65
+ executing==2.2.1
66
+ faiss-gpu==1.7.2
67
+ fastapi==0.123.1
68
+ fastapi-cli==0.0.16
69
+ fastapi-cloud-cli==0.5.2
70
+ fastar==0.8.0
71
+ fastrlock==0.8.3
72
+ filelock==3.19.1
73
+ flash_attn==2.8.3
74
+ Flask==3.1.2
75
+ flatbuffers==25.9.23
76
+ fonttools==4.61.0
77
+ frozenlist==1.8.0
78
+ fsspec==2025.9.0
79
+ gdown==5.2.0
80
+ gguf==0.17.1
81
+ gitdb==4.0.12
82
+ GitPython==3.1.45
83
+ google-api-core==2.28.1
84
+ google-auth==2.43.0
85
+ googleapis-common-protos==1.72.0
86
+ grpcio==1.76.0
87
+ gym==0.26.2
88
+ gym-notices==0.1.0
89
+ gym-sokoban==0.0.6
90
+ gymnasium==1.2.2
91
+ h11==0.16.0
92
+ hf-xet==1.2.0
93
+ html2text==2025.4.15
94
+ httpcore==1.0.9
95
+ httptools==0.7.1
96
+ httpx==0.28.1
97
+ httpx-sse==0.4.3
98
+ huggingface-hub==0.36.0
99
+ humanfriendly==10.0
100
+ hydra-core==1.3.2
101
+ idna==3.11
102
+ ImageIO==2.37.2
103
+ importlib_metadata==8.0.0
104
+ interegular==0.3.3
105
+ ipython==8.37.0
106
+ itsdangerous==2.2.0
107
+ jedi==0.19.2
108
+ Jinja2==3.1.6
109
+ jiter==0.12.0
110
+ joblib==1.5.2
111
+ jsonschema==4.25.1
112
+ jsonschema-specifications==2025.9.1
113
+ kimina-client==0.2.1
114
+ kiwisolver==1.4.9
115
+ lark==1.2.2
116
+ llguidance==0.7.30
117
+ llvmlite==0.44.0
118
+ lm-format-enforcer==0.10.12
119
+ loguru==0.7.3
120
+ Markdown==3.10
121
+ markdown-it-py==4.0.0
122
+ matplotlib==3.10.7
123
+ matplotlib-inline==0.2.1
124
+ mcp==1.22.0
125
+ mdurl==0.1.2
126
+ mistral_common==1.8.6
127
+ mpmath==1.3.0
128
+ msgpack==1.1.2
129
+ msgspec==0.20.0
130
+ multidict==6.7.0
131
+ multiprocess==0.70.18
132
+ murmurhash==1.0.15
133
+ mypy_extensions==1.1.0
134
+ nest-asyncio==1.6.0
135
+ networkx==3.3
136
+ ninja==1.13.0
137
+ nltk==3.9.2
138
+ numba==0.61.2
139
+ numpy==1.26.4
140
+ nvidia-cublas-cu12==12.4.5.8
141
+ nvidia-cuda-cupti-cu12==12.4.127
142
+ nvidia-cuda-nvrtc-cu12==12.4.127
143
+ nvidia-cuda-runtime-cu12==12.4.127
144
+ nvidia-cudnn-cu12==9.1.0.70
145
+ nvidia-cufft-cu12==11.2.1.3
146
+ nvidia-curand-cu12==10.3.5.147
147
+ nvidia-cusolver-cu12==11.6.1.9
148
+ nvidia-cusparse-cu12==12.3.1.170
149
+ nvidia-cusparselt-cu12==0.6.2
150
+ nvidia-nccl-cu12==2.21.5
151
+ nvidia-nvjitlink-cu12==12.4.127
152
+ nvidia-nvtx-cu12==12.4.127
153
+ omegaconf==2.3.0
154
+ onnxruntime==1.23.2
155
+ openai==2.8.1
156
+ opencensus==0.11.4
157
+ opencensus-context==0.1.3
158
+ opencv-python-headless==4.12.0.88
159
+ opentelemetry-api==1.38.0
160
+ opentelemetry-exporter-otlp==1.26.0
161
+ opentelemetry-exporter-otlp-proto-common==1.26.0
162
+ opentelemetry-exporter-otlp-proto-grpc==1.26.0
163
+ opentelemetry-exporter-otlp-proto-http==1.26.0
164
+ opentelemetry-exporter-prometheus==0.59b0
165
+ opentelemetry-proto==1.26.0
166
+ opentelemetry-sdk==1.38.0
167
+ opentelemetry-semantic-conventions==0.59b0
168
+ opentelemetry-semantic-conventions-ai==0.4.13
169
+ orjson==3.11.4
170
+ outlines==0.1.11
171
+ outlines_core==0.1.26
172
+ packaging==25.0
173
+ pandas==2.3.3
174
+ parso==0.8.5
175
+ partial-json-parser==0.2.1.1.post7
176
+ pathspec==0.12.1
177
+ peft==0.18.0
178
+ pexpect==4.9.0
179
+ pillow==11.3.0
180
+ pip==25.3
181
+ platformdirs==4.5.0
182
+ preshed==3.0.12
183
+ prometheus_client==0.23.1
184
+ prometheus-fastapi-instrumentator==7.1.0
185
+ prompt_toolkit==3.0.52
186
+ propcache==0.4.1
187
+ proto-plus==1.26.1
188
+ protobuf==4.25.8
189
+ psutil==7.1.3
190
+ ptyprocess==0.7.0
191
+ pure_eval==0.2.3
192
+ py-cpuinfo==9.0.0
193
+ py-spy==0.4.1
194
+ pyarrow==22.0.0
195
+ pyasn1==0.6.1
196
+ pyasn1_modules==0.4.2
197
+ pybind11==3.0.1
198
+ pycountry==24.6.1
199
+ pycparser==2.23
200
+ pydantic==2.12.5
201
+ pydantic_core==2.41.5
202
+ pydantic-extra-types==2.10.6
203
+ pydantic-settings==2.12.0
204
+ pygame==2.6.1
205
+ Pygments==2.19.2
206
+ pyjnius==1.7.0
207
+ pylatexenc==2.10
208
+ pyparsing==3.2.5
209
+ pyserini==1.2.0
210
+ python-dateutil==2.9.0.post0
211
+ python-dotenv==1.2.1
212
+ python-json-logger==4.0.0
213
+ python-multipart==0.0.20
214
+ pytokens==0.3.0
215
+ pytz==2025.2
216
+ PyYAML==6.0.3
217
+ pyzmq==27.1.0
218
+ ragen==0.1
219
+ rank-bm25==0.2.2
220
+ RapidFuzz==3.14.3
221
+ ray==2.52.1
222
+ referencing==0.37.0
223
+ regex==2025.11.3
224
+ requests==2.32.5
225
+ rich==14.2.0
226
+ rich-toolkit==0.17.0
227
+ rignore==0.7.6
228
+ rpds-py==0.30.0
229
+ rsa==4.9.1
230
+ safetensors==0.7.0
231
+ scikit-learn==1.7.2
232
+ scipy==1.15.3
233
+ sentencepiece==0.2.1
234
+ sentry-sdk==2.46.0
235
+ setuptools==80.9.0
236
+ shellingham==1.5.4
237
+ six==1.17.0
238
+ smart_open==7.5.0
239
+ smmap==5.0.2
240
+ sniffio==1.3.1
241
+ soupsieve==2.8
242
+ spacy==3.8.11
243
+ spacy-legacy==3.0.12
244
+ spacy-loggers==1.0.5
245
+ srsly==2.5.2
246
+ sse-starlette==3.0.3
247
+ stack-data==0.6.3
248
+ starlette==0.50.0
249
+ sympy==1.13.1
250
+ tabulate==0.9.0
251
+ tenacity==9.1.2
252
+ tensorboard==2.20.0
253
+ tensorboard-data-server==0.7.2
254
+ tensordict==0.8.3
255
+ thefuzz==0.22.1
256
+ thinc==8.3.10
257
+ threadpoolctl==3.6.0
258
+ tiktoken==0.12.0
259
+ together==1.5.31
260
+ tokenizers==0.22.1
261
+ tomli==2.3.0
262
+ torch==2.6.0+cu124
263
+ torchaudio==2.6.0
264
+ torchdata==0.11.0
265
+ torchvision==0.21.0
266
+ tqdm==4.67.1
267
+ traitlets==5.14.3
268
+ transformers==4.57.3
269
+ triton==3.2.0
270
+ typer==0.19.2
271
+ typer-slim==0.20.0
272
+ typing_extensions==4.15.0
273
+ typing-inspection==0.4.2
274
+ tzdata==2025.2
275
+ urllib3==2.5.0
276
+ uvicorn==0.38.0
277
+ uvloop==0.22.1
278
+ verl==0.5.0.dev0
279
+ virtualenv==20.35.4
280
+ vllm==0.8.5
281
+ wandb==0.23.0
282
+ wasabi==1.1.3
283
+ watchfiles==1.1.1
284
+ wcwidth==0.2.14
285
+ weasel==0.4.3
286
+ websockets==15.0.1
287
+ Werkzeug==3.1.4
288
+ wheel==0.45.1
289
+ wrapt==2.0.1
290
+ xformers==0.0.29.post2
291
+ xgrammar==0.1.18
292
+ xxhash==3.6.0
293
+ yarl==1.22.0
294
+ zipp==3.23.0
295
+ typeguard==4.4.4
296
+ tyro==1.0.3
297
+ verl==0.5.0.dev0
298
+ autocommand==2.2.2
299
+ backports.tarfile==1.2.0
300
+ importlib_metadata==8.0.0
301
+ inflect==7.3.1
302
+ jaraco.collections==5.1.0
303
+ jaraco.context==5.3.0
304
+ jaraco.functools==4.0.1
305
+ jaraco.text==3.12.1
306
+ more-itertools==10.3.0
307
+ packaging==24.2
308
+ platformdirs==4.2.2
309
+ tomli==2.0.1
310
+ typeguard==4.3.0
311
+ typing_extensions==4.12.2
312
+ wheel==0.45.1
313
+ zipp==3.19.2
wandb/run-20260112_223643-sgt786ss/files/wandb-metadata.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35",
3
+ "python": "CPython 3.10.19",
4
+ "startedAt": "2026-01-12T14:36:43.218427Z",
5
+ "args": [
6
+ "--track"
7
+ ],
8
+ "program": "/mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py",
9
+ "codePath": "cleanrl/cleanrl/scout_dqn/dqn_sudoku.py",
10
+ "codePathLocal": "cleanrl/cleanrl/scout_dqn/dqn_sudoku.py",
11
+ "git": {
12
+ "remote": "https://github.com/mll-lab-nu/RAGEN.git",
13
+ "commit": "8d73639b99b38265453f898b8d6af7d4af50d56e"
14
+ },
15
+ "email": "haoyu-wa22@mails.tsinghua.edu.cn",
16
+ "root": "/mnt/general/wanghy/RAGEN",
17
+ "host": "pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0",
18
+ "executable": "/root/local/miniconda3/envs/ragen/bin/python",
19
+ "cpu_count": 64,
20
+ "cpu_count_logical": 128,
21
+ "gpu": "NVIDIA H100 80GB HBM3",
22
+ "gpu_count": 4,
23
+ "disk": {
24
+ "/": {
25
+ "total": "2576980377600",
26
+ "used": "3724296192"
27
+ }
28
+ },
29
+ "memory": {
30
+ "total": "2163639439360"
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper",
38
+ "uuid": "GPU-cff454b9-f118-535b-5e1f-6d503e78e52e"
39
+ },
40
+ {
41
+ "name": "NVIDIA H100 80GB HBM3",
42
+ "memoryTotal": "85520809984",
43
+ "cudaCores": 16896,
44
+ "architecture": "Hopper",
45
+ "uuid": "GPU-9e77c178-188c-f869-780e-858c20a7d322"
46
+ },
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper",
52
+ "uuid": "GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9"
53
+ },
54
+ {
55
+ "name": "NVIDIA H100 80GB HBM3",
56
+ "memoryTotal": "85520809984",
57
+ "cudaCores": 16896,
58
+ "architecture": "Hopper",
59
+ "uuid": "GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7"
60
+ }
61
+ ],
62
+ "cudaVersion": "13.0",
63
+ "writerId": "shc54txtsp3x3q5ajbrzfnd1sznlb05g"
64
+ }
wandb/run-20260112_223643-sgt786ss/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"_step":207700,"global_step":207700,"eval/std_return":6.124492096849747,"train/loss":94802.0234375,"eval/success_rate":0.75925,"_wandb":{"runtime":942},"charts/epsilon":0.506714875,"eval/avg_return":12.523325000000002,"rollout/success":1,"eval/episodes":4000,"_runtime":942.891776839,"train/learning_rate":0.0003,"_timestamp":1.7682295476527374e+09,"rollout/success_rate_100":0.77,"perf/SPS":221}
wandb/run-20260112_223856-d964bhe6/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Step Penalty & Time Limit Bootstrap for RAGEN Rubik's Cube 2x2
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+ import re
10
+
11
+ import gymnasium as gym
12
+ import numpy as np
13
+ import torch
14
+ import torch.nn as nn
15
+ import torch.optim as optim
16
+ import tyro
17
+
18
+ import sys
19
+ # 假设 ragen 库在当前目录的上两级,请根据实际情况调整
20
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
21
+
22
+ from ragen.env.rubikscube.env import RubiksCube2x2Env
23
+ from ragen.env.rubikscube.config import RubiksCube2x2Config
24
+
25
+
26
+ class RubiksCubeWrapper(gym.Env):
27
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
28
+
29
+ def __init__(self, env: RubiksCube2x2Env):
30
+ super().__init__()
31
+ self._env = env
32
+ self._colors = ['W', 'O', 'G', 'R', 'B', 'Y']
33
+ self._color_to_idx = {c: i for i, c in enumerate(self._colors)}
34
+ self.observation_space = gym.spaces.Box(low=0.0, high=1.0, shape=(24 * len(self._colors),), dtype=np.float32)
35
+ self.action_space = gym.spaces.Discrete(12)
36
+ self._face_pat = re.compile(r"\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])\n\s*\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])")
37
+
38
+ # [关键修改] 每步惩罚
39
+ # 如果20步都没解出来,累计惩罚是 20 * -0.05 = -1.0,抵消掉最后可能获得的 +1.0
40
+ # 这迫使 agent 寻找更短路径
41
+ self.step_penalty = -0.02
42
+
43
+ def _encode_obs(self, text_obs: str) -> np.ndarray:
44
+ faces_order = ["Up (U):", "Left (L):", "Front (F):", "Right (R):", "Back (B):", "Down (D):"]
45
+ lines = text_obs.splitlines()
46
+ blocks: List[str] = []
47
+ i = 0
48
+ while i < len(lines):
49
+ line = lines[i]
50
+ for header in faces_order:
51
+ if line.startswith(header):
52
+ content = line[len(header):].strip()
53
+ next_line = lines[i + 1] if i + 1 < len(lines) else ""
54
+ block = f"{content}\n{next_line}"
55
+ blocks.append(block)
56
+ break
57
+ i += 1
58
+ if len(blocks) != 6:
59
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
60
+ stickers: List[int] = []
61
+ for blk in blocks:
62
+ m = self._face_pat.search(blk)
63
+ if not m:
64
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
65
+ c0, c1, c2, c3 = m.group(1), m.group(2), m.group(3), m.group(4)
66
+ stickers.extend([c0, c1, c2, c3])
67
+ grid = np.zeros((24, len(self._colors)), dtype=np.float32)
68
+ for idx, ch in enumerate(stickers):
69
+ cidx = self._color_to_idx.get(ch, None)
70
+ if cidx is not None:
71
+ grid[idx, cidx] = 1.0
72
+ return grid.reshape(-1)
73
+
74
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
75
+ text_obs = self._env.reset(seed=seed)
76
+ obs = self._encode_obs(text_obs)
77
+ return obs, {}
78
+
79
+ def step(self, action: int):
80
+ mapped = int(action) + 1
81
+ text_obs, reward, done, info = self._env.step(mapped)
82
+ obs = self._encode_obs(text_obs)
83
+ terminated = bool(done)
84
+ truncated = False
85
+
86
+ # [关键修改] 应用惩罚
87
+ # 此时 reward 包含原本的稀疏奖励 (0 或 1) 加上每步惩罚
88
+ reward = float(reward) + self.step_penalty
89
+
90
+ return obs, reward, terminated, truncated, info or {}
91
+
92
+ def render(self):
93
+ return self._env.render()
94
+
95
+ def close(self):
96
+ self._env.close()
97
+
98
+
99
+ @dataclass
100
+ class Args:
101
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
102
+ seed: int = 1
103
+ torch_deterministic: bool = True
104
+ cuda: bool = True
105
+ track: bool = True
106
+ wandb_project_name: str = "cleanRL"
107
+ wandb_entity: str | None = None
108
+ capture_video: bool = False
109
+
110
+ # Algorithm
111
+ env_id: str = "RubiksCube2x2DQN"
112
+ total_timesteps: int = 400_000
113
+ learning_rate: float = 2.5e-4
114
+ gamma: float = 0.99
115
+ batch_size: int = 128
116
+ buffer_size: int = 200_000
117
+ target_network_frequency: int = 4000
118
+ train_frequency: int = 4
119
+ learning_starts: int = 5000
120
+
121
+ # Epsilon-greedy
122
+ start_e: float = 1.0
123
+ end_e: float = 0.05
124
+ exploration_fraction: float = 0.2
125
+
126
+ # Model size
127
+ hidden_size: int = 256
128
+
129
+ # Rubik specific
130
+ scramble_depth: int = 3 # 初始难度
131
+ max_steps_env: int = 20 # 硬性时间限制
132
+
133
+ # Eval
134
+ eval_splits: int = 2
135
+ eval_episodes: int = 4000
136
+
137
+
138
+ def make_env(idx, run_name, seed, scramble_depth, max_steps_env, capture_video=False):
139
+ def thunk():
140
+ # [关键修改] 内部 max_steps 设为 1000,防止 env 内部发出 done=True
141
+ # 我们完全依赖外部 TimeLimit wrapper 来处理超时
142
+ config = RubiksCube2x2Config(scramble_depth=scramble_depth, max_steps=20, render_mode='text')
143
+ env = RubiksCube2x2Env(config)
144
+ env = RubiksCubeWrapper(env)
145
+ # 外部限制设为 20
146
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps_env)
147
+ env = gym.wrappers.RecordEpisodeStatistics(env)
148
+ if capture_video and idx == 0:
149
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
150
+ return env
151
+ return thunk
152
+
153
+
154
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
155
+ torch.nn.init.orthogonal_(layer.weight, std)
156
+ torch.nn.init.constant_(layer.bias, bias_const)
157
+ return layer
158
+
159
+
160
+ class QNetwork(nn.Module):
161
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
162
+ super().__init__()
163
+ self.net = nn.Sequential(
164
+ layer_init(nn.Linear(obs_dim, hidden)),
165
+ nn.ReLU(),
166
+ layer_init(nn.Linear(hidden, hidden)),
167
+ nn.ReLU(),
168
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
169
+ )
170
+
171
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
172
+ return self.net(x)
173
+
174
+
175
+ class ReplayBuffer:
176
+ def __init__(self, capacity: int, obs_shape: Tuple[int, ...]):
177
+ self.capacity = capacity
178
+ self.ptr = 0
179
+ self.full = False
180
+ self.obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
181
+ self.next_obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
182
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
183
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
184
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
185
+
186
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
187
+ i = self.ptr
188
+ self.obs_buf[i] = obs
189
+ self.next_obs_buf[i] = next_obs
190
+ self.act_buf[i] = act
191
+ self.rew_buf[i] = rew
192
+ self.done_buf[i] = 1.0 if done else 0.0
193
+ self.ptr = (self.ptr + 1) % self.capacity
194
+ if self.ptr == 0:
195
+ self.full = True
196
+
197
+ def can_sample(self, batch_size: int) -> bool:
198
+ return (self.capacity if self.full else self.ptr) >= batch_size
199
+
200
+ def sample(self, batch_size: int):
201
+ size = self.capacity if self.full else self.ptr
202
+ idxs = np.random.randint(0, size, size=batch_size)
203
+ return (
204
+ self.obs_buf[idxs],
205
+ self.act_buf[idxs],
206
+ self.rew_buf[idxs],
207
+ self.done_buf[idxs],
208
+ self.next_obs_buf[idxs],
209
+ )
210
+
211
+
212
+ if __name__ == "__main__":
213
+ args = tyro.cli(Args)
214
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
215
+
216
+ if args.track:
217
+ import wandb
218
+ wandb.init(
219
+ project=args.wandb_project_name,
220
+ entity=args.wandb_entity,
221
+ config=vars(args),
222
+ name=run_name,
223
+ monitor_gym=True,
224
+ save_code=True,
225
+ )
226
+ try:
227
+ wandb.define_metric("global_step")
228
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
229
+ wandb.define_metric(prefix, step_metric="global_step")
230
+ except Exception:
231
+ pass
232
+
233
+ random.seed(args.seed)
234
+ np.random.seed(args.seed)
235
+ torch.manual_seed(args.seed)
236
+ torch.backends.cudnn.deterministic = args.torch_deterministic
237
+
238
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
239
+
240
+ env = make_env(0, run_name, args.seed, args.scramble_depth, args.max_steps_env, args.capture_video)()
241
+ obs_shape = env.observation_space.shape
242
+ act_dim = env.action_space.n
243
+
244
+ policy_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
245
+ target_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
246
+ target_net.load_state_dict(policy_net.state_dict())
247
+ target_net.eval()
248
+
249
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
250
+ criterion = nn.SmoothL1Loss()
251
+
252
+ rb = ReplayBuffer(args.buffer_size, obs_shape)
253
+
254
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
255
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
256
+
257
+ # 评估函数
258
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
259
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
260
+ out_dir.mkdir(parents=True, exist_ok=True)
261
+ out_path = out_dir / "trajectories.jsonl"
262
+ env_eval = make_env_fn()
263
+ collected = 0
264
+ summary_returns = []
265
+ summary_success = []
266
+ with out_path.open("w") as f:
267
+ while collected < n_episodes:
268
+ state, _ = env_eval.reset(seed=args.seed + 100000 + collected)
269
+ traj_states = [np.asarray(state).tolist()]
270
+ traj_actions = []
271
+ traj_rewards = []
272
+ traj_dones = []
273
+ traj_success = []
274
+ done = False
275
+ step_count = 0
276
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.max_steps_env)
277
+ while not done:
278
+ with torch.no_grad():
279
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
280
+ action = int(torch.argmax(q, dim=1).item())
281
+ next_state, reward, terminated, truncated, info = env_eval.step(action)
282
+
283
+ traj_actions.append(int(action))
284
+ traj_rewards.append(float(reward))
285
+ step_count += 1
286
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
287
+ traj_dones.append(d)
288
+ traj_success.append(bool((info or {}).get('success', False)))
289
+ state = next_state
290
+ traj_states.append(np.asarray(state).tolist())
291
+ done = d
292
+ ep_ret = float(sum(traj_rewards))
293
+ ep_succ = bool(any(traj_success))
294
+ record = {
295
+ "states": traj_states,
296
+ "actions": traj_actions,
297
+ "rewards": traj_rewards,
298
+ "dones": traj_dones,
299
+ "success": traj_success,
300
+ "episode_return": ep_ret,
301
+ "episode_success": ep_succ,
302
+ }
303
+ f.write(json.dumps(record) + "\n")
304
+ collected += 1
305
+ summary_returns.append(ep_ret)
306
+ summary_success.append(1.0 if ep_succ else 0.0)
307
+ env_eval.close()
308
+ try:
309
+ metrics = {
310
+ "global_step": int(step_tag),
311
+ "episodes": int(n_episodes),
312
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
313
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
314
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
315
+ }
316
+ with (out_dir / "metrics.json").open("w") as mf:
317
+ json.dump(metrics, mf)
318
+ except Exception as e:
319
+ print(f"Warning: failed to write eval metrics: {e}")
320
+
321
+ # 主训练循环
322
+ global_step = 0
323
+ start_time = time.time()
324
+
325
+ obs, _ = env.reset(seed=args.seed)
326
+ ep_return = 0.0
327
+ ep_len = 0
328
+ ep_success_window: List[float] = []
329
+
330
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
331
+
332
+ while global_step < args.total_timesteps:
333
+ epsilon = epsilon_by_step(global_step)
334
+ if np.random.rand() < epsilon or global_step < args.learning_starts:
335
+ action = env.action_space.sample()
336
+ else:
337
+ with torch.no_grad():
338
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
339
+ action = int(torch.argmax(q_values, dim=1).item())
340
+
341
+ next_obs, reward, terminated, truncated, info = env.step(action)
342
+
343
+ # 判断是否需要 Reset (任何结束都 Reset)
344
+ real_done = bool(terminated) or bool(truncated)
345
+
346
+ # [核心逻辑]
347
+ # 1. 即使是 truncated (超时),done 也记为 False,以便进行 bootstrap (计算未来价值)
348
+ # 2. 只有 terminated (真正解开了),done 才记为 True
349
+ # 3. Step Penalty 已经包含在 reward 中,DQN 会学到"为了避免扣分,必须在未来几步内解决"
350
+ rb.add(
351
+ obs.astype(np.float32),
352
+ int(action),
353
+ float(reward),
354
+ bool(terminated), # 注意:只用 terminated
355
+ next_obs.astype(np.float32)
356
+ )
357
+
358
+ obs = next_obs
359
+ ep_return += float(reward)
360
+ ep_len += 1
361
+ global_step += 1
362
+
363
+ # 训练过程
364
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
365
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
366
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
367
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
368
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
369
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
370
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
371
+
372
+ with torch.no_grad():
373
+ next_q = target_net(b_next_obs).max(dim=1)[0]
374
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
375
+
376
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
377
+ loss = criterion(current_q, target_q)
378
+
379
+ optimizer.zero_grad()
380
+ loss.backward()
381
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
382
+ optimizer.step()
383
+
384
+ if args.track:
385
+ try:
386
+ import wandb
387
+ wandb.log({
388
+ "global_step": int(global_step),
389
+ "train/loss": float(loss.item()),
390
+ "charts/epsilon": float(epsilon),
391
+ "perf/SPS": int(global_step / (time.time() - start_time)),
392
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
393
+ }, step=global_step)
394
+ except Exception:
395
+ pass
396
+
397
+ # 结束时 Reset
398
+ if real_done:
399
+ succ = bool((info or {}).get('success', False))
400
+ ep_success_window.append(1.0 if succ else 0.0)
401
+ if len(ep_success_window) > 100:
402
+ ep_success_window.pop(0)
403
+ if args.track:
404
+ try:
405
+ import wandb
406
+ wandb.log({
407
+ "global_step": int(global_step),
408
+ "train/episodic_return": float(ep_return),
409
+ "train/episodic_length": int(ep_len),
410
+ "train/success": float(1.0 if succ else 0.0),
411
+ "train/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) >= 1 else None,
412
+ }, step=global_step)
413
+ except Exception:
414
+ pass
415
+ obs, _ = env.reset()
416
+ ep_return, ep_len = 0.0, 0
417
+
418
+ # 更新目标网络
419
+ if global_step % args.target_network_frequency == 0:
420
+ target_net.load_state_dict(policy_net.state_dict())
421
+
422
+ # 打印日志
423
+ if global_step % 1000 == 0:
424
+ sps = int(global_step / (time.time() - start_time))
425
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
426
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
427
+
428
+ # 评估
429
+ if global_step == 1 or (global_step % eval_every_steps == 0):
430
+ try:
431
+ def eval_thunk():
432
+ # 评估环境也同样设置:内部1000,外部20
433
+ return make_env(0, run_name, args.seed + 9999, args.scramble_depth, args.max_steps_env, False)()
434
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
435
+ if args.track:
436
+ try:
437
+ import wandb
438
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
439
+ if mpath.exists():
440
+ with mpath.open("r") as mf:
441
+ metrics = json.load(mf)
442
+ wandb.log({
443
+ "eval/success_rate": metrics.get("success_rate"),
444
+ "eval/avg_return": metrics.get("avg_return"),
445
+ "eval/std_return": metrics.get("std_return"),
446
+ "eval/episodes": metrics.get("episodes"),
447
+ }, step=global_step)
448
+ except Exception:
449
+ pass
450
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
451
+ except Exception as e:
452
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
453
+
454
+ env.close()
wandb/run-20260112_223856-d964bhe6/files/config.yaml ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.23.0
4
+ code_path: code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
5
+ e:
6
+ fv4797ph5nqwn56g5wjpnnfak73gdsee:
7
+ args:
8
+ - --track
9
+ codePath: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
10
+ codePathLocal: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
11
+ cpu_count: 64
12
+ cpu_count_logical: 128
13
+ cudaVersion: "13.0"
14
+ disk:
15
+ /:
16
+ total: "2576980377600"
17
+ used: "3724300288"
18
+ email: haoyu-wa22@mails.tsinghua.edu.cn
19
+ executable: /root/local/miniconda3/envs/ragen/bin/python
20
+ git:
21
+ commit: 8d73639b99b38265453f898b8d6af7d4af50d56e
22
+ remote: https://github.com/mll-lab-nu/RAGEN.git
23
+ gpu: NVIDIA H100 80GB HBM3
24
+ gpu_count: 4
25
+ gpu_nvidia:
26
+ - architecture: Hopper
27
+ cudaCores: 16896
28
+ memoryTotal: "85520809984"
29
+ name: NVIDIA H100 80GB HBM3
30
+ uuid: GPU-cff454b9-f118-535b-5e1f-6d503e78e52e
31
+ - architecture: Hopper
32
+ cudaCores: 16896
33
+ memoryTotal: "85520809984"
34
+ name: NVIDIA H100 80GB HBM3
35
+ uuid: GPU-9e77c178-188c-f869-780e-858c20a7d322
36
+ - architecture: Hopper
37
+ cudaCores: 16896
38
+ memoryTotal: "85520809984"
39
+ name: NVIDIA H100 80GB HBM3
40
+ uuid: GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9
41
+ - architecture: Hopper
42
+ cudaCores: 16896
43
+ memoryTotal: "85520809984"
44
+ name: NVIDIA H100 80GB HBM3
45
+ uuid: GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7
46
+ host: pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0
47
+ memory:
48
+ total: "2163639439360"
49
+ os: Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35
50
+ program: /mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
51
+ python: CPython 3.10.19
52
+ root: /mnt/general/wanghy/RAGEN
53
+ startedAt: "2026-01-12T14:38:56.780519Z"
54
+ writerId: fv4797ph5nqwn56g5wjpnnfak73gdsee
55
+ m:
56
+ - "1": global_step
57
+ "6":
58
+ - 3
59
+ "7": []
60
+ - "2": losses/*
61
+ "5": 1
62
+ "6":
63
+ - 1
64
+ "7": []
65
+ - "2": charts/*
66
+ "5": 1
67
+ "6":
68
+ - 1
69
+ "7": []
70
+ - "2": perf/*
71
+ "5": 1
72
+ "6":
73
+ - 1
74
+ "7": []
75
+ - "2": train/*
76
+ "5": 1
77
+ "6":
78
+ - 1
79
+ "7": []
80
+ - "2": rollout/*
81
+ "5": 1
82
+ "6":
83
+ - 1
84
+ "7": []
85
+ - "2": eval/*
86
+ "5": 1
87
+ "6":
88
+ - 1
89
+ "7": []
90
+ python_version: 3.10.19
91
+ t:
92
+ "1":
93
+ - 1
94
+ - 11
95
+ - 30
96
+ - 49
97
+ - 50
98
+ - 51
99
+ - 105
100
+ "2":
101
+ - 1
102
+ - 11
103
+ - 30
104
+ - 49
105
+ - 50
106
+ - 51
107
+ - 105
108
+ "3":
109
+ - 7
110
+ - 13
111
+ - 16
112
+ - 61
113
+ "4": 3.10.19
114
+ "5": 0.23.0
115
+ "6": 4.57.3
116
+ "12": 0.23.0
117
+ "13": linux-x86_64
118
+ batch_size:
119
+ value: 128
120
+ buffer_size:
121
+ value: 200000
122
+ capture_video:
123
+ value: false
124
+ cuda:
125
+ value: true
126
+ end_e:
127
+ value: 0.05
128
+ env_id:
129
+ value: RubiksCube2x2DQN
130
+ eval_episodes:
131
+ value: 4000
132
+ eval_splits:
133
+ value: 2
134
+ exp_name:
135
+ value: dqn_rubikscube
136
+ exploration_fraction:
137
+ value: 0.2
138
+ gamma:
139
+ value: 0.99
140
+ hidden_size:
141
+ value: 256
142
+ learning_rate:
143
+ value: 0.00025
144
+ learning_starts:
145
+ value: 5000
146
+ max_steps_env:
147
+ value: 20
148
+ scramble_depth:
149
+ value: 3
150
+ seed:
151
+ value: 1
152
+ start_e:
153
+ value: 1
154
+ target_network_frequency:
155
+ value: 4000
156
+ torch_deterministic:
157
+ value: true
158
+ total_timesteps:
159
+ value: 400000
160
+ track:
161
+ value: true
162
+ train_frequency:
163
+ value: 4
164
+ wandb_entity:
165
+ value: null
166
+ wandb_project_name:
167
+ value: cleanRL
wandb/run-20260112_223856-d964bhe6/files/diff.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_223856-d964bhe6/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_223856-d964bhe6/files/requirements.txt ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ colorama==0.4.6
2
+ psutil==7.1.3
3
+ ragen==0.1
4
+ Farama-Notifications==0.0.4
5
+ MarkupSafe==2.1.5
6
+ PyJWT==2.10.1
7
+ PySocks==1.7.1
8
+ absl-py==2.3.1
9
+ accelerate==1.12.0
10
+ aiohappyeyeballs==2.6.1
11
+ aiohttp==3.13.2
12
+ aiohttp-cors==0.8.1
13
+ aiosignal==1.4.0
14
+ airportsdata==20250909
15
+ annotated-doc==0.0.4
16
+ annotated-types==0.7.0
17
+ anthropic==0.75.0
18
+ antlr4-python3-runtime==4.9.3
19
+ anyio==4.12.0
20
+ astor==0.8.1
21
+ asttokens==3.0.1
22
+ async-timeout==5.0.1
23
+ attrs==25.4.0
24
+ beautifulsoup4==4.14.3
25
+ black==25.11.0
26
+ blake3==1.0.8
27
+ blinker==1.9.0
28
+ blis==1.3.3
29
+ cachetools==6.2.2
30
+ catalogue==2.0.10
31
+ certifi==2025.11.12
32
+ cffi==2.0.0
33
+ charset-normalizer==3.4.4
34
+ cleantext==1.1.4
35
+ click==8.2.1
36
+ cloudpathlib==0.23.0
37
+ cloudpickle==3.1.2
38
+ codetiming==1.4.0
39
+ colorama==0.4.6
40
+ coloredlogs==15.0.1
41
+ colorful==0.5.8
42
+ compressed-tensors==0.9.3
43
+ confection==0.1.5
44
+ contourpy==1.3.2
45
+ cryptography==46.0.3
46
+ cupy-cuda12x==13.6.0
47
+ cycler==0.12.1
48
+ cymem==2.0.13
49
+ Cython==3.2.2
50
+ datasets==4.4.1
51
+ debugpy==1.8.17
52
+ decorator==5.2.1
53
+ Deprecated==1.3.1
54
+ depyf==0.18.0
55
+ dill==0.4.0
56
+ diskcache==5.6.3
57
+ distlib==0.4.0
58
+ distro==1.9.0
59
+ dnspython==2.8.0
60
+ docstring_parser==0.17.0
61
+ einops==0.8.1
62
+ email-validator==2.3.0
63
+ eval_type_backport==0.2.2
64
+ exceptiongroup==1.3.1
65
+ executing==2.2.1
66
+ faiss-gpu==1.7.2
67
+ fastapi==0.123.1
68
+ fastapi-cli==0.0.16
69
+ fastapi-cloud-cli==0.5.2
70
+ fastar==0.8.0
71
+ fastrlock==0.8.3
72
+ filelock==3.19.1
73
+ flash_attn==2.8.3
74
+ Flask==3.1.2
75
+ flatbuffers==25.9.23
76
+ fonttools==4.61.0
77
+ frozenlist==1.8.0
78
+ fsspec==2025.9.0
79
+ gdown==5.2.0
80
+ gguf==0.17.1
81
+ gitdb==4.0.12
82
+ GitPython==3.1.45
83
+ google-api-core==2.28.1
84
+ google-auth==2.43.0
85
+ googleapis-common-protos==1.72.0
86
+ grpcio==1.76.0
87
+ gym==0.26.2
88
+ gym-notices==0.1.0
89
+ gym-sokoban==0.0.6
90
+ gymnasium==1.2.2
91
+ h11==0.16.0
92
+ hf-xet==1.2.0
93
+ html2text==2025.4.15
94
+ httpcore==1.0.9
95
+ httptools==0.7.1
96
+ httpx==0.28.1
97
+ httpx-sse==0.4.3
98
+ huggingface-hub==0.36.0
99
+ humanfriendly==10.0
100
+ hydra-core==1.3.2
101
+ idna==3.11
102
+ ImageIO==2.37.2
103
+ importlib_metadata==8.0.0
104
+ interegular==0.3.3
105
+ ipython==8.37.0
106
+ itsdangerous==2.2.0
107
+ jedi==0.19.2
108
+ Jinja2==3.1.6
109
+ jiter==0.12.0
110
+ joblib==1.5.2
111
+ jsonschema==4.25.1
112
+ jsonschema-specifications==2025.9.1
113
+ kimina-client==0.2.1
114
+ kiwisolver==1.4.9
115
+ lark==1.2.2
116
+ llguidance==0.7.30
117
+ llvmlite==0.44.0
118
+ lm-format-enforcer==0.10.12
119
+ loguru==0.7.3
120
+ Markdown==3.10
121
+ markdown-it-py==4.0.0
122
+ matplotlib==3.10.7
123
+ matplotlib-inline==0.2.1
124
+ mcp==1.22.0
125
+ mdurl==0.1.2
126
+ mistral_common==1.8.6
127
+ mpmath==1.3.0
128
+ msgpack==1.1.2
129
+ msgspec==0.20.0
130
+ multidict==6.7.0
131
+ multiprocess==0.70.18
132
+ murmurhash==1.0.15
133
+ mypy_extensions==1.1.0
134
+ nest-asyncio==1.6.0
135
+ networkx==3.3
136
+ ninja==1.13.0
137
+ nltk==3.9.2
138
+ numba==0.61.2
139
+ numpy==1.26.4
140
+ nvidia-cublas-cu12==12.4.5.8
141
+ nvidia-cuda-cupti-cu12==12.4.127
142
+ nvidia-cuda-nvrtc-cu12==12.4.127
143
+ nvidia-cuda-runtime-cu12==12.4.127
144
+ nvidia-cudnn-cu12==9.1.0.70
145
+ nvidia-cufft-cu12==11.2.1.3
146
+ nvidia-curand-cu12==10.3.5.147
147
+ nvidia-cusolver-cu12==11.6.1.9
148
+ nvidia-cusparse-cu12==12.3.1.170
149
+ nvidia-cusparselt-cu12==0.6.2
150
+ nvidia-nccl-cu12==2.21.5
151
+ nvidia-nvjitlink-cu12==12.4.127
152
+ nvidia-nvtx-cu12==12.4.127
153
+ omegaconf==2.3.0
154
+ onnxruntime==1.23.2
155
+ openai==2.8.1
156
+ opencensus==0.11.4
157
+ opencensus-context==0.1.3
158
+ opencv-python-headless==4.12.0.88
159
+ opentelemetry-api==1.38.0
160
+ opentelemetry-exporter-otlp==1.26.0
161
+ opentelemetry-exporter-otlp-proto-common==1.26.0
162
+ opentelemetry-exporter-otlp-proto-grpc==1.26.0
163
+ opentelemetry-exporter-otlp-proto-http==1.26.0
164
+ opentelemetry-exporter-prometheus==0.59b0
165
+ opentelemetry-proto==1.26.0
166
+ opentelemetry-sdk==1.38.0
167
+ opentelemetry-semantic-conventions==0.59b0
168
+ opentelemetry-semantic-conventions-ai==0.4.13
169
+ orjson==3.11.4
170
+ outlines==0.1.11
171
+ outlines_core==0.1.26
172
+ packaging==25.0
173
+ pandas==2.3.3
174
+ parso==0.8.5
175
+ partial-json-parser==0.2.1.1.post7
176
+ pathspec==0.12.1
177
+ peft==0.18.0
178
+ pexpect==4.9.0
179
+ pillow==11.3.0
180
+ pip==25.3
181
+ platformdirs==4.5.0
182
+ preshed==3.0.12
183
+ prometheus_client==0.23.1
184
+ prometheus-fastapi-instrumentator==7.1.0
185
+ prompt_toolkit==3.0.52
186
+ propcache==0.4.1
187
+ proto-plus==1.26.1
188
+ protobuf==4.25.8
189
+ psutil==7.1.3
190
+ ptyprocess==0.7.0
191
+ pure_eval==0.2.3
192
+ py-cpuinfo==9.0.0
193
+ py-spy==0.4.1
194
+ pyarrow==22.0.0
195
+ pyasn1==0.6.1
196
+ pyasn1_modules==0.4.2
197
+ pybind11==3.0.1
198
+ pycountry==24.6.1
199
+ pycparser==2.23
200
+ pydantic==2.12.5
201
+ pydantic_core==2.41.5
202
+ pydantic-extra-types==2.10.6
203
+ pydantic-settings==2.12.0
204
+ pygame==2.6.1
205
+ Pygments==2.19.2
206
+ pyjnius==1.7.0
207
+ pylatexenc==2.10
208
+ pyparsing==3.2.5
209
+ pyserini==1.2.0
210
+ python-dateutil==2.9.0.post0
211
+ python-dotenv==1.2.1
212
+ python-json-logger==4.0.0
213
+ python-multipart==0.0.20
214
+ pytokens==0.3.0
215
+ pytz==2025.2
216
+ PyYAML==6.0.3
217
+ pyzmq==27.1.0
218
+ ragen==0.1
219
+ rank-bm25==0.2.2
220
+ RapidFuzz==3.14.3
221
+ ray==2.52.1
222
+ referencing==0.37.0
223
+ regex==2025.11.3
224
+ requests==2.32.5
225
+ rich==14.2.0
226
+ rich-toolkit==0.17.0
227
+ rignore==0.7.6
228
+ rpds-py==0.30.0
229
+ rsa==4.9.1
230
+ safetensors==0.7.0
231
+ scikit-learn==1.7.2
232
+ scipy==1.15.3
233
+ sentencepiece==0.2.1
234
+ sentry-sdk==2.46.0
235
+ setuptools==80.9.0
236
+ shellingham==1.5.4
237
+ six==1.17.0
238
+ smart_open==7.5.0
239
+ smmap==5.0.2
240
+ sniffio==1.3.1
241
+ soupsieve==2.8
242
+ spacy==3.8.11
243
+ spacy-legacy==3.0.12
244
+ spacy-loggers==1.0.5
245
+ srsly==2.5.2
246
+ sse-starlette==3.0.3
247
+ stack-data==0.6.3
248
+ starlette==0.50.0
249
+ sympy==1.13.1
250
+ tabulate==0.9.0
251
+ tenacity==9.1.2
252
+ tensorboard==2.20.0
253
+ tensorboard-data-server==0.7.2
254
+ tensordict==0.8.3
255
+ thefuzz==0.22.1
256
+ thinc==8.3.10
257
+ threadpoolctl==3.6.0
258
+ tiktoken==0.12.0
259
+ together==1.5.31
260
+ tokenizers==0.22.1
261
+ tomli==2.3.0
262
+ torch==2.6.0+cu124
263
+ torchaudio==2.6.0
264
+ torchdata==0.11.0
265
+ torchvision==0.21.0
266
+ tqdm==4.67.1
267
+ traitlets==5.14.3
268
+ transformers==4.57.3
269
+ triton==3.2.0
270
+ typer==0.19.2
271
+ typer-slim==0.20.0
272
+ typing_extensions==4.15.0
273
+ typing-inspection==0.4.2
274
+ tzdata==2025.2
275
+ urllib3==2.5.0
276
+ uvicorn==0.38.0
277
+ uvloop==0.22.1
278
+ verl==0.5.0.dev0
279
+ virtualenv==20.35.4
280
+ vllm==0.8.5
281
+ wandb==0.23.0
282
+ wasabi==1.1.3
283
+ watchfiles==1.1.1
284
+ wcwidth==0.2.14
285
+ weasel==0.4.3
286
+ websockets==15.0.1
287
+ Werkzeug==3.1.4
288
+ wheel==0.45.1
289
+ wrapt==2.0.1
290
+ xformers==0.0.29.post2
291
+ xgrammar==0.1.18
292
+ xxhash==3.6.0
293
+ yarl==1.22.0
294
+ zipp==3.23.0
295
+ typeguard==4.4.4
296
+ tyro==1.0.3
297
+ verl==0.5.0.dev0
298
+ autocommand==2.2.2
299
+ backports.tarfile==1.2.0
300
+ importlib_metadata==8.0.0
301
+ inflect==7.3.1
302
+ jaraco.collections==5.1.0
303
+ jaraco.context==5.3.0
304
+ jaraco.functools==4.0.1
305
+ jaraco.text==3.12.1
306
+ more-itertools==10.3.0
307
+ packaging==24.2
308
+ platformdirs==4.2.2
309
+ tomli==2.0.1
310
+ typeguard==4.3.0
311
+ typing_extensions==4.12.2
312
+ wheel==0.45.1
313
+ zipp==3.19.2
wandb/run-20260112_223856-d964bhe6/files/wandb-metadata.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35",
3
+ "python": "CPython 3.10.19",
4
+ "startedAt": "2026-01-12T14:38:56.780519Z",
5
+ "args": [
6
+ "--track"
7
+ ],
8
+ "program": "/mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
9
+ "codePath": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
10
+ "codePathLocal": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
11
+ "git": {
12
+ "remote": "https://github.com/mll-lab-nu/RAGEN.git",
13
+ "commit": "8d73639b99b38265453f898b8d6af7d4af50d56e"
14
+ },
15
+ "email": "haoyu-wa22@mails.tsinghua.edu.cn",
16
+ "root": "/mnt/general/wanghy/RAGEN",
17
+ "host": "pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0",
18
+ "executable": "/root/local/miniconda3/envs/ragen/bin/python",
19
+ "cpu_count": 64,
20
+ "cpu_count_logical": 128,
21
+ "gpu": "NVIDIA H100 80GB HBM3",
22
+ "gpu_count": 4,
23
+ "disk": {
24
+ "/": {
25
+ "total": "2576980377600",
26
+ "used": "3724300288"
27
+ }
28
+ },
29
+ "memory": {
30
+ "total": "2163639439360"
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper",
38
+ "uuid": "GPU-cff454b9-f118-535b-5e1f-6d503e78e52e"
39
+ },
40
+ {
41
+ "name": "NVIDIA H100 80GB HBM3",
42
+ "memoryTotal": "85520809984",
43
+ "cudaCores": 16896,
44
+ "architecture": "Hopper",
45
+ "uuid": "GPU-9e77c178-188c-f869-780e-858c20a7d322"
46
+ },
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper",
52
+ "uuid": "GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9"
53
+ },
54
+ {
55
+ "name": "NVIDIA H100 80GB HBM3",
56
+ "memoryTotal": "85520809984",
57
+ "cudaCores": 16896,
58
+ "architecture": "Hopper",
59
+ "uuid": "GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7"
60
+ }
61
+ ],
62
+ "cudaVersion": "13.0",
63
+ "writerId": "fv4797ph5nqwn56g5wjpnnfak73gdsee"
64
+ }
wandb/run-20260112_223856-d964bhe6/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"charts/epsilon":0.05,"train/episodic_return":-0.4000000000000001,"_timestamp":1.7682289096790524e+09,"train/success_rate_100":0.04,"train/loss":0.012717867270112038,"train/success":0,"global_step":99692,"_step":99692,"eval/avg_return":-0.3364750000000001,"eval/success_rate":0.04625,"train/learning_rate":0.00025,"_runtime":171.599183111,"train/episodic_length":20,"perf/SPS":596,"_wandb":{"runtime":171},"eval/episodes":4000,"eval/std_return":0.2884910299732038}
wandb/run-20260112_224209-62o99t0u/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Step Penalty & Time Limit Bootstrap for RAGEN Rubik's Cube 2x2
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+ import re
10
+
11
+ import gymnasium as gym
12
+ import numpy as np
13
+ import torch
14
+ import torch.nn as nn
15
+ import torch.optim as optim
16
+ import tyro
17
+
18
+ import sys
19
+ # 假设 ragen 库在当前目录的上两级,请根据实际情况调整
20
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
21
+
22
+ from ragen.env.rubikscube.env import RubiksCube2x2Env
23
+ from ragen.env.rubikscube.config import RubiksCube2x2Config
24
+
25
+
26
+ class RubiksCubeWrapper(gym.Env):
27
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
28
+
29
+ def __init__(self, env: RubiksCube2x2Env):
30
+ super().__init__()
31
+ self._env = env
32
+ self._colors = ['W', 'O', 'G', 'R', 'B', 'Y']
33
+ self._color_to_idx = {c: i for i, c in enumerate(self._colors)}
34
+ self.observation_space = gym.spaces.Box(low=0.0, high=1.0, shape=(24 * len(self._colors),), dtype=np.float32)
35
+ self.action_space = gym.spaces.Discrete(12)
36
+ self._face_pat = re.compile(r"\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])\n\s*\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])")
37
+
38
+ # [关键修改] 每步惩罚
39
+ # 如果20步都没解出来,累计惩罚是 20 * -0.05 = -1.0,抵消掉最后可能获得的 +1.0
40
+ # 这迫使 agent 寻找更短路径
41
+ self.step_penalty = -0.045
42
+
43
+ def _encode_obs(self, text_obs: str) -> np.ndarray:
44
+ faces_order = ["Up (U):", "Left (L):", "Front (F):", "Right (R):", "Back (B):", "Down (D):"]
45
+ lines = text_obs.splitlines()
46
+ blocks: List[str] = []
47
+ i = 0
48
+ while i < len(lines):
49
+ line = lines[i]
50
+ for header in faces_order:
51
+ if line.startswith(header):
52
+ content = line[len(header):].strip()
53
+ next_line = lines[i + 1] if i + 1 < len(lines) else ""
54
+ block = f"{content}\n{next_line}"
55
+ blocks.append(block)
56
+ break
57
+ i += 1
58
+ if len(blocks) != 6:
59
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
60
+ stickers: List[int] = []
61
+ for blk in blocks:
62
+ m = self._face_pat.search(blk)
63
+ if not m:
64
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
65
+ c0, c1, c2, c3 = m.group(1), m.group(2), m.group(3), m.group(4)
66
+ stickers.extend([c0, c1, c2, c3])
67
+ grid = np.zeros((24, len(self._colors)), dtype=np.float32)
68
+ for idx, ch in enumerate(stickers):
69
+ cidx = self._color_to_idx.get(ch, None)
70
+ if cidx is not None:
71
+ grid[idx, cidx] = 1.0
72
+ return grid.reshape(-1)
73
+
74
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
75
+ text_obs = self._env.reset(seed=seed)
76
+ obs = self._encode_obs(text_obs)
77
+ return obs, {}
78
+
79
+ def step(self, action: int):
80
+ mapped = int(action) + 1
81
+ text_obs, reward, done, info = self._env.step(mapped)
82
+ obs = self._encode_obs(text_obs)
83
+ terminated = bool(done)
84
+ truncated = False
85
+
86
+ # [关键修改] 应用惩罚
87
+ # 此时 reward 包含原本的稀疏奖励 (0 或 1) 加上每步惩罚
88
+ reward = float(reward) + self.step_penalty
89
+
90
+ return obs, reward, terminated, truncated, info or {}
91
+
92
+ def render(self):
93
+ return self._env.render()
94
+
95
+ def close(self):
96
+ self._env.close()
97
+
98
+
99
+ @dataclass
100
+ class Args:
101
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
102
+ seed: int = 1
103
+ torch_deterministic: bool = True
104
+ cuda: bool = True
105
+ track: bool = True
106
+ wandb_project_name: str = "cleanRL"
107
+ wandb_entity: str | None = None
108
+ capture_video: bool = False
109
+
110
+ # Algorithm
111
+ env_id: str = "RubiksCube2x2DQN"
112
+ total_timesteps: int = 400_000
113
+ learning_rate: float = 2.5e-4
114
+ gamma: float = 0.99
115
+ batch_size: int = 128
116
+ buffer_size: int = 200_000
117
+ target_network_frequency: int = 4000
118
+ train_frequency: int = 4
119
+ learning_starts: int = 5000
120
+
121
+ # Epsilon-greedy
122
+ start_e: float = 1.0
123
+ end_e: float = 0.05
124
+ exploration_fraction: float = 0.2
125
+
126
+ # Model size
127
+ hidden_size: int = 256
128
+
129
+ # Rubik specific
130
+ scramble_depth: int = 3 # 初始难度
131
+ max_steps_env: int = 20 # 硬性时间限制
132
+
133
+ # Eval
134
+ eval_splits: int = 2
135
+ eval_episodes: int = 4000
136
+
137
+
138
+ def make_env(idx, run_name, seed, scramble_depth, max_steps_env, capture_video=False):
139
+ def thunk():
140
+ # [关键修改] 内部 max_steps 设为 1000,防止 env 内部发出 done=True
141
+ # 我们完全依赖外部 TimeLimit wrapper 来处理超时
142
+ config = RubiksCube2x2Config(scramble_depth=scramble_depth, max_steps=20, render_mode='text')
143
+ env = RubiksCube2x2Env(config)
144
+ env = RubiksCubeWrapper(env)
145
+ # 外部限制设为 20
146
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps_env)
147
+ env = gym.wrappers.RecordEpisodeStatistics(env)
148
+ if capture_video and idx == 0:
149
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
150
+ return env
151
+ return thunk
152
+
153
+
154
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
155
+ torch.nn.init.orthogonal_(layer.weight, std)
156
+ torch.nn.init.constant_(layer.bias, bias_const)
157
+ return layer
158
+
159
+
160
+ class QNetwork(nn.Module):
161
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
162
+ super().__init__()
163
+ self.net = nn.Sequential(
164
+ layer_init(nn.Linear(obs_dim, hidden)),
165
+ nn.ReLU(),
166
+ layer_init(nn.Linear(hidden, hidden)),
167
+ nn.ReLU(),
168
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
169
+ )
170
+
171
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
172
+ return self.net(x)
173
+
174
+
175
+ class ReplayBuffer:
176
+ def __init__(self, capacity: int, obs_shape: Tuple[int, ...]):
177
+ self.capacity = capacity
178
+ self.ptr = 0
179
+ self.full = False
180
+ self.obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
181
+ self.next_obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
182
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
183
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
184
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
185
+
186
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
187
+ i = self.ptr
188
+ self.obs_buf[i] = obs
189
+ self.next_obs_buf[i] = next_obs
190
+ self.act_buf[i] = act
191
+ self.rew_buf[i] = rew
192
+ self.done_buf[i] = 1.0 if done else 0.0
193
+ self.ptr = (self.ptr + 1) % self.capacity
194
+ if self.ptr == 0:
195
+ self.full = True
196
+
197
+ def can_sample(self, batch_size: int) -> bool:
198
+ return (self.capacity if self.full else self.ptr) >= batch_size
199
+
200
+ def sample(self, batch_size: int):
201
+ size = self.capacity if self.full else self.ptr
202
+ idxs = np.random.randint(0, size, size=batch_size)
203
+ return (
204
+ self.obs_buf[idxs],
205
+ self.act_buf[idxs],
206
+ self.rew_buf[idxs],
207
+ self.done_buf[idxs],
208
+ self.next_obs_buf[idxs],
209
+ )
210
+
211
+
212
+ if __name__ == "__main__":
213
+ args = tyro.cli(Args)
214
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
215
+
216
+ if args.track:
217
+ import wandb
218
+ wandb.init(
219
+ project=args.wandb_project_name,
220
+ entity=args.wandb_entity,
221
+ config=vars(args),
222
+ name=run_name,
223
+ monitor_gym=True,
224
+ save_code=True,
225
+ )
226
+ try:
227
+ wandb.define_metric("global_step")
228
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
229
+ wandb.define_metric(prefix, step_metric="global_step")
230
+ except Exception:
231
+ pass
232
+
233
+ random.seed(args.seed)
234
+ np.random.seed(args.seed)
235
+ torch.manual_seed(args.seed)
236
+ torch.backends.cudnn.deterministic = args.torch_deterministic
237
+
238
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
239
+
240
+ env = make_env(0, run_name, args.seed, args.scramble_depth, args.max_steps_env, args.capture_video)()
241
+ obs_shape = env.observation_space.shape
242
+ act_dim = env.action_space.n
243
+
244
+ policy_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
245
+ target_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
246
+ target_net.load_state_dict(policy_net.state_dict())
247
+ target_net.eval()
248
+
249
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
250
+ criterion = nn.SmoothL1Loss()
251
+
252
+ rb = ReplayBuffer(args.buffer_size, obs_shape)
253
+
254
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
255
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
256
+
257
+ # 评估函数
258
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
259
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
260
+ out_dir.mkdir(parents=True, exist_ok=True)
261
+ out_path = out_dir / "trajectories.jsonl"
262
+ env_eval = make_env_fn()
263
+ collected = 0
264
+ summary_returns = []
265
+ summary_success = []
266
+ with out_path.open("w") as f:
267
+ while collected < n_episodes:
268
+ state, _ = env_eval.reset(seed=args.seed + 100000 + collected)
269
+ traj_states = [np.asarray(state).tolist()]
270
+ traj_actions = []
271
+ traj_rewards = []
272
+ traj_dones = []
273
+ traj_success = []
274
+ done = False
275
+ step_count = 0
276
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.max_steps_env)
277
+ while not done:
278
+ with torch.no_grad():
279
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
280
+ action = int(torch.argmax(q, dim=1).item())
281
+ next_state, reward, terminated, truncated, info = env_eval.step(action)
282
+
283
+ traj_actions.append(int(action))
284
+ traj_rewards.append(float(reward))
285
+ step_count += 1
286
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
287
+ traj_dones.append(d)
288
+ traj_success.append(bool((info or {}).get('success', False)))
289
+ state = next_state
290
+ traj_states.append(np.asarray(state).tolist())
291
+ done = d
292
+ ep_ret = float(sum(traj_rewards))
293
+ ep_succ = bool(any(traj_success))
294
+ record = {
295
+ "states": traj_states,
296
+ "actions": traj_actions,
297
+ "rewards": traj_rewards,
298
+ "dones": traj_dones,
299
+ "success": traj_success,
300
+ "episode_return": ep_ret,
301
+ "episode_success": ep_succ,
302
+ }
303
+ f.write(json.dumps(record) + "\n")
304
+ collected += 1
305
+ summary_returns.append(ep_ret)
306
+ summary_success.append(1.0 if ep_succ else 0.0)
307
+ env_eval.close()
308
+ try:
309
+ metrics = {
310
+ "global_step": int(step_tag),
311
+ "episodes": int(n_episodes),
312
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
313
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
314
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
315
+ }
316
+ with (out_dir / "metrics.json").open("w") as mf:
317
+ json.dump(metrics, mf)
318
+ except Exception as e:
319
+ print(f"Warning: failed to write eval metrics: {e}")
320
+
321
+ # 主训练循环
322
+ global_step = 0
323
+ start_time = time.time()
324
+
325
+ obs, _ = env.reset(seed=args.seed)
326
+ ep_return = 0.0
327
+ ep_len = 0
328
+ ep_success_window: List[float] = []
329
+
330
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
331
+
332
+ while global_step < args.total_timesteps:
333
+ epsilon = epsilon_by_step(global_step)
334
+ if np.random.rand() < epsilon or global_step < args.learning_starts:
335
+ action = env.action_space.sample()
336
+ else:
337
+ with torch.no_grad():
338
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
339
+ action = int(torch.argmax(q_values, dim=1).item())
340
+
341
+ next_obs, reward, terminated, truncated, info = env.step(action)
342
+
343
+ # 判断是否需要 Reset (任何结束都 Reset)
344
+ real_done = bool(terminated) or bool(truncated)
345
+
346
+ # [核心逻辑]
347
+ # 1. 即使是 truncated (超时),done 也记为 False,以便进行 bootstrap (计算未来价值)
348
+ # 2. 只有 terminated (真正解开了),done 才记为 True
349
+ # 3. Step Penalty 已经包含在 reward 中,DQN 会学到"为了避免扣分,必须在未来几步内解决"
350
+ rb.add(
351
+ obs.astype(np.float32),
352
+ int(action),
353
+ float(reward),
354
+ bool(terminated), # 注意:只用 terminated
355
+ next_obs.astype(np.float32)
356
+ )
357
+
358
+ obs = next_obs
359
+ ep_return += float(reward)
360
+ ep_len += 1
361
+ global_step += 1
362
+
363
+ # 训练过程
364
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
365
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
366
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
367
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
368
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
369
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
370
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
371
+
372
+ with torch.no_grad():
373
+ next_q = target_net(b_next_obs).max(dim=1)[0]
374
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
375
+
376
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
377
+ loss = criterion(current_q, target_q)
378
+
379
+ optimizer.zero_grad()
380
+ loss.backward()
381
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
382
+ optimizer.step()
383
+
384
+ if args.track:
385
+ try:
386
+ import wandb
387
+ wandb.log({
388
+ "global_step": int(global_step),
389
+ "train/loss": float(loss.item()),
390
+ "charts/epsilon": float(epsilon),
391
+ "perf/SPS": int(global_step / (time.time() - start_time)),
392
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
393
+ }, step=global_step)
394
+ except Exception:
395
+ pass
396
+
397
+ # 结束时 Reset
398
+ if real_done:
399
+ succ = bool((info or {}).get('success', False))
400
+ ep_success_window.append(1.0 if succ else 0.0)
401
+ if len(ep_success_window) > 100:
402
+ ep_success_window.pop(0)
403
+ if args.track:
404
+ try:
405
+ import wandb
406
+ wandb.log({
407
+ "global_step": int(global_step),
408
+ "train/episodic_return": float(ep_return),
409
+ "train/episodic_length": int(ep_len),
410
+ "train/success": float(1.0 if succ else 0.0),
411
+ "train/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) >= 1 else None,
412
+ }, step=global_step)
413
+ except Exception:
414
+ pass
415
+ obs, _ = env.reset()
416
+ ep_return, ep_len = 0.0, 0
417
+
418
+ # 更新目标网络
419
+ if global_step % args.target_network_frequency == 0:
420
+ target_net.load_state_dict(policy_net.state_dict())
421
+
422
+ # 打印日志
423
+ if global_step % 1000 == 0:
424
+ sps = int(global_step / (time.time() - start_time))
425
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
426
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
427
+
428
+ # 评估
429
+ if global_step == 1 or (global_step % eval_every_steps == 0):
430
+ try:
431
+ def eval_thunk():
432
+ # 评估环境也同样设置:内部1000,外部20
433
+ return make_env(0, run_name, args.seed + 9999, args.scramble_depth, args.max_steps_env, False)()
434
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
435
+ if args.track:
436
+ try:
437
+ import wandb
438
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
439
+ if mpath.exists():
440
+ with mpath.open("r") as mf:
441
+ metrics = json.load(mf)
442
+ wandb.log({
443
+ "eval/success_rate": metrics.get("success_rate"),
444
+ "eval/avg_return": metrics.get("avg_return"),
445
+ "eval/std_return": metrics.get("std_return"),
446
+ "eval/episodes": metrics.get("episodes"),
447
+ }, step=global_step)
448
+ except Exception:
449
+ pass
450
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
451
+ except Exception as e:
452
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
453
+
454
+ env.close()
wandb/run-20260112_224209-62o99t0u/files/config.yaml ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.23.0
4
+ code_path: code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
5
+ e:
6
+ 35ar29uupah1ktpgjn4djl5xx5ow78o3:
7
+ args:
8
+ - --track
9
+ codePath: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
10
+ codePathLocal: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
11
+ cpu_count: 64
12
+ cpu_count_logical: 128
13
+ cudaVersion: "13.0"
14
+ disk:
15
+ /:
16
+ total: "2576980377600"
17
+ used: "3724304384"
18
+ email: haoyu-wa22@mails.tsinghua.edu.cn
19
+ executable: /root/local/miniconda3/envs/ragen/bin/python
20
+ git:
21
+ commit: 8d73639b99b38265453f898b8d6af7d4af50d56e
22
+ remote: https://github.com/mll-lab-nu/RAGEN.git
23
+ gpu: NVIDIA H100 80GB HBM3
24
+ gpu_count: 4
25
+ gpu_nvidia:
26
+ - architecture: Hopper
27
+ cudaCores: 16896
28
+ memoryTotal: "85520809984"
29
+ name: NVIDIA H100 80GB HBM3
30
+ uuid: GPU-cff454b9-f118-535b-5e1f-6d503e78e52e
31
+ - architecture: Hopper
32
+ cudaCores: 16896
33
+ memoryTotal: "85520809984"
34
+ name: NVIDIA H100 80GB HBM3
35
+ uuid: GPU-9e77c178-188c-f869-780e-858c20a7d322
36
+ - architecture: Hopper
37
+ cudaCores: 16896
38
+ memoryTotal: "85520809984"
39
+ name: NVIDIA H100 80GB HBM3
40
+ uuid: GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9
41
+ - architecture: Hopper
42
+ cudaCores: 16896
43
+ memoryTotal: "85520809984"
44
+ name: NVIDIA H100 80GB HBM3
45
+ uuid: GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7
46
+ host: pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0
47
+ memory:
48
+ total: "2163639439360"
49
+ os: Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35
50
+ program: /mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
51
+ python: CPython 3.10.19
52
+ root: /mnt/general/wanghy/RAGEN
53
+ startedAt: "2026-01-12T14:42:09.125131Z"
54
+ writerId: 35ar29uupah1ktpgjn4djl5xx5ow78o3
55
+ m:
56
+ - "1": global_step
57
+ "6":
58
+ - 3
59
+ "7": []
60
+ - "2": perf/*
61
+ "5": 1
62
+ "6":
63
+ - 1
64
+ "7": []
65
+ - "2": train/*
66
+ "5": 1
67
+ "6":
68
+ - 1
69
+ "7": []
70
+ - "2": rollout/*
71
+ "5": 1
72
+ "6":
73
+ - 1
74
+ "7": []
75
+ - "2": eval/*
76
+ "5": 1
77
+ "6":
78
+ - 1
79
+ "7": []
80
+ - "2": losses/*
81
+ "5": 1
82
+ "6":
83
+ - 1
84
+ "7": []
85
+ - "2": charts/*
86
+ "5": 1
87
+ "6":
88
+ - 1
89
+ "7": []
90
+ python_version: 3.10.19
91
+ t:
92
+ "1":
93
+ - 1
94
+ - 11
95
+ - 30
96
+ - 49
97
+ - 50
98
+ - 51
99
+ - 105
100
+ "2":
101
+ - 1
102
+ - 11
103
+ - 30
104
+ - 49
105
+ - 50
106
+ - 51
107
+ - 105
108
+ "3":
109
+ - 7
110
+ - 13
111
+ - 16
112
+ - 61
113
+ "4": 3.10.19
114
+ "5": 0.23.0
115
+ "6": 4.57.3
116
+ "12": 0.23.0
117
+ "13": linux-x86_64
118
+ batch_size:
119
+ value: 128
120
+ buffer_size:
121
+ value: 200000
122
+ capture_video:
123
+ value: false
124
+ cuda:
125
+ value: true
126
+ end_e:
127
+ value: 0.05
128
+ env_id:
129
+ value: RubiksCube2x2DQN
130
+ eval_episodes:
131
+ value: 4000
132
+ eval_splits:
133
+ value: 2
134
+ exp_name:
135
+ value: dqn_rubikscube
136
+ exploration_fraction:
137
+ value: 0.2
138
+ gamma:
139
+ value: 0.99
140
+ hidden_size:
141
+ value: 256
142
+ learning_rate:
143
+ value: 0.00025
144
+ learning_starts:
145
+ value: 5000
146
+ max_steps_env:
147
+ value: 20
148
+ scramble_depth:
149
+ value: 3
150
+ seed:
151
+ value: 1
152
+ start_e:
153
+ value: 1
154
+ target_network_frequency:
155
+ value: 4000
156
+ torch_deterministic:
157
+ value: true
158
+ total_timesteps:
159
+ value: 400000
160
+ track:
161
+ value: true
162
+ train_frequency:
163
+ value: 4
164
+ wandb_entity:
165
+ value: null
166
+ wandb_project_name:
167
+ value: cleanRL
wandb/run-20260112_224209-62o99t0u/files/diff.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_224209-62o99t0u/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_224209-62o99t0u/files/requirements.txt ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ colorama==0.4.6
2
+ psutil==7.1.3
3
+ ragen==0.1
4
+ Farama-Notifications==0.0.4
5
+ MarkupSafe==2.1.5
6
+ PyJWT==2.10.1
7
+ PySocks==1.7.1
8
+ absl-py==2.3.1
9
+ accelerate==1.12.0
10
+ aiohappyeyeballs==2.6.1
11
+ aiohttp==3.13.2
12
+ aiohttp-cors==0.8.1
13
+ aiosignal==1.4.0
14
+ airportsdata==20250909
15
+ annotated-doc==0.0.4
16
+ annotated-types==0.7.0
17
+ anthropic==0.75.0
18
+ antlr4-python3-runtime==4.9.3
19
+ anyio==4.12.0
20
+ astor==0.8.1
21
+ asttokens==3.0.1
22
+ async-timeout==5.0.1
23
+ attrs==25.4.0
24
+ beautifulsoup4==4.14.3
25
+ black==25.11.0
26
+ blake3==1.0.8
27
+ blinker==1.9.0
28
+ blis==1.3.3
29
+ cachetools==6.2.2
30
+ catalogue==2.0.10
31
+ certifi==2025.11.12
32
+ cffi==2.0.0
33
+ charset-normalizer==3.4.4
34
+ cleantext==1.1.4
35
+ click==8.2.1
36
+ cloudpathlib==0.23.0
37
+ cloudpickle==3.1.2
38
+ codetiming==1.4.0
39
+ colorama==0.4.6
40
+ coloredlogs==15.0.1
41
+ colorful==0.5.8
42
+ compressed-tensors==0.9.3
43
+ confection==0.1.5
44
+ contourpy==1.3.2
45
+ cryptography==46.0.3
46
+ cupy-cuda12x==13.6.0
47
+ cycler==0.12.1
48
+ cymem==2.0.13
49
+ Cython==3.2.2
50
+ datasets==4.4.1
51
+ debugpy==1.8.17
52
+ decorator==5.2.1
53
+ Deprecated==1.3.1
54
+ depyf==0.18.0
55
+ dill==0.4.0
56
+ diskcache==5.6.3
57
+ distlib==0.4.0
58
+ distro==1.9.0
59
+ dnspython==2.8.0
60
+ docstring_parser==0.17.0
61
+ einops==0.8.1
62
+ email-validator==2.3.0
63
+ eval_type_backport==0.2.2
64
+ exceptiongroup==1.3.1
65
+ executing==2.2.1
66
+ faiss-gpu==1.7.2
67
+ fastapi==0.123.1
68
+ fastapi-cli==0.0.16
69
+ fastapi-cloud-cli==0.5.2
70
+ fastar==0.8.0
71
+ fastrlock==0.8.3
72
+ filelock==3.19.1
73
+ flash_attn==2.8.3
74
+ Flask==3.1.2
75
+ flatbuffers==25.9.23
76
+ fonttools==4.61.0
77
+ frozenlist==1.8.0
78
+ fsspec==2025.9.0
79
+ gdown==5.2.0
80
+ gguf==0.17.1
81
+ gitdb==4.0.12
82
+ GitPython==3.1.45
83
+ google-api-core==2.28.1
84
+ google-auth==2.43.0
85
+ googleapis-common-protos==1.72.0
86
+ grpcio==1.76.0
87
+ gym==0.26.2
88
+ gym-notices==0.1.0
89
+ gym-sokoban==0.0.6
90
+ gymnasium==1.2.2
91
+ h11==0.16.0
92
+ hf-xet==1.2.0
93
+ html2text==2025.4.15
94
+ httpcore==1.0.9
95
+ httptools==0.7.1
96
+ httpx==0.28.1
97
+ httpx-sse==0.4.3
98
+ huggingface-hub==0.36.0
99
+ humanfriendly==10.0
100
+ hydra-core==1.3.2
101
+ idna==3.11
102
+ ImageIO==2.37.2
103
+ importlib_metadata==8.0.0
104
+ interegular==0.3.3
105
+ ipython==8.37.0
106
+ itsdangerous==2.2.0
107
+ jedi==0.19.2
108
+ Jinja2==3.1.6
109
+ jiter==0.12.0
110
+ joblib==1.5.2
111
+ jsonschema==4.25.1
112
+ jsonschema-specifications==2025.9.1
113
+ kimina-client==0.2.1
114
+ kiwisolver==1.4.9
115
+ lark==1.2.2
116
+ llguidance==0.7.30
117
+ llvmlite==0.44.0
118
+ lm-format-enforcer==0.10.12
119
+ loguru==0.7.3
120
+ Markdown==3.10
121
+ markdown-it-py==4.0.0
122
+ matplotlib==3.10.7
123
+ matplotlib-inline==0.2.1
124
+ mcp==1.22.0
125
+ mdurl==0.1.2
126
+ mistral_common==1.8.6
127
+ mpmath==1.3.0
128
+ msgpack==1.1.2
129
+ msgspec==0.20.0
130
+ multidict==6.7.0
131
+ multiprocess==0.70.18
132
+ murmurhash==1.0.15
133
+ mypy_extensions==1.1.0
134
+ nest-asyncio==1.6.0
135
+ networkx==3.3
136
+ ninja==1.13.0
137
+ nltk==3.9.2
138
+ numba==0.61.2
139
+ numpy==1.26.4
140
+ nvidia-cublas-cu12==12.4.5.8
141
+ nvidia-cuda-cupti-cu12==12.4.127
142
+ nvidia-cuda-nvrtc-cu12==12.4.127
143
+ nvidia-cuda-runtime-cu12==12.4.127
144
+ nvidia-cudnn-cu12==9.1.0.70
145
+ nvidia-cufft-cu12==11.2.1.3
146
+ nvidia-curand-cu12==10.3.5.147
147
+ nvidia-cusolver-cu12==11.6.1.9
148
+ nvidia-cusparse-cu12==12.3.1.170
149
+ nvidia-cusparselt-cu12==0.6.2
150
+ nvidia-nccl-cu12==2.21.5
151
+ nvidia-nvjitlink-cu12==12.4.127
152
+ nvidia-nvtx-cu12==12.4.127
153
+ omegaconf==2.3.0
154
+ onnxruntime==1.23.2
155
+ openai==2.8.1
156
+ opencensus==0.11.4
157
+ opencensus-context==0.1.3
158
+ opencv-python-headless==4.12.0.88
159
+ opentelemetry-api==1.38.0
160
+ opentelemetry-exporter-otlp==1.26.0
161
+ opentelemetry-exporter-otlp-proto-common==1.26.0
162
+ opentelemetry-exporter-otlp-proto-grpc==1.26.0
163
+ opentelemetry-exporter-otlp-proto-http==1.26.0
164
+ opentelemetry-exporter-prometheus==0.59b0
165
+ opentelemetry-proto==1.26.0
166
+ opentelemetry-sdk==1.38.0
167
+ opentelemetry-semantic-conventions==0.59b0
168
+ opentelemetry-semantic-conventions-ai==0.4.13
169
+ orjson==3.11.4
170
+ outlines==0.1.11
171
+ outlines_core==0.1.26
172
+ packaging==25.0
173
+ pandas==2.3.3
174
+ parso==0.8.5
175
+ partial-json-parser==0.2.1.1.post7
176
+ pathspec==0.12.1
177
+ peft==0.18.0
178
+ pexpect==4.9.0
179
+ pillow==11.3.0
180
+ pip==25.3
181
+ platformdirs==4.5.0
182
+ preshed==3.0.12
183
+ prometheus_client==0.23.1
184
+ prometheus-fastapi-instrumentator==7.1.0
185
+ prompt_toolkit==3.0.52
186
+ propcache==0.4.1
187
+ proto-plus==1.26.1
188
+ protobuf==4.25.8
189
+ psutil==7.1.3
190
+ ptyprocess==0.7.0
191
+ pure_eval==0.2.3
192
+ py-cpuinfo==9.0.0
193
+ py-spy==0.4.1
194
+ pyarrow==22.0.0
195
+ pyasn1==0.6.1
196
+ pyasn1_modules==0.4.2
197
+ pybind11==3.0.1
198
+ pycountry==24.6.1
199
+ pycparser==2.23
200
+ pydantic==2.12.5
201
+ pydantic_core==2.41.5
202
+ pydantic-extra-types==2.10.6
203
+ pydantic-settings==2.12.0
204
+ pygame==2.6.1
205
+ Pygments==2.19.2
206
+ pyjnius==1.7.0
207
+ pylatexenc==2.10
208
+ pyparsing==3.2.5
209
+ pyserini==1.2.0
210
+ python-dateutil==2.9.0.post0
211
+ python-dotenv==1.2.1
212
+ python-json-logger==4.0.0
213
+ python-multipart==0.0.20
214
+ pytokens==0.3.0
215
+ pytz==2025.2
216
+ PyYAML==6.0.3
217
+ pyzmq==27.1.0
218
+ ragen==0.1
219
+ rank-bm25==0.2.2
220
+ RapidFuzz==3.14.3
221
+ ray==2.52.1
222
+ referencing==0.37.0
223
+ regex==2025.11.3
224
+ requests==2.32.5
225
+ rich==14.2.0
226
+ rich-toolkit==0.17.0
227
+ rignore==0.7.6
228
+ rpds-py==0.30.0
229
+ rsa==4.9.1
230
+ safetensors==0.7.0
231
+ scikit-learn==1.7.2
232
+ scipy==1.15.3
233
+ sentencepiece==0.2.1
234
+ sentry-sdk==2.46.0
235
+ setuptools==80.9.0
236
+ shellingham==1.5.4
237
+ six==1.17.0
238
+ smart_open==7.5.0
239
+ smmap==5.0.2
240
+ sniffio==1.3.1
241
+ soupsieve==2.8
242
+ spacy==3.8.11
243
+ spacy-legacy==3.0.12
244
+ spacy-loggers==1.0.5
245
+ srsly==2.5.2
246
+ sse-starlette==3.0.3
247
+ stack-data==0.6.3
248
+ starlette==0.50.0
249
+ sympy==1.13.1
250
+ tabulate==0.9.0
251
+ tenacity==9.1.2
252
+ tensorboard==2.20.0
253
+ tensorboard-data-server==0.7.2
254
+ tensordict==0.8.3
255
+ thefuzz==0.22.1
256
+ thinc==8.3.10
257
+ threadpoolctl==3.6.0
258
+ tiktoken==0.12.0
259
+ together==1.5.31
260
+ tokenizers==0.22.1
261
+ tomli==2.3.0
262
+ torch==2.6.0+cu124
263
+ torchaudio==2.6.0
264
+ torchdata==0.11.0
265
+ torchvision==0.21.0
266
+ tqdm==4.67.1
267
+ traitlets==5.14.3
268
+ transformers==4.57.3
269
+ triton==3.2.0
270
+ typer==0.19.2
271
+ typer-slim==0.20.0
272
+ typing_extensions==4.15.0
273
+ typing-inspection==0.4.2
274
+ tzdata==2025.2
275
+ urllib3==2.5.0
276
+ uvicorn==0.38.0
277
+ uvloop==0.22.1
278
+ verl==0.5.0.dev0
279
+ virtualenv==20.35.4
280
+ vllm==0.8.5
281
+ wandb==0.23.0
282
+ wasabi==1.1.3
283
+ watchfiles==1.1.1
284
+ wcwidth==0.2.14
285
+ weasel==0.4.3
286
+ websockets==15.0.1
287
+ Werkzeug==3.1.4
288
+ wheel==0.45.1
289
+ wrapt==2.0.1
290
+ xformers==0.0.29.post2
291
+ xgrammar==0.1.18
292
+ xxhash==3.6.0
293
+ yarl==1.22.0
294
+ zipp==3.23.0
295
+ typeguard==4.4.4
296
+ tyro==1.0.3
297
+ verl==0.5.0.dev0
298
+ autocommand==2.2.2
299
+ backports.tarfile==1.2.0
300
+ importlib_metadata==8.0.0
301
+ inflect==7.3.1
302
+ jaraco.collections==5.1.0
303
+ jaraco.context==5.3.0
304
+ jaraco.functools==4.0.1
305
+ jaraco.text==3.12.1
306
+ more-itertools==10.3.0
307
+ packaging==24.2
308
+ platformdirs==4.2.2
309
+ tomli==2.0.1
310
+ typeguard==4.3.0
311
+ typing_extensions==4.12.2
312
+ wheel==0.45.1
313
+ zipp==3.19.2
wandb/run-20260112_224209-62o99t0u/files/wandb-metadata.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35",
3
+ "python": "CPython 3.10.19",
4
+ "startedAt": "2026-01-12T14:42:09.125131Z",
5
+ "args": [
6
+ "--track"
7
+ ],
8
+ "program": "/mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
9
+ "codePath": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
10
+ "codePathLocal": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
11
+ "git": {
12
+ "remote": "https://github.com/mll-lab-nu/RAGEN.git",
13
+ "commit": "8d73639b99b38265453f898b8d6af7d4af50d56e"
14
+ },
15
+ "email": "haoyu-wa22@mails.tsinghua.edu.cn",
16
+ "root": "/mnt/general/wanghy/RAGEN",
17
+ "host": "pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0",
18
+ "executable": "/root/local/miniconda3/envs/ragen/bin/python",
19
+ "cpu_count": 64,
20
+ "cpu_count_logical": 128,
21
+ "gpu": "NVIDIA H100 80GB HBM3",
22
+ "gpu_count": 4,
23
+ "disk": {
24
+ "/": {
25
+ "total": "2576980377600",
26
+ "used": "3724304384"
27
+ }
28
+ },
29
+ "memory": {
30
+ "total": "2163639439360"
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper",
38
+ "uuid": "GPU-cff454b9-f118-535b-5e1f-6d503e78e52e"
39
+ },
40
+ {
41
+ "name": "NVIDIA H100 80GB HBM3",
42
+ "memoryTotal": "85520809984",
43
+ "cudaCores": 16896,
44
+ "architecture": "Hopper",
45
+ "uuid": "GPU-9e77c178-188c-f869-780e-858c20a7d322"
46
+ },
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper",
52
+ "uuid": "GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9"
53
+ },
54
+ {
55
+ "name": "NVIDIA H100 80GB HBM3",
56
+ "memoryTotal": "85520809984",
57
+ "cudaCores": 16896,
58
+ "architecture": "Hopper",
59
+ "uuid": "GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7"
60
+ }
61
+ ],
62
+ "cudaVersion": "13.0",
63
+ "writerId": "35ar29uupah1ktpgjn4djl5xx5ow78o3"
64
+ }
wandb/run-20260112_224209-62o99t0u/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"eval/std_return":0.4499041483176584,"_timestamp":1.768229356683353e+09,"_runtime":426.228488766,"_wandb":{"runtime":426},"eval/episodes":4000,"global_step":252356,"train/episodic_length":1,"train/learning_rate":0.00025,"_step":252356,"eval/success_rate":0.93325,"eval/avg_return":0.77420875,"train/success":1,"perf/SPS":598,"train/episodic_return":0.955,"charts/epsilon":0.05,"train/loss":0.0037821633741259575,"train/success_rate_100":0.97}
wandb/run-20260112_224942-jlcvlgih/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Step Penalty & Time Limit Bootstrap for RAGEN Rubik's Cube 2x2
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+ import re
10
+
11
+ import gymnasium as gym
12
+ import numpy as np
13
+ import torch
14
+ import torch.nn as nn
15
+ import torch.optim as optim
16
+ import tyro
17
+
18
+ import sys
19
+ # 假设 ragen 库在当前目录的上两级,请根据实际情况调整
20
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
21
+
22
+ from ragen.env.rubikscube.env import RubiksCube2x2Env
23
+ from ragen.env.rubikscube.config import RubiksCube2x2Config
24
+
25
+
26
+ class RubiksCubeWrapper(gym.Env):
27
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
28
+
29
+ def __init__(self, env: RubiksCube2x2Env):
30
+ super().__init__()
31
+ self._env = env
32
+ self._colors = ['W', 'O', 'G', 'R', 'B', 'Y']
33
+ self._color_to_idx = {c: i for i, c in enumerate(self._colors)}
34
+ self.observation_space = gym.spaces.Box(low=0.0, high=1.0, shape=(24 * len(self._colors),), dtype=np.float32)
35
+ self.action_space = gym.spaces.Discrete(12)
36
+ self._face_pat = re.compile(r"\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])\n\s*\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])")
37
+
38
+ # [关键修改] 每步惩罚
39
+ # 如果20步都没解出来,累计惩罚是 20 * -0.05 = -1.0,抵消掉最后可能获得的 +1.0
40
+ # 这迫使 agent 寻找更短路径
41
+ self.step_penalty = -0.04
42
+
43
+ def _encode_obs(self, text_obs: str) -> np.ndarray:
44
+ faces_order = ["Up (U):", "Left (L):", "Front (F):", "Right (R):", "Back (B):", "Down (D):"]
45
+ lines = text_obs.splitlines()
46
+ blocks: List[str] = []
47
+ i = 0
48
+ while i < len(lines):
49
+ line = lines[i]
50
+ for header in faces_order:
51
+ if line.startswith(header):
52
+ content = line[len(header):].strip()
53
+ next_line = lines[i + 1] if i + 1 < len(lines) else ""
54
+ block = f"{content}\n{next_line}"
55
+ blocks.append(block)
56
+ break
57
+ i += 1
58
+ if len(blocks) != 6:
59
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
60
+ stickers: List[int] = []
61
+ for blk in blocks:
62
+ m = self._face_pat.search(blk)
63
+ if not m:
64
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
65
+ c0, c1, c2, c3 = m.group(1), m.group(2), m.group(3), m.group(4)
66
+ stickers.extend([c0, c1, c2, c3])
67
+ grid = np.zeros((24, len(self._colors)), dtype=np.float32)
68
+ for idx, ch in enumerate(stickers):
69
+ cidx = self._color_to_idx.get(ch, None)
70
+ if cidx is not None:
71
+ grid[idx, cidx] = 1.0
72
+ return grid.reshape(-1)
73
+
74
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
75
+ text_obs = self._env.reset(seed=seed)
76
+ obs = self._encode_obs(text_obs)
77
+ return obs, {}
78
+
79
+ def step(self, action: int):
80
+ mapped = int(action) + 1
81
+ text_obs, reward, done, info = self._env.step(mapped)
82
+ obs = self._encode_obs(text_obs)
83
+ terminated = bool(done)
84
+ truncated = False
85
+
86
+ # [关键修改] 应用惩罚
87
+ # 此时 reward 包含原本的稀疏奖励 (0 或 1) 加上每步惩罚
88
+ reward = float(reward) + self.step_penalty
89
+
90
+ return obs, reward, terminated, truncated, info or {}
91
+
92
+ def render(self):
93
+ return self._env.render()
94
+
95
+ def close(self):
96
+ self._env.close()
97
+
98
+
99
+ @dataclass
100
+ class Args:
101
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
102
+ seed: int = 1
103
+ torch_deterministic: bool = True
104
+ cuda: bool = True
105
+ track: bool = True
106
+ wandb_project_name: str = "cleanRL"
107
+ wandb_entity: str | None = None
108
+ capture_video: bool = False
109
+
110
+ # Algorithm
111
+ env_id: str = "RubiksCube2x2DQN"
112
+ total_timesteps: int = 400_000
113
+ learning_rate: float = 2.5e-4
114
+ gamma: float = 0.99
115
+ batch_size: int = 128
116
+ buffer_size: int = 200_000
117
+ target_network_frequency: int = 4000
118
+ train_frequency: int = 4
119
+ learning_starts: int = 5000
120
+
121
+ # Epsilon-greedy
122
+ start_e: float = 1.0
123
+ end_e: float = 0.05
124
+ exploration_fraction: float = 0.2
125
+
126
+ # Model size
127
+ hidden_size: int = 256
128
+
129
+ # Rubik specific
130
+ scramble_depth: int = 3 # 初始难度
131
+ max_steps_env: int = 20 # 硬性时间限制
132
+
133
+ # Eval
134
+ eval_splits: int = 2
135
+ eval_episodes: int = 4000
136
+
137
+
138
+ def make_env(idx, run_name, seed, scramble_depth, max_steps_env, capture_video=False):
139
+ def thunk():
140
+ # [关键修改] 内部 max_steps 设为 1000,防止 env 内部发出 done=True
141
+ # 我们完全依赖外部 TimeLimit wrapper 来处理超时
142
+ config = RubiksCube2x2Config(scramble_depth=scramble_depth, max_steps=20, render_mode='text')
143
+ env = RubiksCube2x2Env(config)
144
+ env = RubiksCubeWrapper(env)
145
+ # 外部限制设为 20
146
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps_env)
147
+ env = gym.wrappers.RecordEpisodeStatistics(env)
148
+ if capture_video and idx == 0:
149
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
150
+ return env
151
+ return thunk
152
+
153
+
154
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
155
+ torch.nn.init.orthogonal_(layer.weight, std)
156
+ torch.nn.init.constant_(layer.bias, bias_const)
157
+ return layer
158
+
159
+
160
+ class QNetwork(nn.Module):
161
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
162
+ super().__init__()
163
+ self.net = nn.Sequential(
164
+ layer_init(nn.Linear(obs_dim, hidden)),
165
+ nn.ReLU(),
166
+ layer_init(nn.Linear(hidden, hidden)),
167
+ nn.ReLU(),
168
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
169
+ )
170
+
171
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
172
+ return self.net(x)
173
+
174
+
175
+ class ReplayBuffer:
176
+ def __init__(self, capacity: int, obs_shape: Tuple[int, ...]):
177
+ self.capacity = capacity
178
+ self.ptr = 0
179
+ self.full = False
180
+ self.obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
181
+ self.next_obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
182
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
183
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
184
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
185
+
186
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
187
+ i = self.ptr
188
+ self.obs_buf[i] = obs
189
+ self.next_obs_buf[i] = next_obs
190
+ self.act_buf[i] = act
191
+ self.rew_buf[i] = rew
192
+ self.done_buf[i] = 1.0 if done else 0.0
193
+ self.ptr = (self.ptr + 1) % self.capacity
194
+ if self.ptr == 0:
195
+ self.full = True
196
+
197
+ def can_sample(self, batch_size: int) -> bool:
198
+ return (self.capacity if self.full else self.ptr) >= batch_size
199
+
200
+ def sample(self, batch_size: int):
201
+ size = self.capacity if self.full else self.ptr
202
+ idxs = np.random.randint(0, size, size=batch_size)
203
+ return (
204
+ self.obs_buf[idxs],
205
+ self.act_buf[idxs],
206
+ self.rew_buf[idxs],
207
+ self.done_buf[idxs],
208
+ self.next_obs_buf[idxs],
209
+ )
210
+
211
+
212
+ if __name__ == "__main__":
213
+ args = tyro.cli(Args)
214
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
215
+
216
+ if args.track:
217
+ import wandb
218
+ wandb.init(
219
+ project=args.wandb_project_name,
220
+ entity=args.wandb_entity,
221
+ config=vars(args),
222
+ name=run_name,
223
+ monitor_gym=True,
224
+ save_code=True,
225
+ )
226
+ try:
227
+ wandb.define_metric("global_step")
228
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
229
+ wandb.define_metric(prefix, step_metric="global_step")
230
+ except Exception:
231
+ pass
232
+
233
+ random.seed(args.seed)
234
+ np.random.seed(args.seed)
235
+ torch.manual_seed(args.seed)
236
+ torch.backends.cudnn.deterministic = args.torch_deterministic
237
+
238
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
239
+
240
+ env = make_env(0, run_name, args.seed, args.scramble_depth, args.max_steps_env, args.capture_video)()
241
+ obs_shape = env.observation_space.shape
242
+ act_dim = env.action_space.n
243
+
244
+ policy_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
245
+ target_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
246
+ target_net.load_state_dict(policy_net.state_dict())
247
+ target_net.eval()
248
+
249
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
250
+ criterion = nn.SmoothL1Loss()
251
+
252
+ rb = ReplayBuffer(args.buffer_size, obs_shape)
253
+
254
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
255
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
256
+
257
+ # 评估函数
258
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
259
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
260
+ out_dir.mkdir(parents=True, exist_ok=True)
261
+ out_path = out_dir / "trajectories.jsonl"
262
+ env_eval = make_env_fn()
263
+ collected = 0
264
+ summary_returns = []
265
+ summary_success = []
266
+ with out_path.open("w") as f:
267
+ while collected < n_episodes:
268
+ state, _ = env_eval.reset(seed=args.seed + 100000 + collected)
269
+ traj_states = [np.asarray(state).tolist()]
270
+ traj_actions = []
271
+ traj_rewards = []
272
+ traj_dones = []
273
+ traj_success = []
274
+ done = False
275
+ step_count = 0
276
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.max_steps_env)
277
+ while not done:
278
+ with torch.no_grad():
279
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
280
+ action = int(torch.argmax(q, dim=1).item())
281
+ next_state, reward, terminated, truncated, info = env_eval.step(action)
282
+
283
+ traj_actions.append(int(action))
284
+ traj_rewards.append(float(reward))
285
+ step_count += 1
286
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
287
+ traj_dones.append(d)
288
+ traj_success.append(bool((info or {}).get('success', False)))
289
+ state = next_state
290
+ traj_states.append(np.asarray(state).tolist())
291
+ done = d
292
+ ep_ret = float(sum(traj_rewards))
293
+ ep_succ = bool(any(traj_success))
294
+ record = {
295
+ "states": traj_states,
296
+ "actions": traj_actions,
297
+ "rewards": traj_rewards,
298
+ "dones": traj_dones,
299
+ "success": traj_success,
300
+ "episode_return": ep_ret,
301
+ "episode_success": ep_succ,
302
+ }
303
+ f.write(json.dumps(record) + "\n")
304
+ collected += 1
305
+ summary_returns.append(ep_ret)
306
+ summary_success.append(1.0 if ep_succ else 0.0)
307
+ env_eval.close()
308
+ try:
309
+ metrics = {
310
+ "global_step": int(step_tag),
311
+ "episodes": int(n_episodes),
312
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
313
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
314
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
315
+ }
316
+ with (out_dir / "metrics.json").open("w") as mf:
317
+ json.dump(metrics, mf)
318
+ except Exception as e:
319
+ print(f"Warning: failed to write eval metrics: {e}")
320
+
321
+ # 主训练循环
322
+ global_step = 0
323
+ start_time = time.time()
324
+
325
+ obs, _ = env.reset(seed=args.seed)
326
+ ep_return = 0.0
327
+ ep_len = 0
328
+ ep_success_window: List[float] = []
329
+
330
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
331
+
332
+ while global_step < args.total_timesteps:
333
+ epsilon = epsilon_by_step(global_step)
334
+ if np.random.rand() < epsilon or global_step < args.learning_starts:
335
+ action = env.action_space.sample()
336
+ else:
337
+ with torch.no_grad():
338
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
339
+ action = int(torch.argmax(q_values, dim=1).item())
340
+
341
+ next_obs, reward, terminated, truncated, info = env.step(action)
342
+
343
+ # 判断是否需要 Reset (任何结束都 Reset)
344
+ real_done = bool(terminated) or bool(truncated)
345
+
346
+ # [核心逻辑]
347
+ # 1. 即使是 truncated (超时),done 也记为 False,以便进行 bootstrap (计算未来价值)
348
+ # 2. 只有 terminated (真正解开了),done 才记为 True
349
+ # 3. Step Penalty 已经包含在 reward 中,DQN 会学到"为了避免扣分,必须在未来几步内解决"
350
+ rb.add(
351
+ obs.astype(np.float32),
352
+ int(action),
353
+ float(reward),
354
+ bool(terminated), # 注意:只用 terminated
355
+ next_obs.astype(np.float32)
356
+ )
357
+
358
+ obs = next_obs
359
+ ep_return += float(reward)
360
+ ep_len += 1
361
+ global_step += 1
362
+
363
+ # 训练过程
364
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
365
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
366
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
367
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
368
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
369
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
370
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
371
+
372
+ with torch.no_grad():
373
+ next_q = target_net(b_next_obs).max(dim=1)[0]
374
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
375
+
376
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
377
+ loss = criterion(current_q, target_q)
378
+
379
+ optimizer.zero_grad()
380
+ loss.backward()
381
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
382
+ optimizer.step()
383
+
384
+ if args.track:
385
+ try:
386
+ import wandb
387
+ wandb.log({
388
+ "global_step": int(global_step),
389
+ "train/loss": float(loss.item()),
390
+ "charts/epsilon": float(epsilon),
391
+ "perf/SPS": int(global_step / (time.time() - start_time)),
392
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
393
+ }, step=global_step)
394
+ except Exception:
395
+ pass
396
+
397
+ # 结束时 Reset
398
+ if real_done:
399
+ succ = bool((info or {}).get('success', False))
400
+ ep_success_window.append(1.0 if succ else 0.0)
401
+ if len(ep_success_window) > 100:
402
+ ep_success_window.pop(0)
403
+ if args.track:
404
+ try:
405
+ import wandb
406
+ wandb.log({
407
+ "global_step": int(global_step),
408
+ "train/episodic_return": float(ep_return),
409
+ "train/episodic_length": int(ep_len),
410
+ "train/success": float(1.0 if succ else 0.0),
411
+ "train/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) >= 1 else None,
412
+ }, step=global_step)
413
+ except Exception:
414
+ pass
415
+ obs, _ = env.reset()
416
+ ep_return, ep_len = 0.0, 0
417
+
418
+ # 更新目标网络
419
+ if global_step % args.target_network_frequency == 0:
420
+ target_net.load_state_dict(policy_net.state_dict())
421
+
422
+ # 打印日志
423
+ if global_step % 1000 == 0:
424
+ sps = int(global_step / (time.time() - start_time))
425
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
426
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
427
+
428
+ # 评估
429
+ if global_step == 1 or (global_step % eval_every_steps == 0):
430
+ try:
431
+ def eval_thunk():
432
+ # 评估环境也同样设置:内部1000,外部20
433
+ return make_env(0, run_name, args.seed + 9999, args.scramble_depth, args.max_steps_env, False)()
434
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
435
+ if args.track:
436
+ try:
437
+ import wandb
438
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
439
+ if mpath.exists():
440
+ with mpath.open("r") as mf:
441
+ metrics = json.load(mf)
442
+ wandb.log({
443
+ "eval/success_rate": metrics.get("success_rate"),
444
+ "eval/avg_return": metrics.get("avg_return"),
445
+ "eval/std_return": metrics.get("std_return"),
446
+ "eval/episodes": metrics.get("episodes"),
447
+ }, step=global_step)
448
+ except Exception:
449
+ pass
450
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
451
+ except Exception as e:
452
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
453
+
454
+ env.close()
wandb/run-20260112_224942-jlcvlgih/files/config.yaml ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.23.0
4
+ code_path: code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
5
+ e:
6
+ x6hdflogtnk75ni5ehl9wyx5sede6lv4:
7
+ args:
8
+ - --track
9
+ codePath: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
10
+ codePathLocal: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
11
+ cpu_count: 64
12
+ cpu_count_logical: 128
13
+ cudaVersion: "13.0"
14
+ disk:
15
+ /:
16
+ total: "2576980377600"
17
+ used: "3724308480"
18
+ email: haoyu-wa22@mails.tsinghua.edu.cn
19
+ executable: /root/local/miniconda3/envs/ragen/bin/python
20
+ git:
21
+ commit: 8d73639b99b38265453f898b8d6af7d4af50d56e
22
+ remote: https://github.com/mll-lab-nu/RAGEN.git
23
+ gpu: NVIDIA H100 80GB HBM3
24
+ gpu_count: 4
25
+ gpu_nvidia:
26
+ - architecture: Hopper
27
+ cudaCores: 16896
28
+ memoryTotal: "85520809984"
29
+ name: NVIDIA H100 80GB HBM3
30
+ uuid: GPU-cff454b9-f118-535b-5e1f-6d503e78e52e
31
+ - architecture: Hopper
32
+ cudaCores: 16896
33
+ memoryTotal: "85520809984"
34
+ name: NVIDIA H100 80GB HBM3
35
+ uuid: GPU-9e77c178-188c-f869-780e-858c20a7d322
36
+ - architecture: Hopper
37
+ cudaCores: 16896
38
+ memoryTotal: "85520809984"
39
+ name: NVIDIA H100 80GB HBM3
40
+ uuid: GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9
41
+ - architecture: Hopper
42
+ cudaCores: 16896
43
+ memoryTotal: "85520809984"
44
+ name: NVIDIA H100 80GB HBM3
45
+ uuid: GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7
46
+ host: pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0
47
+ memory:
48
+ total: "2163639439360"
49
+ os: Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35
50
+ program: /mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
51
+ python: CPython 3.10.19
52
+ root: /mnt/general/wanghy/RAGEN
53
+ startedAt: "2026-01-12T14:49:42.621345Z"
54
+ writerId: x6hdflogtnk75ni5ehl9wyx5sede6lv4
55
+ m:
56
+ - "1": global_step
57
+ "6":
58
+ - 3
59
+ "7": []
60
+ - "2": perf/*
61
+ "5": 1
62
+ "6":
63
+ - 1
64
+ "7": []
65
+ - "2": train/*
66
+ "5": 1
67
+ "6":
68
+ - 1
69
+ "7": []
70
+ - "2": rollout/*
71
+ "5": 1
72
+ "6":
73
+ - 1
74
+ "7": []
75
+ - "2": eval/*
76
+ "5": 1
77
+ "6":
78
+ - 1
79
+ "7": []
80
+ - "2": losses/*
81
+ "5": 1
82
+ "6":
83
+ - 1
84
+ "7": []
85
+ - "2": charts/*
86
+ "5": 1
87
+ "6":
88
+ - 1
89
+ "7": []
90
+ python_version: 3.10.19
91
+ t:
92
+ "1":
93
+ - 1
94
+ - 11
95
+ - 30
96
+ - 49
97
+ - 50
98
+ - 51
99
+ - 105
100
+ "2":
101
+ - 1
102
+ - 11
103
+ - 30
104
+ - 49
105
+ - 50
106
+ - 51
107
+ - 105
108
+ "3":
109
+ - 7
110
+ - 13
111
+ - 16
112
+ - 61
113
+ "4": 3.10.19
114
+ "5": 0.23.0
115
+ "6": 4.57.3
116
+ "12": 0.23.0
117
+ "13": linux-x86_64
118
+ batch_size:
119
+ value: 128
120
+ buffer_size:
121
+ value: 200000
122
+ capture_video:
123
+ value: false
124
+ cuda:
125
+ value: true
126
+ end_e:
127
+ value: 0.05
128
+ env_id:
129
+ value: RubiksCube2x2DQN
130
+ eval_episodes:
131
+ value: 4000
132
+ eval_splits:
133
+ value: 2
134
+ exp_name:
135
+ value: dqn_rubikscube
136
+ exploration_fraction:
137
+ value: 0.2
138
+ gamma:
139
+ value: 0.99
140
+ hidden_size:
141
+ value: 256
142
+ learning_rate:
143
+ value: 0.00025
144
+ learning_starts:
145
+ value: 5000
146
+ max_steps_env:
147
+ value: 20
148
+ scramble_depth:
149
+ value: 3
150
+ seed:
151
+ value: 1
152
+ start_e:
153
+ value: 1
154
+ target_network_frequency:
155
+ value: 4000
156
+ torch_deterministic:
157
+ value: true
158
+ total_timesteps:
159
+ value: 400000
160
+ track:
161
+ value: true
162
+ train_frequency:
163
+ value: 4
164
+ wandb_entity:
165
+ value: null
166
+ wandb_project_name:
167
+ value: cleanRL
wandb/run-20260112_224942-jlcvlgih/files/diff.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_224942-jlcvlgih/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_224942-jlcvlgih/files/requirements.txt ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ colorama==0.4.6
2
+ psutil==7.1.3
3
+ ragen==0.1
4
+ Farama-Notifications==0.0.4
5
+ MarkupSafe==2.1.5
6
+ PyJWT==2.10.1
7
+ PySocks==1.7.1
8
+ absl-py==2.3.1
9
+ accelerate==1.12.0
10
+ aiohappyeyeballs==2.6.1
11
+ aiohttp==3.13.2
12
+ aiohttp-cors==0.8.1
13
+ aiosignal==1.4.0
14
+ airportsdata==20250909
15
+ annotated-doc==0.0.4
16
+ annotated-types==0.7.0
17
+ anthropic==0.75.0
18
+ antlr4-python3-runtime==4.9.3
19
+ anyio==4.12.0
20
+ astor==0.8.1
21
+ asttokens==3.0.1
22
+ async-timeout==5.0.1
23
+ attrs==25.4.0
24
+ beautifulsoup4==4.14.3
25
+ black==25.11.0
26
+ blake3==1.0.8
27
+ blinker==1.9.0
28
+ blis==1.3.3
29
+ cachetools==6.2.2
30
+ catalogue==2.0.10
31
+ certifi==2025.11.12
32
+ cffi==2.0.0
33
+ charset-normalizer==3.4.4
34
+ cleantext==1.1.4
35
+ click==8.2.1
36
+ cloudpathlib==0.23.0
37
+ cloudpickle==3.1.2
38
+ codetiming==1.4.0
39
+ colorama==0.4.6
40
+ coloredlogs==15.0.1
41
+ colorful==0.5.8
42
+ compressed-tensors==0.9.3
43
+ confection==0.1.5
44
+ contourpy==1.3.2
45
+ cryptography==46.0.3
46
+ cupy-cuda12x==13.6.0
47
+ cycler==0.12.1
48
+ cymem==2.0.13
49
+ Cython==3.2.2
50
+ datasets==4.4.1
51
+ debugpy==1.8.17
52
+ decorator==5.2.1
53
+ Deprecated==1.3.1
54
+ depyf==0.18.0
55
+ dill==0.4.0
56
+ diskcache==5.6.3
57
+ distlib==0.4.0
58
+ distro==1.9.0
59
+ dnspython==2.8.0
60
+ docstring_parser==0.17.0
61
+ einops==0.8.1
62
+ email-validator==2.3.0
63
+ eval_type_backport==0.2.2
64
+ exceptiongroup==1.3.1
65
+ executing==2.2.1
66
+ faiss-gpu==1.7.2
67
+ fastapi==0.123.1
68
+ fastapi-cli==0.0.16
69
+ fastapi-cloud-cli==0.5.2
70
+ fastar==0.8.0
71
+ fastrlock==0.8.3
72
+ filelock==3.19.1
73
+ flash_attn==2.8.3
74
+ Flask==3.1.2
75
+ flatbuffers==25.9.23
76
+ fonttools==4.61.0
77
+ frozenlist==1.8.0
78
+ fsspec==2025.9.0
79
+ gdown==5.2.0
80
+ gguf==0.17.1
81
+ gitdb==4.0.12
82
+ GitPython==3.1.45
83
+ google-api-core==2.28.1
84
+ google-auth==2.43.0
85
+ googleapis-common-protos==1.72.0
86
+ grpcio==1.76.0
87
+ gym==0.26.2
88
+ gym-notices==0.1.0
89
+ gym-sokoban==0.0.6
90
+ gymnasium==1.2.2
91
+ h11==0.16.0
92
+ hf-xet==1.2.0
93
+ html2text==2025.4.15
94
+ httpcore==1.0.9
95
+ httptools==0.7.1
96
+ httpx==0.28.1
97
+ httpx-sse==0.4.3
98
+ huggingface-hub==0.36.0
99
+ humanfriendly==10.0
100
+ hydra-core==1.3.2
101
+ idna==3.11
102
+ ImageIO==2.37.2
103
+ importlib_metadata==8.0.0
104
+ interegular==0.3.3
105
+ ipython==8.37.0
106
+ itsdangerous==2.2.0
107
+ jedi==0.19.2
108
+ Jinja2==3.1.6
109
+ jiter==0.12.0
110
+ joblib==1.5.2
111
+ jsonschema==4.25.1
112
+ jsonschema-specifications==2025.9.1
113
+ kimina-client==0.2.1
114
+ kiwisolver==1.4.9
115
+ lark==1.2.2
116
+ llguidance==0.7.30
117
+ llvmlite==0.44.0
118
+ lm-format-enforcer==0.10.12
119
+ loguru==0.7.3
120
+ Markdown==3.10
121
+ markdown-it-py==4.0.0
122
+ matplotlib==3.10.7
123
+ matplotlib-inline==0.2.1
124
+ mcp==1.22.0
125
+ mdurl==0.1.2
126
+ mistral_common==1.8.6
127
+ mpmath==1.3.0
128
+ msgpack==1.1.2
129
+ msgspec==0.20.0
130
+ multidict==6.7.0
131
+ multiprocess==0.70.18
132
+ murmurhash==1.0.15
133
+ mypy_extensions==1.1.0
134
+ nest-asyncio==1.6.0
135
+ networkx==3.3
136
+ ninja==1.13.0
137
+ nltk==3.9.2
138
+ numba==0.61.2
139
+ numpy==1.26.4
140
+ nvidia-cublas-cu12==12.4.5.8
141
+ nvidia-cuda-cupti-cu12==12.4.127
142
+ nvidia-cuda-nvrtc-cu12==12.4.127
143
+ nvidia-cuda-runtime-cu12==12.4.127
144
+ nvidia-cudnn-cu12==9.1.0.70
145
+ nvidia-cufft-cu12==11.2.1.3
146
+ nvidia-curand-cu12==10.3.5.147
147
+ nvidia-cusolver-cu12==11.6.1.9
148
+ nvidia-cusparse-cu12==12.3.1.170
149
+ nvidia-cusparselt-cu12==0.6.2
150
+ nvidia-nccl-cu12==2.21.5
151
+ nvidia-nvjitlink-cu12==12.4.127
152
+ nvidia-nvtx-cu12==12.4.127
153
+ omegaconf==2.3.0
154
+ onnxruntime==1.23.2
155
+ openai==2.8.1
156
+ opencensus==0.11.4
157
+ opencensus-context==0.1.3
158
+ opencv-python-headless==4.12.0.88
159
+ opentelemetry-api==1.38.0
160
+ opentelemetry-exporter-otlp==1.26.0
161
+ opentelemetry-exporter-otlp-proto-common==1.26.0
162
+ opentelemetry-exporter-otlp-proto-grpc==1.26.0
163
+ opentelemetry-exporter-otlp-proto-http==1.26.0
164
+ opentelemetry-exporter-prometheus==0.59b0
165
+ opentelemetry-proto==1.26.0
166
+ opentelemetry-sdk==1.38.0
167
+ opentelemetry-semantic-conventions==0.59b0
168
+ opentelemetry-semantic-conventions-ai==0.4.13
169
+ orjson==3.11.4
170
+ outlines==0.1.11
171
+ outlines_core==0.1.26
172
+ packaging==25.0
173
+ pandas==2.3.3
174
+ parso==0.8.5
175
+ partial-json-parser==0.2.1.1.post7
176
+ pathspec==0.12.1
177
+ peft==0.18.0
178
+ pexpect==4.9.0
179
+ pillow==11.3.0
180
+ pip==25.3
181
+ platformdirs==4.5.0
182
+ preshed==3.0.12
183
+ prometheus_client==0.23.1
184
+ prometheus-fastapi-instrumentator==7.1.0
185
+ prompt_toolkit==3.0.52
186
+ propcache==0.4.1
187
+ proto-plus==1.26.1
188
+ protobuf==4.25.8
189
+ psutil==7.1.3
190
+ ptyprocess==0.7.0
191
+ pure_eval==0.2.3
192
+ py-cpuinfo==9.0.0
193
+ py-spy==0.4.1
194
+ pyarrow==22.0.0
195
+ pyasn1==0.6.1
196
+ pyasn1_modules==0.4.2
197
+ pybind11==3.0.1
198
+ pycountry==24.6.1
199
+ pycparser==2.23
200
+ pydantic==2.12.5
201
+ pydantic_core==2.41.5
202
+ pydantic-extra-types==2.10.6
203
+ pydantic-settings==2.12.0
204
+ pygame==2.6.1
205
+ Pygments==2.19.2
206
+ pyjnius==1.7.0
207
+ pylatexenc==2.10
208
+ pyparsing==3.2.5
209
+ pyserini==1.2.0
210
+ python-dateutil==2.9.0.post0
211
+ python-dotenv==1.2.1
212
+ python-json-logger==4.0.0
213
+ python-multipart==0.0.20
214
+ pytokens==0.3.0
215
+ pytz==2025.2
216
+ PyYAML==6.0.3
217
+ pyzmq==27.1.0
218
+ ragen==0.1
219
+ rank-bm25==0.2.2
220
+ RapidFuzz==3.14.3
221
+ ray==2.52.1
222
+ referencing==0.37.0
223
+ regex==2025.11.3
224
+ requests==2.32.5
225
+ rich==14.2.0
226
+ rich-toolkit==0.17.0
227
+ rignore==0.7.6
228
+ rpds-py==0.30.0
229
+ rsa==4.9.1
230
+ safetensors==0.7.0
231
+ scikit-learn==1.7.2
232
+ scipy==1.15.3
233
+ sentencepiece==0.2.1
234
+ sentry-sdk==2.46.0
235
+ setuptools==80.9.0
236
+ shellingham==1.5.4
237
+ six==1.17.0
238
+ smart_open==7.5.0
239
+ smmap==5.0.2
240
+ sniffio==1.3.1
241
+ soupsieve==2.8
242
+ spacy==3.8.11
243
+ spacy-legacy==3.0.12
244
+ spacy-loggers==1.0.5
245
+ srsly==2.5.2
246
+ sse-starlette==3.0.3
247
+ stack-data==0.6.3
248
+ starlette==0.50.0
249
+ sympy==1.13.1
250
+ tabulate==0.9.0
251
+ tenacity==9.1.2
252
+ tensorboard==2.20.0
253
+ tensorboard-data-server==0.7.2
254
+ tensordict==0.8.3
255
+ thefuzz==0.22.1
256
+ thinc==8.3.10
257
+ threadpoolctl==3.6.0
258
+ tiktoken==0.12.0
259
+ together==1.5.31
260
+ tokenizers==0.22.1
261
+ tomli==2.3.0
262
+ torch==2.6.0+cu124
263
+ torchaudio==2.6.0
264
+ torchdata==0.11.0
265
+ torchvision==0.21.0
266
+ tqdm==4.67.1
267
+ traitlets==5.14.3
268
+ transformers==4.57.3
269
+ triton==3.2.0
270
+ typer==0.19.2
271
+ typer-slim==0.20.0
272
+ typing_extensions==4.15.0
273
+ typing-inspection==0.4.2
274
+ tzdata==2025.2
275
+ urllib3==2.5.0
276
+ uvicorn==0.38.0
277
+ uvloop==0.22.1
278
+ verl==0.5.0.dev0
279
+ virtualenv==20.35.4
280
+ vllm==0.8.5
281
+ wandb==0.23.0
282
+ wasabi==1.1.3
283
+ watchfiles==1.1.1
284
+ wcwidth==0.2.14
285
+ weasel==0.4.3
286
+ websockets==15.0.1
287
+ Werkzeug==3.1.4
288
+ wheel==0.45.1
289
+ wrapt==2.0.1
290
+ xformers==0.0.29.post2
291
+ xgrammar==0.1.18
292
+ xxhash==3.6.0
293
+ yarl==1.22.0
294
+ zipp==3.23.0
295
+ typeguard==4.4.4
296
+ tyro==1.0.3
297
+ verl==0.5.0.dev0
298
+ autocommand==2.2.2
299
+ backports.tarfile==1.2.0
300
+ importlib_metadata==8.0.0
301
+ inflect==7.3.1
302
+ jaraco.collections==5.1.0
303
+ jaraco.context==5.3.0
304
+ jaraco.functools==4.0.1
305
+ jaraco.text==3.12.1
306
+ more-itertools==10.3.0
307
+ packaging==24.2
308
+ platformdirs==4.2.2
309
+ tomli==2.0.1
310
+ typeguard==4.3.0
311
+ typing_extensions==4.12.2
312
+ wheel==0.45.1
313
+ zipp==3.19.2
wandb/run-20260112_224942-jlcvlgih/files/wandb-metadata.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35",
3
+ "python": "CPython 3.10.19",
4
+ "startedAt": "2026-01-12T14:49:42.621345Z",
5
+ "args": [
6
+ "--track"
7
+ ],
8
+ "program": "/mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
9
+ "codePath": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
10
+ "codePathLocal": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
11
+ "git": {
12
+ "remote": "https://github.com/mll-lab-nu/RAGEN.git",
13
+ "commit": "8d73639b99b38265453f898b8d6af7d4af50d56e"
14
+ },
15
+ "email": "haoyu-wa22@mails.tsinghua.edu.cn",
16
+ "root": "/mnt/general/wanghy/RAGEN",
17
+ "host": "pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0",
18
+ "executable": "/root/local/miniconda3/envs/ragen/bin/python",
19
+ "cpu_count": 64,
20
+ "cpu_count_logical": 128,
21
+ "gpu": "NVIDIA H100 80GB HBM3",
22
+ "gpu_count": 4,
23
+ "disk": {
24
+ "/": {
25
+ "total": "2576980377600",
26
+ "used": "3724308480"
27
+ }
28
+ },
29
+ "memory": {
30
+ "total": "2163639439360"
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper",
38
+ "uuid": "GPU-cff454b9-f118-535b-5e1f-6d503e78e52e"
39
+ },
40
+ {
41
+ "name": "NVIDIA H100 80GB HBM3",
42
+ "memoryTotal": "85520809984",
43
+ "cudaCores": 16896,
44
+ "architecture": "Hopper",
45
+ "uuid": "GPU-9e77c178-188c-f869-780e-858c20a7d322"
46
+ },
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper",
52
+ "uuid": "GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9"
53
+ },
54
+ {
55
+ "name": "NVIDIA H100 80GB HBM3",
56
+ "memoryTotal": "85520809984",
57
+ "cudaCores": 16896,
58
+ "architecture": "Hopper",
59
+ "uuid": "GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7"
60
+ }
61
+ ],
62
+ "cudaVersion": "13.0",
63
+ "writerId": "x6hdflogtnk75ni5ehl9wyx5sede6lv4"
64
+ }
wandb/run-20260112_224942-jlcvlgih/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"charts/epsilon":0.05,"_timestamp":1.7682295877963042e+09,"eval/std_return":0.36697596651552,"perf/SPS":652,"_runtime":203.831261036,"eval/avg_return":-0.7192000000000002,"train/loss":0.01819211058318615,"train/episodic_length":20,"global_step":130108,"eval/episodes":4000,"_wandb":{"runtime":203},"train/episodic_return":-0.8000000000000002,"train/success_rate_100":0.01,"eval/success_rate":0.04625,"_step":130108,"train/success":0,"train/learning_rate":0.00025}
wandb/run-20260112_225250-k2i6dnry/files/code/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Action Masking for RAGEN Sudoku (4x4, max_step=20)
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+
10
+ import gymnasium as gym
11
+ import numpy as np
12
+ import torch
13
+ import torch.nn as nn
14
+ import torch.optim as optim
15
+ import tyro
16
+
17
+ import sys
18
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
19
+
20
+ from ragen.env.sudoku.env import SudokuEnv
21
+ from ragen.env.sudoku.config import SudokuEnvConfig
22
+
23
+
24
+ class SudokuWrapper(gym.Env):
25
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
26
+
27
+ def __init__(self, env: SudokuEnv, grid_size: int):
28
+ super().__init__()
29
+ self._env = env
30
+ self._size = grid_size
31
+ self._val_dim = self._size + 1
32
+ self._act_n = self._size * self._size * self._size
33
+ self.action_space = gym.spaces.Discrete(self._act_n)
34
+ self.observation_space = gym.spaces.Dict({
35
+ "observation": gym.spaces.Box(low=0.0, high=1.0, shape=(self._size * self._size * self._val_dim,), dtype=np.float32),
36
+ "action_mask": gym.spaces.Box(low=0.0, high=1.0, shape=(self._act_n,), dtype=np.float32)
37
+ })
38
+
39
+ def _encode_obs(self, text_obs: str) -> Dict[str, np.ndarray]:
40
+ vals: List[int] = []
41
+ for line in text_obs.splitlines():
42
+ ls = line.strip()
43
+ if len(ls) == 0:
44
+ continue
45
+ if set(ls) <= {'-'}:
46
+ continue
47
+ tokens = [t for t in ls.split() if t != '|']
48
+ if len(tokens) == 0:
49
+ continue
50
+ for t in tokens:
51
+ if t == '.':
52
+ vals.append(0)
53
+ else:
54
+ try:
55
+ v = int(t)
56
+ except ValueError:
57
+ v = 0
58
+ vals.append(v)
59
+ target = self._size * self._size
60
+ if len(vals) < target:
61
+ vals.extend([0] * (target - len(vals)))
62
+ if len(vals) > target:
63
+ vals = vals[:target]
64
+ grid = np.zeros((target, self._val_dim), dtype=np.float32)
65
+ mask = np.zeros(self._act_n, dtype=np.float32)
66
+ for i, v in enumerate(vals):
67
+ v_clamped = int(v)
68
+ if v_clamped < 0 or v_clamped > self._size:
69
+ v_clamped = 0
70
+ grid[i, v_clamped] = 1.0
71
+ if v_clamped != 0:
72
+ start_idx = i * self._size
73
+ end_idx = start_idx + self._size
74
+ mask[start_idx:end_idx] = 0.0
75
+ cur = np.array(vals, dtype=np.int64).reshape(self._size, self._size)
76
+ box = int(np.sqrt(self._size))
77
+ for i, v in enumerate(vals):
78
+ if int(v) == 0:
79
+ r = i // self._size
80
+ c = i % self._size
81
+ row_vals = set(cur[r, :].tolist())
82
+ col_vals = set(cur[:, c].tolist())
83
+ br = (r // box) * box
84
+ bc = (c // box) * box
85
+ box_vals = set(cur[br:br + box, bc:bc + box].reshape(-1).tolist())
86
+ start_idx = i * self._size
87
+ for num in range(1, self._size + 1):
88
+ if (num not in row_vals) and (num not in col_vals) and (num not in box_vals):
89
+ mask[start_idx + (num - 1)] = 1.0
90
+ if mask.sum() == 0:
91
+ for i, v in enumerate(vals):
92
+ if int(v) == 0:
93
+ start_idx = i * self._size
94
+ end_idx = start_idx + self._size
95
+ mask[start_idx:end_idx] = 1.0
96
+ if mask.sum() == 0:
97
+ mask[:] = 1.0
98
+ return {
99
+ "observation": grid.reshape(-1),
100
+ "action_mask": mask,
101
+ }
102
+
103
+ @staticmethod
104
+ def _decode_action(action_id: int, grid_size: int) -> Tuple[int, int, int]:
105
+ g = grid_size
106
+ row = action_id // (g * g)
107
+ rem = action_id % (g * g)
108
+ col = rem // g
109
+ num = (rem % g) + 1
110
+ return row, col, num
111
+
112
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
113
+ text_obs = self._env.reset(seed=seed)
114
+ obs = self._encode_obs(text_obs)
115
+ return obs, {}
116
+
117
+ def step(self, action: int):
118
+ row, col, num = self._decode_action(int(action), self._size)
119
+ act_str = f"{row + 1},{col + 1},{num}"
120
+ text_obs, reward, done, info = self._env.step(act_str)
121
+ obs = self._encode_obs(text_obs)
122
+ terminated = bool(done)
123
+ truncated = False
124
+ return obs, float(reward), terminated, truncated, info or {}
125
+
126
+ def render(self):
127
+ return self._env.render()
128
+
129
+ def close(self):
130
+ self._env.close()
131
+
132
+
133
+ @dataclass
134
+ class Args:
135
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
136
+ seed: int = 1
137
+ torch_deterministic: bool = True
138
+ cuda: bool = True
139
+ track: bool = True
140
+ wandb_project_name: str = "cleanRL"
141
+ wandb_entity: str | None = None
142
+ capture_video: bool = False
143
+
144
+ # Algorithm
145
+ env_id: str = "SudokuDQN"
146
+ total_timesteps: int = 200000
147
+ learning_rate: float = 3e-4
148
+ gamma: float = 0.99
149
+ batch_size: int = 128
150
+ buffer_size: int = 400_000
151
+ target_network_frequency: int = 4000
152
+ train_frequency: int = 1
153
+ learning_starts: int = 10000
154
+
155
+ # Epsilon-greedy
156
+ start_e: float = 1.0
157
+ end_e: float = 0.05
158
+ exploration_fraction: float = 0.2
159
+
160
+ # Model size
161
+ hidden_size: int = 256
162
+
163
+ # Sudoku specific
164
+ grid_size: int = 4
165
+ difficulty: str = "easy"
166
+
167
+ # Eval
168
+ eval_splits: int = 2
169
+ eval_episodes: int = 4000
170
+
171
+
172
+ def make_env(idx, run_name, seed, grid_size, difficulty, capture_video=False):
173
+ def thunk():
174
+ config = SudokuEnvConfig(
175
+ grid_size=grid_size,
176
+ difficulty=difficulty,
177
+ render_mode='text',
178
+ render_format='simple',
179
+ )
180
+ env = SudokuEnv(config)
181
+ env = SudokuWrapper(env, grid_size)
182
+ max_steps = 20
183
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps)
184
+ env = gym.wrappers.RecordEpisodeStatistics(env)
185
+ if capture_video and idx == 0:
186
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
187
+ return env
188
+ return thunk
189
+
190
+
191
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
192
+ torch.nn.init.orthogonal_(layer.weight, std)
193
+ torch.nn.init.constant_(layer.bias, bias_const)
194
+ return layer
195
+
196
+
197
+ class QNetwork(nn.Module):
198
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
199
+ super().__init__()
200
+ self.net = nn.Sequential(
201
+ layer_init(nn.Linear(obs_dim, hidden)),
202
+ nn.ReLU(),
203
+ layer_init(nn.Linear(hidden, hidden)),
204
+ nn.ReLU(),
205
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
206
+ )
207
+
208
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
209
+ return self.net(x)
210
+
211
+
212
+ class ReplayBuffer:
213
+ def __init__(self, capacity: int, obs_dim: int):
214
+ self.capacity = capacity
215
+ self.ptr = 0
216
+ self.full = False
217
+ self.obs_buf = np.zeros((capacity, obs_dim), dtype=np.float32)
218
+ self.next_obs_buf = np.zeros((capacity, obs_dim), dtype=np.float32)
219
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
220
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
221
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
222
+
223
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
224
+ i = self.ptr
225
+ self.obs_buf[i] = obs
226
+ self.next_obs_buf[i] = next_obs
227
+ self.act_buf[i] = act
228
+ self.rew_buf[i] = rew
229
+ self.done_buf[i] = 1.0 if done else 0.0
230
+ self.ptr = (self.ptr + 1) % self.capacity
231
+ if self.ptr == 0:
232
+ self.full = True
233
+
234
+ def can_sample(self, batch_size: int) -> bool:
235
+ return (self.capacity if self.full else self.ptr) >= batch_size
236
+
237
+ def sample(self, batch_size: int):
238
+ size = self.capacity if self.full else self.ptr
239
+ idxs = np.random.randint(0, size, size=batch_size)
240
+ return (
241
+ self.obs_buf[idxs],
242
+ self.act_buf[idxs],
243
+ self.rew_buf[idxs],
244
+ self.done_buf[idxs],
245
+ self.next_obs_buf[idxs],
246
+ )
247
+
248
+
249
+ if __name__ == "__main__":
250
+ args = tyro.cli(Args)
251
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
252
+
253
+ if args.track:
254
+ import wandb
255
+ wandb.init(
256
+ project=args.wandb_project_name,
257
+ entity=args.wandb_entity,
258
+ config=vars(args),
259
+ name=run_name,
260
+ monitor_gym=True,
261
+ save_code=True,
262
+ )
263
+ try:
264
+ wandb.define_metric("global_step")
265
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
266
+ wandb.define_metric(prefix, step_metric="global_step")
267
+ except Exception:
268
+ pass
269
+
270
+ random.seed(args.seed)
271
+ np.random.seed(args.seed)
272
+ torch.manual_seed(args.seed)
273
+ torch.backends.cudnn.deterministic = args.torch_deterministic
274
+
275
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
276
+
277
+ env = make_env(0, run_name, args.seed, args.grid_size, args.difficulty, args.capture_video)()
278
+ # Flattened grid only from Dict observation
279
+ sample_obs, _ = env.reset(seed=args.seed)
280
+ obs_dim = int(np.prod(sample_obs["observation"].shape))
281
+ act_dim = env.action_space.n
282
+
283
+ policy_net = QNetwork(obs_dim, act_dim, args.hidden_size).to(device)
284
+ target_net = QNetwork(obs_dim, act_dim, args.hidden_size).to(device)
285
+ target_net.load_state_dict(policy_net.state_dict())
286
+ target_net.eval()
287
+
288
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
289
+ criterion = nn.SmoothL1Loss()
290
+
291
+ rb = ReplayBuffer(args.buffer_size, obs_dim)
292
+
293
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
294
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
295
+
296
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
297
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
298
+ out_dir.mkdir(parents=True, exist_ok=True)
299
+ out_path = out_dir / "trajectories.jsonl"
300
+ env_eval = make_env_fn()
301
+ collected = 0
302
+ summary_returns = []
303
+ summary_success = []
304
+ with out_path.open("w") as f:
305
+ while collected < n_episodes:
306
+ obs_dict, _ = env_eval.reset(seed=args.seed + 100000 + collected)
307
+ state = obs_dict['observation']
308
+ mask = obs_dict['action_mask']
309
+ traj_states = [state.tolist()]
310
+ traj_actions = []
311
+ traj_rewards = []
312
+ traj_dones = []
313
+ traj_success = []
314
+ done = False
315
+ step_count = 0
316
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.grid_size * args.grid_size * 6)
317
+ while not done:
318
+ with torch.no_grad():
319
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
320
+ mask_t = torch.tensor(mask, dtype=torch.float32, device=device).unsqueeze(0)
321
+ masked_q = q + (mask_t - 1.0) * 1e8
322
+ action = int(torch.argmax(masked_q, dim=1).item())
323
+ next_obs_dict, reward, terminated, truncated, info = env_eval.step(action)
324
+ traj_actions.append(int(action))
325
+ traj_rewards.append(float(reward))
326
+ step_count += 1
327
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
328
+ traj_dones.append(d)
329
+ traj_success.append(bool((info or {}).get('success', False)))
330
+ state = next_obs_dict['observation']
331
+ mask = next_obs_dict['action_mask']
332
+ traj_states.append(state.tolist())
333
+ done = d
334
+ ep_ret = float(sum(traj_rewards))
335
+ ep_succ = bool(any(traj_success))
336
+ record = {
337
+ "states": traj_states,
338
+ "actions": traj_actions,
339
+ "rewards": traj_rewards,
340
+ "dones": traj_dones,
341
+ "success": traj_success,
342
+ "episode_return": ep_ret,
343
+ "episode_success": ep_succ,
344
+ }
345
+ f.write(json.dumps(record) + "\n")
346
+ collected += 1
347
+ summary_returns.append(ep_ret)
348
+ summary_success.append(1.0 if ep_succ else 0.0)
349
+ env_eval.close()
350
+ try:
351
+ metrics = {
352
+ "global_step": int(step_tag),
353
+ "episodes": int(n_episodes),
354
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
355
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
356
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
357
+ }
358
+ with (out_dir / "metrics.json").open("w") as mf:
359
+ json.dump(metrics, mf)
360
+ except Exception as e:
361
+ print(f"Warning: failed to write eval metrics: {e}")
362
+
363
+ global_step = 0
364
+ start_time = time.time()
365
+
366
+ obs_dict, _ = env.reset(seed=args.seed)
367
+ obs = obs_dict['observation']
368
+ mask = obs_dict['action_mask']
369
+ ep_success_window: List[float] = []
370
+
371
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
372
+
373
+ while global_step < args.total_timesteps:
374
+ epsilon = epsilon_by_step(global_step)
375
+ with torch.no_grad():
376
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
377
+ mask_t = torch.tensor(mask, dtype=torch.float32, device=device).unsqueeze(0)
378
+ masked_q = q_values + (mask_t - 1.0) * 1e8
379
+ greedy_action = int(torch.argmax(masked_q, dim=1).item())
380
+ if (np.random.rand() < epsilon) or (global_step < args.learning_starts):
381
+ valid = np.where(mask > 0.5)[0]
382
+ if len(valid) > 0:
383
+ action = int(np.random.choice(valid))
384
+ else:
385
+ action = int(np.random.randint(0, act_dim))
386
+ else:
387
+ action = greedy_action
388
+
389
+ next_obs_dict, reward, terminated, truncated, info = env.step(action)
390
+ done = bool(terminated) or bool(truncated)
391
+
392
+ next_obs = next_obs_dict['observation']
393
+ next_mask = next_obs_dict['action_mask']
394
+
395
+ rb.add(obs.astype(np.float32), int(action), float(reward), bool(done), next_obs.astype(np.float32))
396
+
397
+ obs = next_obs
398
+ mask = next_mask
399
+ global_step += 1
400
+
401
+ if done:
402
+ succ = bool((info or {}).get('success', False))
403
+ ep_success_window.append(1.0 if succ else 0.0)
404
+ if len(ep_success_window) > 100:
405
+ ep_success_window.pop(0)
406
+ if args.track:
407
+ try:
408
+ import wandb
409
+ wandb.log({
410
+ "global_step": int(global_step),
411
+ "rollout/success": float(1.0 if succ else 0.0),
412
+ "rollout/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else None,
413
+ }, step=global_step)
414
+ except Exception:
415
+ pass
416
+ obs_dict, _ = env.reset()
417
+ obs = obs_dict['observation']
418
+ mask = obs_dict['action_mask']
419
+
420
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
421
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
422
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
423
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
424
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
425
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
426
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
427
+
428
+ with torch.no_grad():
429
+ next_q = target_net(b_next_obs).max(dim=1)[0]
430
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
431
+
432
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
433
+ loss = criterion(current_q, target_q)
434
+
435
+ optimizer.zero_grad()
436
+ loss.backward()
437
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
438
+ optimizer.step()
439
+
440
+ if args.track:
441
+ try:
442
+ import wandb
443
+ wandb.log({
444
+ "global_step": int(global_step),
445
+ "train/loss": float(loss.item()),
446
+ "charts/epsilon": float(epsilon),
447
+ "perf/SPS": int(global_step / (time.time() - start_time)),
448
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
449
+ }, step=global_step)
450
+ except Exception:
451
+ pass
452
+
453
+ if global_step % args.target_network_frequency == 0:
454
+ target_net.load_state_dict(policy_net.state_dict())
455
+
456
+ if global_step % 1000 == 0:
457
+ sps = int(global_step / (time.time() - start_time))
458
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
459
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
460
+
461
+ if global_step == 1 or (global_step % eval_every_steps == 0):
462
+ try:
463
+ def eval_thunk():
464
+ return make_env(0, run_name, args.seed + 9999, args.grid_size, args.difficulty, False)()
465
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
466
+ if args.track:
467
+ try:
468
+ import wandb
469
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
470
+ if mpath.exists():
471
+ with mpath.open("r") as mf:
472
+ metrics = json.load(mf)
473
+ wandb.log({
474
+ "eval/success_rate": metrics.get("success_rate"),
475
+ "eval/avg_return": metrics.get("avg_return"),
476
+ "eval/std_return": metrics.get("std_return"),
477
+ "eval/episodes": metrics.get("episodes"),
478
+ }, step=global_step)
479
+ except Exception:
480
+ pass
481
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
482
+ except Exception as e:
483
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
484
+
485
+ env.close()
wandb/run-20260112_225250-k2i6dnry/files/config.yaml ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.23.0
4
+ code_path: code/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
5
+ e:
6
+ 42u9xwkov28g9dcp5599r8ywxjoe0be9:
7
+ args:
8
+ - --track
9
+ codePath: cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
10
+ codePathLocal: cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
11
+ cpu_count: 64
12
+ cpu_count_logical: 128
13
+ cudaVersion: "13.0"
14
+ disk:
15
+ /:
16
+ total: "2576980377600"
17
+ used: "3724312576"
18
+ email: haoyu-wa22@mails.tsinghua.edu.cn
19
+ executable: /root/local/miniconda3/envs/ragen/bin/python
20
+ git:
21
+ commit: 8d73639b99b38265453f898b8d6af7d4af50d56e
22
+ remote: https://github.com/mll-lab-nu/RAGEN.git
23
+ gpu: NVIDIA H100 80GB HBM3
24
+ gpu_count: 4
25
+ gpu_nvidia:
26
+ - architecture: Hopper
27
+ cudaCores: 16896
28
+ memoryTotal: "85520809984"
29
+ name: NVIDIA H100 80GB HBM3
30
+ uuid: GPU-cff454b9-f118-535b-5e1f-6d503e78e52e
31
+ - architecture: Hopper
32
+ cudaCores: 16896
33
+ memoryTotal: "85520809984"
34
+ name: NVIDIA H100 80GB HBM3
35
+ uuid: GPU-9e77c178-188c-f869-780e-858c20a7d322
36
+ - architecture: Hopper
37
+ cudaCores: 16896
38
+ memoryTotal: "85520809984"
39
+ name: NVIDIA H100 80GB HBM3
40
+ uuid: GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9
41
+ - architecture: Hopper
42
+ cudaCores: 16896
43
+ memoryTotal: "85520809984"
44
+ name: NVIDIA H100 80GB HBM3
45
+ uuid: GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7
46
+ host: pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0
47
+ memory:
48
+ total: "2163639439360"
49
+ os: Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35
50
+ program: /mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py
51
+ python: CPython 3.10.19
52
+ root: /mnt/general/wanghy/RAGEN
53
+ startedAt: "2026-01-12T14:52:50.232875Z"
54
+ writerId: 42u9xwkov28g9dcp5599r8ywxjoe0be9
55
+ m:
56
+ - "1": global_step
57
+ "6":
58
+ - 3
59
+ "7": []
60
+ - "2": charts/*
61
+ "5": 1
62
+ "6":
63
+ - 1
64
+ "7": []
65
+ - "2": perf/*
66
+ "5": 1
67
+ "6":
68
+ - 1
69
+ "7": []
70
+ - "2": train/*
71
+ "5": 1
72
+ "6":
73
+ - 1
74
+ "7": []
75
+ - "2": rollout/*
76
+ "5": 1
77
+ "6":
78
+ - 1
79
+ "7": []
80
+ - "2": eval/*
81
+ "5": 1
82
+ "6":
83
+ - 1
84
+ "7": []
85
+ - "2": losses/*
86
+ "5": 1
87
+ "6":
88
+ - 1
89
+ "7": []
90
+ python_version: 3.10.19
91
+ t:
92
+ "1":
93
+ - 1
94
+ - 11
95
+ - 30
96
+ - 49
97
+ - 50
98
+ - 51
99
+ - 105
100
+ "2":
101
+ - 1
102
+ - 11
103
+ - 30
104
+ - 49
105
+ - 50
106
+ - 51
107
+ - 105
108
+ "3":
109
+ - 7
110
+ - 13
111
+ - 16
112
+ - 61
113
+ "4": 3.10.19
114
+ "5": 0.23.0
115
+ "6": 4.57.3
116
+ "12": 0.23.0
117
+ "13": linux-x86_64
118
+ batch_size:
119
+ value: 128
120
+ buffer_size:
121
+ value: 400000
122
+ capture_video:
123
+ value: false
124
+ cuda:
125
+ value: true
126
+ difficulty:
127
+ value: easy
128
+ end_e:
129
+ value: 0.05
130
+ env_id:
131
+ value: SudokuDQN
132
+ eval_episodes:
133
+ value: 4000
134
+ eval_splits:
135
+ value: 2
136
+ exp_name:
137
+ value: dqn_sudoku
138
+ exploration_fraction:
139
+ value: 0.2
140
+ gamma:
141
+ value: 0.99
142
+ grid_size:
143
+ value: 4
144
+ hidden_size:
145
+ value: 256
146
+ learning_rate:
147
+ value: 0.0003
148
+ learning_starts:
149
+ value: 10000
150
+ seed:
151
+ value: 1
152
+ start_e:
153
+ value: 1
154
+ target_network_frequency:
155
+ value: 4000
156
+ torch_deterministic:
157
+ value: true
158
+ total_timesteps:
159
+ value: 200000
160
+ track:
161
+ value: true
162
+ train_frequency:
163
+ value: 1
164
+ wandb_entity:
165
+ value: null
166
+ wandb_project_name:
167
+ value: cleanRL
wandb/run-20260112_225250-k2i6dnry/files/diff.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_225250-k2i6dnry/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_225250-k2i6dnry/files/requirements.txt ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ colorama==0.4.6
2
+ psutil==7.1.3
3
+ ragen==0.1
4
+ Farama-Notifications==0.0.4
5
+ MarkupSafe==2.1.5
6
+ PyJWT==2.10.1
7
+ PySocks==1.7.1
8
+ absl-py==2.3.1
9
+ accelerate==1.12.0
10
+ aiohappyeyeballs==2.6.1
11
+ aiohttp==3.13.2
12
+ aiohttp-cors==0.8.1
13
+ aiosignal==1.4.0
14
+ airportsdata==20250909
15
+ annotated-doc==0.0.4
16
+ annotated-types==0.7.0
17
+ anthropic==0.75.0
18
+ antlr4-python3-runtime==4.9.3
19
+ anyio==4.12.0
20
+ astor==0.8.1
21
+ asttokens==3.0.1
22
+ async-timeout==5.0.1
23
+ attrs==25.4.0
24
+ beautifulsoup4==4.14.3
25
+ black==25.11.0
26
+ blake3==1.0.8
27
+ blinker==1.9.0
28
+ blis==1.3.3
29
+ cachetools==6.2.2
30
+ catalogue==2.0.10
31
+ certifi==2025.11.12
32
+ cffi==2.0.0
33
+ charset-normalizer==3.4.4
34
+ cleantext==1.1.4
35
+ click==8.2.1
36
+ cloudpathlib==0.23.0
37
+ cloudpickle==3.1.2
38
+ codetiming==1.4.0
39
+ colorama==0.4.6
40
+ coloredlogs==15.0.1
41
+ colorful==0.5.8
42
+ compressed-tensors==0.9.3
43
+ confection==0.1.5
44
+ contourpy==1.3.2
45
+ cryptography==46.0.3
46
+ cupy-cuda12x==13.6.0
47
+ cycler==0.12.1
48
+ cymem==2.0.13
49
+ Cython==3.2.2
50
+ datasets==4.4.1
51
+ debugpy==1.8.17
52
+ decorator==5.2.1
53
+ Deprecated==1.3.1
54
+ depyf==0.18.0
55
+ dill==0.4.0
56
+ diskcache==5.6.3
57
+ distlib==0.4.0
58
+ distro==1.9.0
59
+ dnspython==2.8.0
60
+ docstring_parser==0.17.0
61
+ einops==0.8.1
62
+ email-validator==2.3.0
63
+ eval_type_backport==0.2.2
64
+ exceptiongroup==1.3.1
65
+ executing==2.2.1
66
+ faiss-gpu==1.7.2
67
+ fastapi==0.123.1
68
+ fastapi-cli==0.0.16
69
+ fastapi-cloud-cli==0.5.2
70
+ fastar==0.8.0
71
+ fastrlock==0.8.3
72
+ filelock==3.19.1
73
+ flash_attn==2.8.3
74
+ Flask==3.1.2
75
+ flatbuffers==25.9.23
76
+ fonttools==4.61.0
77
+ frozenlist==1.8.0
78
+ fsspec==2025.9.0
79
+ gdown==5.2.0
80
+ gguf==0.17.1
81
+ gitdb==4.0.12
82
+ GitPython==3.1.45
83
+ google-api-core==2.28.1
84
+ google-auth==2.43.0
85
+ googleapis-common-protos==1.72.0
86
+ grpcio==1.76.0
87
+ gym==0.26.2
88
+ gym-notices==0.1.0
89
+ gym-sokoban==0.0.6
90
+ gymnasium==1.2.2
91
+ h11==0.16.0
92
+ hf-xet==1.2.0
93
+ html2text==2025.4.15
94
+ httpcore==1.0.9
95
+ httptools==0.7.1
96
+ httpx==0.28.1
97
+ httpx-sse==0.4.3
98
+ huggingface-hub==0.36.0
99
+ humanfriendly==10.0
100
+ hydra-core==1.3.2
101
+ idna==3.11
102
+ ImageIO==2.37.2
103
+ importlib_metadata==8.0.0
104
+ interegular==0.3.3
105
+ ipython==8.37.0
106
+ itsdangerous==2.2.0
107
+ jedi==0.19.2
108
+ Jinja2==3.1.6
109
+ jiter==0.12.0
110
+ joblib==1.5.2
111
+ jsonschema==4.25.1
112
+ jsonschema-specifications==2025.9.1
113
+ kimina-client==0.2.1
114
+ kiwisolver==1.4.9
115
+ lark==1.2.2
116
+ llguidance==0.7.30
117
+ llvmlite==0.44.0
118
+ lm-format-enforcer==0.10.12
119
+ loguru==0.7.3
120
+ Markdown==3.10
121
+ markdown-it-py==4.0.0
122
+ matplotlib==3.10.7
123
+ matplotlib-inline==0.2.1
124
+ mcp==1.22.0
125
+ mdurl==0.1.2
126
+ mistral_common==1.8.6
127
+ mpmath==1.3.0
128
+ msgpack==1.1.2
129
+ msgspec==0.20.0
130
+ multidict==6.7.0
131
+ multiprocess==0.70.18
132
+ murmurhash==1.0.15
133
+ mypy_extensions==1.1.0
134
+ nest-asyncio==1.6.0
135
+ networkx==3.3
136
+ ninja==1.13.0
137
+ nltk==3.9.2
138
+ numba==0.61.2
139
+ numpy==1.26.4
140
+ nvidia-cublas-cu12==12.4.5.8
141
+ nvidia-cuda-cupti-cu12==12.4.127
142
+ nvidia-cuda-nvrtc-cu12==12.4.127
143
+ nvidia-cuda-runtime-cu12==12.4.127
144
+ nvidia-cudnn-cu12==9.1.0.70
145
+ nvidia-cufft-cu12==11.2.1.3
146
+ nvidia-curand-cu12==10.3.5.147
147
+ nvidia-cusolver-cu12==11.6.1.9
148
+ nvidia-cusparse-cu12==12.3.1.170
149
+ nvidia-cusparselt-cu12==0.6.2
150
+ nvidia-nccl-cu12==2.21.5
151
+ nvidia-nvjitlink-cu12==12.4.127
152
+ nvidia-nvtx-cu12==12.4.127
153
+ omegaconf==2.3.0
154
+ onnxruntime==1.23.2
155
+ openai==2.8.1
156
+ opencensus==0.11.4
157
+ opencensus-context==0.1.3
158
+ opencv-python-headless==4.12.0.88
159
+ opentelemetry-api==1.38.0
160
+ opentelemetry-exporter-otlp==1.26.0
161
+ opentelemetry-exporter-otlp-proto-common==1.26.0
162
+ opentelemetry-exporter-otlp-proto-grpc==1.26.0
163
+ opentelemetry-exporter-otlp-proto-http==1.26.0
164
+ opentelemetry-exporter-prometheus==0.59b0
165
+ opentelemetry-proto==1.26.0
166
+ opentelemetry-sdk==1.38.0
167
+ opentelemetry-semantic-conventions==0.59b0
168
+ opentelemetry-semantic-conventions-ai==0.4.13
169
+ orjson==3.11.4
170
+ outlines==0.1.11
171
+ outlines_core==0.1.26
172
+ packaging==25.0
173
+ pandas==2.3.3
174
+ parso==0.8.5
175
+ partial-json-parser==0.2.1.1.post7
176
+ pathspec==0.12.1
177
+ peft==0.18.0
178
+ pexpect==4.9.0
179
+ pillow==11.3.0
180
+ pip==25.3
181
+ platformdirs==4.5.0
182
+ preshed==3.0.12
183
+ prometheus_client==0.23.1
184
+ prometheus-fastapi-instrumentator==7.1.0
185
+ prompt_toolkit==3.0.52
186
+ propcache==0.4.1
187
+ proto-plus==1.26.1
188
+ protobuf==4.25.8
189
+ psutil==7.1.3
190
+ ptyprocess==0.7.0
191
+ pure_eval==0.2.3
192
+ py-cpuinfo==9.0.0
193
+ py-spy==0.4.1
194
+ pyarrow==22.0.0
195
+ pyasn1==0.6.1
196
+ pyasn1_modules==0.4.2
197
+ pybind11==3.0.1
198
+ pycountry==24.6.1
199
+ pycparser==2.23
200
+ pydantic==2.12.5
201
+ pydantic_core==2.41.5
202
+ pydantic-extra-types==2.10.6
203
+ pydantic-settings==2.12.0
204
+ pygame==2.6.1
205
+ Pygments==2.19.2
206
+ pyjnius==1.7.0
207
+ pylatexenc==2.10
208
+ pyparsing==3.2.5
209
+ pyserini==1.2.0
210
+ python-dateutil==2.9.0.post0
211
+ python-dotenv==1.2.1
212
+ python-json-logger==4.0.0
213
+ python-multipart==0.0.20
214
+ pytokens==0.3.0
215
+ pytz==2025.2
216
+ PyYAML==6.0.3
217
+ pyzmq==27.1.0
218
+ ragen==0.1
219
+ rank-bm25==0.2.2
220
+ RapidFuzz==3.14.3
221
+ ray==2.52.1
222
+ referencing==0.37.0
223
+ regex==2025.11.3
224
+ requests==2.32.5
225
+ rich==14.2.0
226
+ rich-toolkit==0.17.0
227
+ rignore==0.7.6
228
+ rpds-py==0.30.0
229
+ rsa==4.9.1
230
+ safetensors==0.7.0
231
+ scikit-learn==1.7.2
232
+ scipy==1.15.3
233
+ sentencepiece==0.2.1
234
+ sentry-sdk==2.46.0
235
+ setuptools==80.9.0
236
+ shellingham==1.5.4
237
+ six==1.17.0
238
+ smart_open==7.5.0
239
+ smmap==5.0.2
240
+ sniffio==1.3.1
241
+ soupsieve==2.8
242
+ spacy==3.8.11
243
+ spacy-legacy==3.0.12
244
+ spacy-loggers==1.0.5
245
+ srsly==2.5.2
246
+ sse-starlette==3.0.3
247
+ stack-data==0.6.3
248
+ starlette==0.50.0
249
+ sympy==1.13.1
250
+ tabulate==0.9.0
251
+ tenacity==9.1.2
252
+ tensorboard==2.20.0
253
+ tensorboard-data-server==0.7.2
254
+ tensordict==0.8.3
255
+ thefuzz==0.22.1
256
+ thinc==8.3.10
257
+ threadpoolctl==3.6.0
258
+ tiktoken==0.12.0
259
+ together==1.5.31
260
+ tokenizers==0.22.1
261
+ tomli==2.3.0
262
+ torch==2.6.0+cu124
263
+ torchaudio==2.6.0
264
+ torchdata==0.11.0
265
+ torchvision==0.21.0
266
+ tqdm==4.67.1
267
+ traitlets==5.14.3
268
+ transformers==4.57.3
269
+ triton==3.2.0
270
+ typer==0.19.2
271
+ typer-slim==0.20.0
272
+ typing_extensions==4.15.0
273
+ typing-inspection==0.4.2
274
+ tzdata==2025.2
275
+ urllib3==2.5.0
276
+ uvicorn==0.38.0
277
+ uvloop==0.22.1
278
+ verl==0.5.0.dev0
279
+ virtualenv==20.35.4
280
+ vllm==0.8.5
281
+ wandb==0.23.0
282
+ wasabi==1.1.3
283
+ watchfiles==1.1.1
284
+ wcwidth==0.2.14
285
+ weasel==0.4.3
286
+ websockets==15.0.1
287
+ Werkzeug==3.1.4
288
+ wheel==0.45.1
289
+ wrapt==2.0.1
290
+ xformers==0.0.29.post2
291
+ xgrammar==0.1.18
292
+ xxhash==3.6.0
293
+ yarl==1.22.0
294
+ zipp==3.23.0
295
+ typeguard==4.4.4
296
+ tyro==1.0.3
297
+ verl==0.5.0.dev0
298
+ autocommand==2.2.2
299
+ backports.tarfile==1.2.0
300
+ importlib_metadata==8.0.0
301
+ inflect==7.3.1
302
+ jaraco.collections==5.1.0
303
+ jaraco.context==5.3.0
304
+ jaraco.functools==4.0.1
305
+ jaraco.text==3.12.1
306
+ more-itertools==10.3.0
307
+ packaging==24.2
308
+ platformdirs==4.2.2
309
+ tomli==2.0.1
310
+ typeguard==4.3.0
311
+ typing_extensions==4.12.2
312
+ wheel==0.45.1
313
+ zipp==3.19.2
wandb/run-20260112_225250-k2i6dnry/files/wandb-metadata.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35",
3
+ "python": "CPython 3.10.19",
4
+ "startedAt": "2026-01-12T14:52:50.232875Z",
5
+ "args": [
6
+ "--track"
7
+ ],
8
+ "program": "/mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_sudoku.py",
9
+ "codePath": "cleanrl/cleanrl/scout_dqn/dqn_sudoku.py",
10
+ "codePathLocal": "cleanrl/cleanrl/scout_dqn/dqn_sudoku.py",
11
+ "git": {
12
+ "remote": "https://github.com/mll-lab-nu/RAGEN.git",
13
+ "commit": "8d73639b99b38265453f898b8d6af7d4af50d56e"
14
+ },
15
+ "email": "haoyu-wa22@mails.tsinghua.edu.cn",
16
+ "root": "/mnt/general/wanghy/RAGEN",
17
+ "host": "pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0",
18
+ "executable": "/root/local/miniconda3/envs/ragen/bin/python",
19
+ "cpu_count": 64,
20
+ "cpu_count_logical": 128,
21
+ "gpu": "NVIDIA H100 80GB HBM3",
22
+ "gpu_count": 4,
23
+ "disk": {
24
+ "/": {
25
+ "total": "2576980377600",
26
+ "used": "3724312576"
27
+ }
28
+ },
29
+ "memory": {
30
+ "total": "2163639439360"
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper",
38
+ "uuid": "GPU-cff454b9-f118-535b-5e1f-6d503e78e52e"
39
+ },
40
+ {
41
+ "name": "NVIDIA H100 80GB HBM3",
42
+ "memoryTotal": "85520809984",
43
+ "cudaCores": 16896,
44
+ "architecture": "Hopper",
45
+ "uuid": "GPU-9e77c178-188c-f869-780e-858c20a7d322"
46
+ },
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper",
52
+ "uuid": "GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9"
53
+ },
54
+ {
55
+ "name": "NVIDIA H100 80GB HBM3",
56
+ "memoryTotal": "85520809984",
57
+ "cudaCores": 16896,
58
+ "architecture": "Hopper",
59
+ "uuid": "GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7"
60
+ }
61
+ ],
62
+ "cudaVersion": "13.0",
63
+ "writerId": "42u9xwkov28g9dcp5599r8ywxjoe0be9"
64
+ }
wandb/run-20260112_225250-k2i6dnry/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"eval/success_rate":0.76425,"rollout/success_rate_100":0.71,"train/loss":2959.95068359375,"eval/episodes":4000,"charts/epsilon":0.05,"eval/std_return":6.09278240523162,"_timestamp":1.7682304639431205e+09,"rollout/success":1,"perf/SPS":230,"global_step":200000,"_step":200000,"eval/avg_return":12.58475,"_runtime":892.284096128,"_wandb":{"runtime":892},"train/learning_rate":0.0003}
wandb/run-20260112_225324-locrg3kr/files/code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DQN with Step Penalty & Time Limit Bootstrap for RAGEN Rubik's Cube 2x2
2
+ import os
3
+ import random
4
+ import time
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Tuple, Dict, Any, List
8
+ import json
9
+ import re
10
+
11
+ import gymnasium as gym
12
+ import numpy as np
13
+ import torch
14
+ import torch.nn as nn
15
+ import torch.optim as optim
16
+ import tyro
17
+
18
+ import sys
19
+ # 假设 ragen 库在当前目录的上两级,请根据实际情况调整
20
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../'))
21
+
22
+ from ragen.env.rubikscube.env import RubiksCube2x2Env
23
+ from ragen.env.rubikscube.config import RubiksCube2x2Config
24
+
25
+
26
+ class RubiksCubeWrapper(gym.Env):
27
+ metadata = {"render_modes": ["rgb_array", "human", "ansi"]}
28
+
29
+ def __init__(self, env: RubiksCube2x2Env):
30
+ super().__init__()
31
+ self._env = env
32
+ self._colors = ['W', 'O', 'G', 'R', 'B', 'Y']
33
+ self._color_to_idx = {c: i for i, c in enumerate(self._colors)}
34
+ self.observation_space = gym.spaces.Box(low=0.0, high=1.0, shape=(24 * len(self._colors),), dtype=np.float32)
35
+ self.action_space = gym.spaces.Discrete(12)
36
+ self._face_pat = re.compile(r"\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])\n\s*\[(?:\s*([A-Z])\s*,\s*([A-Z])\s*\])")
37
+
38
+ # [关键修改] 每步惩罚
39
+ # 如果20步都没解出来,累计惩罚是 20 * -0.05 = -1.0,抵消掉最后可能获得的 +1.0
40
+ # 这迫使 agent 寻找更短路径
41
+ self.step_penalty = -0.044
42
+
43
+ def _encode_obs(self, text_obs: str) -> np.ndarray:
44
+ faces_order = ["Up (U):", "Left (L):", "Front (F):", "Right (R):", "Back (B):", "Down (D):"]
45
+ lines = text_obs.splitlines()
46
+ blocks: List[str] = []
47
+ i = 0
48
+ while i < len(lines):
49
+ line = lines[i]
50
+ for header in faces_order:
51
+ if line.startswith(header):
52
+ content = line[len(header):].strip()
53
+ next_line = lines[i + 1] if i + 1 < len(lines) else ""
54
+ block = f"{content}\n{next_line}"
55
+ blocks.append(block)
56
+ break
57
+ i += 1
58
+ if len(blocks) != 6:
59
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
60
+ stickers: List[int] = []
61
+ for blk in blocks:
62
+ m = self._face_pat.search(blk)
63
+ if not m:
64
+ return np.zeros(24 * len(self._colors), dtype=np.float32)
65
+ c0, c1, c2, c3 = m.group(1), m.group(2), m.group(3), m.group(4)
66
+ stickers.extend([c0, c1, c2, c3])
67
+ grid = np.zeros((24, len(self._colors)), dtype=np.float32)
68
+ for idx, ch in enumerate(stickers):
69
+ cidx = self._color_to_idx.get(ch, None)
70
+ if cidx is not None:
71
+ grid[idx, cidx] = 1.0
72
+ return grid.reshape(-1)
73
+
74
+ def reset(self, *, seed: int | None = None, options: Dict[str, Any] | None = None):
75
+ text_obs = self._env.reset(seed=seed)
76
+ obs = self._encode_obs(text_obs)
77
+ return obs, {}
78
+
79
+ def step(self, action: int):
80
+ mapped = int(action) + 1
81
+ text_obs, reward, done, info = self._env.step(mapped)
82
+ obs = self._encode_obs(text_obs)
83
+ terminated = bool(done)
84
+ truncated = False
85
+
86
+ # [关键修改] 应用惩罚
87
+ # 此时 reward 包含原本的稀疏奖励 (0 或 1) 加上每步惩罚
88
+ reward = float(reward) + self.step_penalty
89
+
90
+ return obs, reward, terminated, truncated, info or {}
91
+
92
+ def render(self):
93
+ return self._env.render()
94
+
95
+ def close(self):
96
+ self._env.close()
97
+
98
+
99
+ @dataclass
100
+ class Args:
101
+ exp_name: str = os.path.basename(__file__)[: -len(".py")]
102
+ seed: int = 1
103
+ torch_deterministic: bool = True
104
+ cuda: bool = True
105
+ track: bool = True
106
+ wandb_project_name: str = "cleanRL"
107
+ wandb_entity: str | None = None
108
+ capture_video: bool = False
109
+
110
+ # Algorithm
111
+ env_id: str = "RubiksCube2x2DQN"
112
+ total_timesteps: int = 400_000
113
+ learning_rate: float = 2.5e-4
114
+ gamma: float = 0.99
115
+ batch_size: int = 128
116
+ buffer_size: int = 200_000
117
+ target_network_frequency: int = 4000
118
+ train_frequency: int = 4
119
+ learning_starts: int = 5000
120
+
121
+ # Epsilon-greedy
122
+ start_e: float = 1.0
123
+ end_e: float = 0.05
124
+ exploration_fraction: float = 0.2
125
+
126
+ # Model size
127
+ hidden_size: int = 256
128
+
129
+ # Rubik specific
130
+ scramble_depth: int = 3 # 初始难度
131
+ max_steps_env: int = 20 # 硬性时间限制
132
+
133
+ # Eval
134
+ eval_splits: int = 2
135
+ eval_episodes: int = 4000
136
+
137
+
138
+ def make_env(idx, run_name, seed, scramble_depth, max_steps_env, capture_video=False):
139
+ def thunk():
140
+ # [关键修改] 内部 max_steps 设为 1000,防止 env 内部发出 done=True
141
+ # 我们完全依赖外部 TimeLimit wrapper 来处理超时
142
+ config = RubiksCube2x2Config(scramble_depth=scramble_depth, max_steps=20, render_mode='text')
143
+ env = RubiksCube2x2Env(config)
144
+ env = RubiksCubeWrapper(env)
145
+ # 外部限制设为 20
146
+ env = gym.wrappers.TimeLimit(env, max_episode_steps=max_steps_env)
147
+ env = gym.wrappers.RecordEpisodeStatistics(env)
148
+ if capture_video and idx == 0:
149
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
150
+ return env
151
+ return thunk
152
+
153
+
154
+ def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
155
+ torch.nn.init.orthogonal_(layer.weight, std)
156
+ torch.nn.init.constant_(layer.bias, bias_const)
157
+ return layer
158
+
159
+
160
+ class QNetwork(nn.Module):
161
+ def __init__(self, obs_dim: int, act_dim: int, hidden: int):
162
+ super().__init__()
163
+ self.net = nn.Sequential(
164
+ layer_init(nn.Linear(obs_dim, hidden)),
165
+ nn.ReLU(),
166
+ layer_init(nn.Linear(hidden, hidden)),
167
+ nn.ReLU(),
168
+ layer_init(nn.Linear(hidden, act_dim), std=0.01),
169
+ )
170
+
171
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
172
+ return self.net(x)
173
+
174
+
175
+ class ReplayBuffer:
176
+ def __init__(self, capacity: int, obs_shape: Tuple[int, ...]):
177
+ self.capacity = capacity
178
+ self.ptr = 0
179
+ self.full = False
180
+ self.obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
181
+ self.next_obs_buf = np.zeros((capacity,) + obs_shape, dtype=np.float32)
182
+ self.act_buf = np.zeros((capacity,), dtype=np.int64)
183
+ self.rew_buf = np.zeros((capacity,), dtype=np.float32)
184
+ self.done_buf = np.zeros((capacity,), dtype=np.float32)
185
+
186
+ def add(self, obs: np.ndarray, act: int, rew: float, done: bool, next_obs: np.ndarray):
187
+ i = self.ptr
188
+ self.obs_buf[i] = obs
189
+ self.next_obs_buf[i] = next_obs
190
+ self.act_buf[i] = act
191
+ self.rew_buf[i] = rew
192
+ self.done_buf[i] = 1.0 if done else 0.0
193
+ self.ptr = (self.ptr + 1) % self.capacity
194
+ if self.ptr == 0:
195
+ self.full = True
196
+
197
+ def can_sample(self, batch_size: int) -> bool:
198
+ return (self.capacity if self.full else self.ptr) >= batch_size
199
+
200
+ def sample(self, batch_size: int):
201
+ size = self.capacity if self.full else self.ptr
202
+ idxs = np.random.randint(0, size, size=batch_size)
203
+ return (
204
+ self.obs_buf[idxs],
205
+ self.act_buf[idxs],
206
+ self.rew_buf[idxs],
207
+ self.done_buf[idxs],
208
+ self.next_obs_buf[idxs],
209
+ )
210
+
211
+
212
+ if __name__ == "__main__":
213
+ args = tyro.cli(Args)
214
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
215
+
216
+ if args.track:
217
+ import wandb
218
+ wandb.init(
219
+ project=args.wandb_project_name,
220
+ entity=args.wandb_entity,
221
+ config=vars(args),
222
+ name=run_name,
223
+ monitor_gym=True,
224
+ save_code=True,
225
+ )
226
+ try:
227
+ wandb.define_metric("global_step")
228
+ for prefix in ["train/*", "rollout/*", "eval/*", "losses/*", "charts/*", "perf/*"]:
229
+ wandb.define_metric(prefix, step_metric="global_step")
230
+ except Exception:
231
+ pass
232
+
233
+ random.seed(args.seed)
234
+ np.random.seed(args.seed)
235
+ torch.manual_seed(args.seed)
236
+ torch.backends.cudnn.deterministic = args.torch_deterministic
237
+
238
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
239
+
240
+ env = make_env(0, run_name, args.seed, args.scramble_depth, args.max_steps_env, args.capture_video)()
241
+ obs_shape = env.observation_space.shape
242
+ act_dim = env.action_space.n
243
+
244
+ policy_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
245
+ target_net = QNetwork(int(np.prod(obs_shape)), act_dim, args.hidden_size).to(device)
246
+ target_net.load_state_dict(policy_net.state_dict())
247
+ target_net.eval()
248
+
249
+ optimizer = optim.Adam(policy_net.parameters(), lr=args.learning_rate)
250
+ criterion = nn.SmoothL1Loss()
251
+
252
+ rb = ReplayBuffer(args.buffer_size, obs_shape)
253
+
254
+ exploration_steps = max(1, int(args.exploration_fraction * args.total_timesteps))
255
+ epsilon_by_step = lambda t: args.end_e + (args.start_e - args.end_e) * max(0.0, (exploration_steps - t) / exploration_steps)
256
+
257
+ # 评估函数
258
+ def collect_eval_trajectories(agent_model, make_env_fn, n_episodes, step_tag):
259
+ out_dir = Path(f"runs/{run_name}/trajectories/step_{step_tag}")
260
+ out_dir.mkdir(parents=True, exist_ok=True)
261
+ out_path = out_dir / "trajectories.jsonl"
262
+ env_eval = make_env_fn()
263
+ collected = 0
264
+ summary_returns = []
265
+ summary_success = []
266
+ with out_path.open("w") as f:
267
+ while collected < n_episodes:
268
+ state, _ = env_eval.reset(seed=args.seed + 100000 + collected)
269
+ traj_states = [np.asarray(state).tolist()]
270
+ traj_actions = []
271
+ traj_rewards = []
272
+ traj_dones = []
273
+ traj_success = []
274
+ done = False
275
+ step_count = 0
276
+ max_eval_steps = getattr(env_eval, '_max_episode_steps', None) or int(args.max_steps_env)
277
+ while not done:
278
+ with torch.no_grad():
279
+ q = agent_model(torch.tensor(state, dtype=torch.float32, device=device).unsqueeze(0))
280
+ action = int(torch.argmax(q, dim=1).item())
281
+ next_state, reward, terminated, truncated, info = env_eval.step(action)
282
+
283
+ traj_actions.append(int(action))
284
+ traj_rewards.append(float(reward))
285
+ step_count += 1
286
+ d = bool(terminated) or bool(truncated) or (step_count >= max_eval_steps)
287
+ traj_dones.append(d)
288
+ traj_success.append(bool((info or {}).get('success', False)))
289
+ state = next_state
290
+ traj_states.append(np.asarray(state).tolist())
291
+ done = d
292
+ ep_ret = float(sum(traj_rewards))
293
+ ep_succ = bool(any(traj_success))
294
+ record = {
295
+ "states": traj_states,
296
+ "actions": traj_actions,
297
+ "rewards": traj_rewards,
298
+ "dones": traj_dones,
299
+ "success": traj_success,
300
+ "episode_return": ep_ret,
301
+ "episode_success": ep_succ,
302
+ }
303
+ f.write(json.dumps(record) + "\n")
304
+ collected += 1
305
+ summary_returns.append(ep_ret)
306
+ summary_success.append(1.0 if ep_succ else 0.0)
307
+ env_eval.close()
308
+ try:
309
+ metrics = {
310
+ "global_step": int(step_tag),
311
+ "episodes": int(n_episodes),
312
+ "success_rate": float(np.mean(summary_success)) if len(summary_success) else 0.0,
313
+ "avg_return": float(np.mean(summary_returns)) if len(summary_returns) else 0.0,
314
+ "std_return": float(np.std(summary_returns)) if len(summary_returns) else 0.0,
315
+ }
316
+ with (out_dir / "metrics.json").open("w") as mf:
317
+ json.dump(metrics, mf)
318
+ except Exception as e:
319
+ print(f"Warning: failed to write eval metrics: {e}")
320
+
321
+ # 主训练循环
322
+ global_step = 0
323
+ start_time = time.time()
324
+
325
+ obs, _ = env.reset(seed=args.seed)
326
+ ep_return = 0.0
327
+ ep_len = 0
328
+ ep_success_window: List[float] = []
329
+
330
+ eval_every_steps = max(1, args.total_timesteps // args.eval_splits)
331
+
332
+ while global_step < args.total_timesteps:
333
+ epsilon = epsilon_by_step(global_step)
334
+ if np.random.rand() < epsilon or global_step < args.learning_starts:
335
+ action = env.action_space.sample()
336
+ else:
337
+ with torch.no_grad():
338
+ q_values = policy_net(torch.tensor(obs, dtype=torch.float32, device=device).unsqueeze(0))
339
+ action = int(torch.argmax(q_values, dim=1).item())
340
+
341
+ next_obs, reward, terminated, truncated, info = env.step(action)
342
+
343
+ # 判断是否需要 Reset (任何结束都 Reset)
344
+ real_done = bool(terminated) or bool(truncated)
345
+
346
+ # [核心逻辑]
347
+ # 1. 即使是 truncated (超时),done 也记为 False,以便进行 bootstrap (计算未来价值)
348
+ # 2. 只有 terminated (真正解开了),done 才记为 True
349
+ # 3. Step Penalty 已经包含在 reward 中,DQN 会学到"为了避免扣分,必须在未来几步内解决"
350
+ rb.add(
351
+ obs.astype(np.float32),
352
+ int(action),
353
+ float(reward),
354
+ bool(terminated), # 注意:只用 terminated
355
+ next_obs.astype(np.float32)
356
+ )
357
+
358
+ obs = next_obs
359
+ ep_return += float(reward)
360
+ ep_len += 1
361
+ global_step += 1
362
+
363
+ # 训练过程
364
+ if rb.can_sample(args.batch_size) and (global_step % args.train_frequency == 0) and (global_step > args.learning_starts):
365
+ batch_obs, batch_act, batch_rew, batch_done, batch_next_obs = rb.sample(args.batch_size)
366
+ b_obs = torch.tensor(batch_obs, dtype=torch.float32, device=device)
367
+ b_act = torch.tensor(batch_act, dtype=torch.int64, device=device)
368
+ b_rew = torch.tensor(batch_rew, dtype=torch.float32, device=device)
369
+ b_done = torch.tensor(batch_done, dtype=torch.float32, device=device)
370
+ b_next_obs = torch.tensor(batch_next_obs, dtype=torch.float32, device=device)
371
+
372
+ with torch.no_grad():
373
+ next_q = target_net(b_next_obs).max(dim=1)[0]
374
+ target_q = b_rew + args.gamma * (1.0 - b_done) * next_q
375
+
376
+ current_q = policy_net(b_obs).gather(1, b_act.view(-1, 1)).squeeze(1)
377
+ loss = criterion(current_q, target_q)
378
+
379
+ optimizer.zero_grad()
380
+ loss.backward()
381
+ nn.utils.clip_grad_norm_(policy_net.parameters(), max_norm=10.0)
382
+ optimizer.step()
383
+
384
+ if args.track:
385
+ try:
386
+ import wandb
387
+ wandb.log({
388
+ "global_step": int(global_step),
389
+ "train/loss": float(loss.item()),
390
+ "charts/epsilon": float(epsilon),
391
+ "perf/SPS": int(global_step / (time.time() - start_time)),
392
+ "train/learning_rate": float(optimizer.param_groups[0]["lr"]),
393
+ }, step=global_step)
394
+ except Exception:
395
+ pass
396
+
397
+ # 结束时 Reset
398
+ if real_done:
399
+ succ = bool((info or {}).get('success', False))
400
+ ep_success_window.append(1.0 if succ else 0.0)
401
+ if len(ep_success_window) > 100:
402
+ ep_success_window.pop(0)
403
+ if args.track:
404
+ try:
405
+ import wandb
406
+ wandb.log({
407
+ "global_step": int(global_step),
408
+ "train/episodic_return": float(ep_return),
409
+ "train/episodic_length": int(ep_len),
410
+ "train/success": float(1.0 if succ else 0.0),
411
+ "train/success_rate_100": float(np.mean(ep_success_window)) if len(ep_success_window) >= 1 else None,
412
+ }, step=global_step)
413
+ except Exception:
414
+ pass
415
+ obs, _ = env.reset()
416
+ ep_return, ep_len = 0.0, 0
417
+
418
+ # 更新目标网络
419
+ if global_step % args.target_network_frequency == 0:
420
+ target_net.load_state_dict(policy_net.state_dict())
421
+
422
+ # 打印日志
423
+ if global_step % 1000 == 0:
424
+ sps = int(global_step / (time.time() - start_time))
425
+ sr100 = float(np.mean(ep_success_window)) if len(ep_success_window) > 0 else 0.0
426
+ print(f"Step {global_step} | SPS: {sps} | Epsilon: {epsilon:.3f} | SR@100: {sr100:.3f}")
427
+
428
+ # 评估
429
+ if global_step == 1 or (global_step % eval_every_steps == 0):
430
+ try:
431
+ def eval_thunk():
432
+ # 评估环境也同样设置:内部1000,外部20
433
+ return make_env(0, run_name, args.seed + 9999, args.scramble_depth, args.max_steps_env, False)()
434
+ collect_eval_trajectories(policy_net, eval_thunk, n_episodes=args.eval_episodes, step_tag=global_step)
435
+ if args.track:
436
+ try:
437
+ import wandb
438
+ mpath = Path(f"runs/{run_name}/trajectories/step_{global_step}/metrics.json")
439
+ if mpath.exists():
440
+ with mpath.open("r") as mf:
441
+ metrics = json.load(mf)
442
+ wandb.log({
443
+ "eval/success_rate": metrics.get("success_rate"),
444
+ "eval/avg_return": metrics.get("avg_return"),
445
+ "eval/std_return": metrics.get("std_return"),
446
+ "eval/episodes": metrics.get("episodes"),
447
+ }, step=global_step)
448
+ except Exception:
449
+ pass
450
+ print(f"Collected {args.eval_episodes} eval trajectories at step {global_step}")
451
+ except Exception as e:
452
+ print(f"Warning: eval trajectory collection failed at step {global_step}: {e}")
453
+
454
+ env.close()
wandb/run-20260112_225324-locrg3kr/files/config.yaml ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.23.0
4
+ code_path: code/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
5
+ e:
6
+ 38xx0mqyxzx0knb11tf2de7k74fbhknb:
7
+ args:
8
+ - --track
9
+ codePath: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
10
+ codePathLocal: cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
11
+ cpu_count: 64
12
+ cpu_count_logical: 128
13
+ cudaVersion: "13.0"
14
+ disk:
15
+ /:
16
+ total: "2576980377600"
17
+ used: "3724316672"
18
+ email: haoyu-wa22@mails.tsinghua.edu.cn
19
+ executable: /root/local/miniconda3/envs/ragen/bin/python
20
+ git:
21
+ commit: 8d73639b99b38265453f898b8d6af7d4af50d56e
22
+ remote: https://github.com/mll-lab-nu/RAGEN.git
23
+ gpu: NVIDIA H100 80GB HBM3
24
+ gpu_count: 4
25
+ gpu_nvidia:
26
+ - architecture: Hopper
27
+ cudaCores: 16896
28
+ memoryTotal: "85520809984"
29
+ name: NVIDIA H100 80GB HBM3
30
+ uuid: GPU-cff454b9-f118-535b-5e1f-6d503e78e52e
31
+ - architecture: Hopper
32
+ cudaCores: 16896
33
+ memoryTotal: "85520809984"
34
+ name: NVIDIA H100 80GB HBM3
35
+ uuid: GPU-9e77c178-188c-f869-780e-858c20a7d322
36
+ - architecture: Hopper
37
+ cudaCores: 16896
38
+ memoryTotal: "85520809984"
39
+ name: NVIDIA H100 80GB HBM3
40
+ uuid: GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9
41
+ - architecture: Hopper
42
+ cudaCores: 16896
43
+ memoryTotal: "85520809984"
44
+ name: NVIDIA H100 80GB HBM3
45
+ uuid: GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7
46
+ host: pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0
47
+ memory:
48
+ total: "2163639439360"
49
+ os: Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35
50
+ program: /mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py
51
+ python: CPython 3.10.19
52
+ root: /mnt/general/wanghy/RAGEN
53
+ startedAt: "2026-01-12T14:53:24.482263Z"
54
+ writerId: 38xx0mqyxzx0knb11tf2de7k74fbhknb
55
+ m:
56
+ - "1": global_step
57
+ "6":
58
+ - 3
59
+ "7": []
60
+ - "2": eval/*
61
+ "5": 1
62
+ "6":
63
+ - 1
64
+ "7": []
65
+ - "2": losses/*
66
+ "5": 1
67
+ "6":
68
+ - 1
69
+ "7": []
70
+ - "2": charts/*
71
+ "5": 1
72
+ "6":
73
+ - 1
74
+ "7": []
75
+ - "2": perf/*
76
+ "5": 1
77
+ "6":
78
+ - 1
79
+ "7": []
80
+ - "2": train/*
81
+ "5": 1
82
+ "6":
83
+ - 1
84
+ "7": []
85
+ - "2": rollout/*
86
+ "5": 1
87
+ "6":
88
+ - 1
89
+ "7": []
90
+ python_version: 3.10.19
91
+ t:
92
+ "1":
93
+ - 1
94
+ - 11
95
+ - 30
96
+ - 49
97
+ - 50
98
+ - 51
99
+ - 105
100
+ "2":
101
+ - 1
102
+ - 11
103
+ - 30
104
+ - 49
105
+ - 50
106
+ - 51
107
+ - 105
108
+ "3":
109
+ - 7
110
+ - 13
111
+ - 16
112
+ - 61
113
+ "4": 3.10.19
114
+ "5": 0.23.0
115
+ "6": 4.57.3
116
+ "12": 0.23.0
117
+ "13": linux-x86_64
118
+ batch_size:
119
+ value: 128
120
+ buffer_size:
121
+ value: 200000
122
+ capture_video:
123
+ value: false
124
+ cuda:
125
+ value: true
126
+ end_e:
127
+ value: 0.05
128
+ env_id:
129
+ value: RubiksCube2x2DQN
130
+ eval_episodes:
131
+ value: 4000
132
+ eval_splits:
133
+ value: 2
134
+ exp_name:
135
+ value: dqn_rubikscube
136
+ exploration_fraction:
137
+ value: 0.2
138
+ gamma:
139
+ value: 0.99
140
+ hidden_size:
141
+ value: 256
142
+ learning_rate:
143
+ value: 0.00025
144
+ learning_starts:
145
+ value: 5000
146
+ max_steps_env:
147
+ value: 20
148
+ scramble_depth:
149
+ value: 3
150
+ seed:
151
+ value: 1
152
+ start_e:
153
+ value: 1
154
+ target_network_frequency:
155
+ value: 4000
156
+ torch_deterministic:
157
+ value: true
158
+ total_timesteps:
159
+ value: 400000
160
+ track:
161
+ value: true
162
+ train_frequency:
163
+ value: 4
164
+ wandb_entity:
165
+ value: null
166
+ wandb_project_name:
167
+ value: cleanRL
wandb/run-20260112_225324-locrg3kr/files/diff.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_225324-locrg3kr/files/diff_8d73639b99b38265453f898b8d6af7d4af50d56e.patch ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/config/base.yaml b/config/base.yaml
2
+ index a1659e4..6029703 100644
3
+ --- a/config/base.yaml
4
+ +++ b/config/base.yaml
5
+ @@ -9,15 +9,16 @@ seed:
6
+ train: 10000
7
+ val: 123
8
+
9
+ -micro_batch_size_per_gpu: 4
10
+ +micro_batch_size_per_gpu: 1
11
+ ppo_mini_batch_size: 32
12
+ -model_path: Qwen/Qwen2.5-3B-Instruct
13
+ +model_path:
14
+ +# /mnt/general/share/model/Qwen/Qwen2.5-0.5B-Instruct
15
+ enable_response_mask: True # Enabling response mask could improve stability of rollout/old_log_prob, as P(st|history) are no longer calculated in loss here. See https://docs.google.com/document/d/1bg7obeiKTExuHHBl5uOiSpec5uLDZ2Tgvxy6li5pHX4/edit?usp=sharing for more details.
16
+ grpo_advantage_length_weight: False # if you do not enable this and critic/advantage_estimator is GRPO, and the critic/advantages/mean is too low, then you can try enabling this to encourage reasoning and forbid collapse
17
+
18
+ lora:
19
+ rank: 0
20
+ - alpha: 64
21
+ + alpha: 16
22
+ target_modules: all-linear
23
+
24
+ actor_rollout_ref:
25
+ @@ -26,6 +27,7 @@ actor_rollout_ref:
26
+ lora_rank: ${lora.rank}
27
+ lora_alpha: ${lora.alpha}
28
+ target_modules: ${lora.target_modules}
29
+ + torch_dtype: bfloat16
30
+ actor:
31
+ ppo_mini_batch_size: ${ppo_mini_batch_size} # by default, ppo_mini_batch_size = train_batch_size / 4
32
+ ppo_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
33
+ @@ -46,11 +48,11 @@ actor_rollout_ref:
34
+ name: vllm
35
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu} # following micro_batch_size_per_gpu
36
+ tensor_model_parallel_size: 1
37
+ - max_model_len: 3600
38
+ + max_model_len: 16384 #3600 why** 14400
39
+ prompt_length: 1 # useless. Just put it here
40
+ response_length: 400 # single-turn response length
41
+ - gpu_memory_utilization: 0.5
42
+ - max_num_batched_tokens: 8192 # set only when enable_chunked_prefill is true
43
+ + gpu_memory_utilization: 0.7
44
+ + max_num_batched_tokens: 16384 # set only when enable_chunked_prefill is true
45
+ temperature: 1
46
+ rollout_filter_ratio: 0.25
47
+ rollout_filter_type: largest # smallest or largest
48
+ @@ -90,26 +92,28 @@ algorithm:
49
+ kl_coef: 0.000
50
+
51
+ trainer:
52
+ - project_name: ragen_latest
53
+ + project_name:
54
+ experiment_name: test
55
+ local_log_dir: "results/"
56
+ - save_freq: 100
57
+ + save_freq: -1
58
+ total_training_steps: 200
59
+ validation_steps: 1 # validation instances = validation_steps * val_env_groups * group_size
60
+ val_before_train: True
61
+ n_gpus_per_node: 1
62
+ test_freq: 10
63
+ generations_to_log_to_wandb:
64
+ + train: 128
65
+ val: 20
66
+ logger: [ 'console', 'wandb' ]
67
+ max_actor_ckpt_to_keep: 1
68
+ max_critic_ckpt_to_keep: 1
69
+ + default_local_dir: /mnt/general/wanghy/RAGEN/saves/
70
+
71
+ agent_proxy:
72
+ max_context_window: -1 # set a value > 0 to enable context window for long trajectory
73
+ - max_turn: 5
74
+ + max_turn: 25 #25 why** 700
75
+ action_sep: "||"
76
+ - max_actions_per_turn: 2 # how many actions can be output at most in a single turn
77
+ + max_actions_per_turn: 1 # how many actions can be output at most in a single turn
78
+ use_turn_scores: False # important to GAE when applying token-level rewards to token-level advantages. If False, will take the sum of scores as the reward for the last turn.
79
+ enable_think: True # False -> no think RL
80
+ reward_normalization:
81
+ @@ -126,11 +130,11 @@ es_manager:
82
+ tags: ["CoordSokoban"]
83
+ n_groups: [8] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
84
+ val:
85
+ - env_groups: 32
86
+ - group_size: 16 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
87
+ + env_groups: 256
88
+ + group_size: 1 # should be set to 1 because when val temperature is set to 0 and group size > 1, there will be repetitive prompts which leads to same trajectory.
89
+ env_configs:
90
+ tags: ["CoordSokoban"]
91
+ - n_groups: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
92
+ + n_groups: [256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
93
+
94
+ ctx_manager:
95
+ generation: # go to vllm
96
+ diff --git a/config/envs.yaml b/config/envs.yaml
97
+ index 1002ac8..d258d15 100644
98
+ --- a/config/envs.yaml
99
+ +++ b/config/envs.yaml
100
+ @@ -2,6 +2,7 @@ custom_envs:
101
+ SimpleSokoban:
102
+ env_type: sokoban
103
+ max_actions_per_traj: 10 # used in environment state manager to control the actual max actions executed per trajectory
104
+ + # ORIGNAL env_instruction
105
+ env_instruction: |
106
+ You are solving the Sokoban puzzle.
107
+ You are the player and you need to push all boxes to targets.
108
+ @@ -12,7 +13,7 @@ custom_envs:
109
+ env_config: # keys should be a subset of SokobanConfig
110
+ dim_x: 6
111
+ dim_y: 6
112
+ - num_boxes: 1
113
+ + num_boxes: 2
114
+ max_steps: 100
115
+
116
+ LargerSokoban:
117
+ @@ -65,7 +66,7 @@ custom_envs:
118
+ env_config: # keys should be a subset of SokobanConfig
119
+ dim_x: 6
120
+ dim_y: 6
121
+ - num_boxes: 1
122
+ + num_boxes: 2
123
+ max_steps: 100
124
+ observation_format: "grid_coord"
125
+
126
+ @@ -111,14 +112,14 @@ custom_envs:
127
+
128
+ FrozenLake:
129
+ env_type: frozen_lake
130
+ - max_actions_per_traj: 10
131
+ + max_actions_per_traj: 25
132
+ env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. Example answer format: <think>To forbid the hole and go to the target, I should go left then go up.</think><answer>Left || Up</answer>"
133
+ max_tokens: 100
134
+ env_config: null
135
+
136
+ CoordFrozenLake:
137
+ env_type: frozen_lake
138
+ - max_actions_per_traj: 10
139
+ + max_actions_per_traj: 25
140
+ env_instruction: |
141
+ You are solving the FrozenLake puzzle. The observation includes both a symbol grid and zero-indexed coordinates for the start, goal, player, and any holes.
142
+ Coordinates range from the top-left corner (0, 0) to the bottom-right corner (5, 5).
143
+ @@ -195,4 +196,80 @@ custom_envs:
144
+ max_actions_per_traj: 30
145
+ env_instruction: "You are a Lean theorem prover. Given a Lean theorem statement, propose a sequence of tactics that completes the proof. Think step by step about which tactics to apply next. Provide tactics separated by '||', for example <answer>intro || simp || rfl</answer>."
146
+ max_tokens: 512
147
+ - env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
148
+
149
+ + env_config: null # Please refer to ragen/env/lean/config.py for a full list of parameters.
150
+ +
151
+ +
152
+ + game_2048:
153
+ + env_type: game_2048
154
+ + max_actions_per_traj: 700
155
+ + env_instruction: |
156
+ + You are playing the 2048 game on a 4x4 grid. Merge equal tiles by sliding Up, Right, Down, or Left.
157
+ + If a move is invalid (no tiles move), a small penalty is applied. Respond with a single action.
158
+ + Example: <answer>Up</answer>
159
+ + max_tokens: 8192
160
+ + env_config: null
161
+ +
162
+ + blackjack:
163
+ + env_type: blackjack
164
+ + max_actions_per_traj: 10
165
+ + env_instruction: |
166
+ + You are playing Blackjack against a dealer. The dealer must hit on 16 or less and stand on 17 or more.
167
+ + Choose either Stick or Hit. Respond with a single action.
168
+ + Example: <answer>Hit</answer>
169
+ + max_tokens: 64
170
+ + env_config: null
171
+ +
172
+ + rubikscube:
173
+ + env_type: rubikscube
174
+ + max_actions_per_traj: 20
175
+ + env_instruction: |
176
+ + You are solving a 2x2 Rubik's Cube (Pocket Cube). The goal is to restore the cube so that each of the faces consists of a single, unique color.
177
+ + Available actions use standard Singmaster notation for face rotations: U, U', D, D', L, L', R, R', F, F', B, B'.
178
+ + - Faces: U (Up), D (Down), L (Left), R (Right), F (Front), B (Back).
179
+ + - Modifiers: A letter alone means 90° clockwise (e.g., 'R'). A letter with prime (') means 90° counter-clockwise (e.g., "R'").
180
+ + Respond with a sequence of actions separated by "||".
181
+ + Example: <answer>U</answer>
182
+ + max_tokens: 96
183
+ + env_config:
184
+ + scramble_depth: 3
185
+ + max_steps: 20
186
+ + render_mode: "text"
187
+ +
188
+ + SimpleSudoku:
189
+ + env_type: sudoku
190
+ + max_actions_per_traj: 20
191
+ + env_instruction: |
192
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 2x2 box contains the numbers 1-4 without repetition.
193
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
194
+ + Place numbers one at a time using the format, for example: <answer>place 1 at row 2 col 3</answer> or <answer>1,2,3</answer>
195
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
196
+ + max_tokens: 150
197
+ + parallel_friendly: false
198
+ + max_workers: 32
199
+ + env_config:
200
+ + grid_size: 4
201
+ + difficulty: "easy"
202
+ + render_format: "with_feedback"
203
+ + show_conflicts: false
204
+ + show_valid_numbers: false
205
+ + max_steps: 20
206
+ +
207
+ + MediumSudoku:
208
+ + env_type: sudoku
209
+ + max_actions_per_traj: 30
210
+ + env_instruction: |
211
+ + You are solving a Sudoku puzzle. Fill in the grid so that every row, column, and 3x3 box contains the numbers 1-9 without repetition.
212
+ + Initial cells are shown in [brackets] and cannot be modified. Empty cells are shown as dots (.).
213
+ + Place numbers one at a time using the format: <answer>place 5 at row 2 col 3</answer> or <answer>2,3,5</answer>
214
+ + The environment will provide feedback on valid/invalid moves and show conflicts if any occur.
215
+ + max_tokens: 150
216
+ + parallel_friendly: false
217
+ + max_workers: 32
218
+ + env_config:
219
+ + grid_size: 9
220
+ + difficulty: "medium"
221
+ + render_format: "with_feedback"
222
+ + show_conflicts: true
223
+ + show_valid_numbers: true
224
+ + max_steps: 81
225
+ +
226
+ diff --git a/config/eval.yaml b/config/eval.yaml
227
+ index e65f3a5..0802a0d 100644
228
+ --- a/config/eval.yaml
229
+ +++ b/config/eval.yaml
230
+ @@ -1,14 +1,15 @@
231
+ defaults:
232
+ - envs
233
+ -
234
+ +enable_response_mask: True
235
+ system:
236
+ - CUDA_VISIBLE_DEVICES: "0"
237
+ + CUDA_VISIBLE_DEVICES: "0,1,2,3"
238
+
239
+ seed:
240
+ train: 10000
241
+ val: 123
242
+
243
+ -model_path: Qwen/Qwen2.5-3B-Instruct
244
+ +model_path: /mnt/general/wanghy/RAGEN/saves/qwen3b_it_fromit_think_sudoku_sequence_multitask/global_step_200/qwen2.5_3b_actor_hf
245
+ +# /mnt/general/share/model/tyzhu/SPA-frozenlake-qwen2.5-1.5b-instruct
246
+
247
+ lora:
248
+ rank: 0
249
+ @@ -24,17 +25,18 @@ actor_rollout_ref:
250
+ rollout:
251
+ name: vllm
252
+ log_prob_micro_batch_size_per_gpu: ${micro_batch_size_per_gpu}
253
+ - tensor_model_parallel_size: 1
254
+ + tensor_model_parallel_size: 4
255
+ dtype: bfloat16
256
+ - max_model_len: 3600
257
+ + max_model_len: 7200
258
+ prompt_length: 1
259
+ response_length: 400
260
+ - gpu_memory_utilization: 0.9
261
+ + gpu_memory_utilization: 0.7
262
+ max_num_batched_tokens: 8192
263
+ enforce_eager: True
264
+ free_cache_engine: True
265
+ enable_chunked_prefill: False
266
+ disable_log_stats: False
267
+ + do_sample: True
268
+ val_kwargs:
269
+ do_sample: True
270
+ temperature: 0.5
271
+ @@ -44,9 +46,9 @@ actor_rollout_ref:
272
+
273
+ agent_proxy:
274
+ max_context_window: -1
275
+ - max_turn: 5
276
+ + max_turn: 25
277
+ action_sep: "||"
278
+ - max_actions_per_turn: 2
279
+ + max_actions_per_turn: 1
280
+ use_turn_scores: False
281
+ enable_think: True
282
+ reward_normalization:
283
+ @@ -59,14 +61,14 @@ es_manager:
284
+ env_groups: 8
285
+ group_size: 16
286
+ env_configs:
287
+ - tags: ["CoordSokoban"]
288
+ + tags: ["rubikscube"]
289
+ n_groups: [8]
290
+ val:
291
+ - env_groups: 32
292
+ - group_size: 16
293
+ + env_groups: 256
294
+ + group_size: 1
295
+ env_configs:
296
+ - tags: ["CoordSokoban"]
297
+ - n_groups: [32]
298
+ + tags: ["rubikscube"]
299
+ + n_groups: [256]
300
+
301
+ ctx_manager:
302
+ generation:
303
+ diff --git a/config/evaluate_api_llm.yaml b/config/evaluate_api_llm.yaml
304
+ index b21c95e..bcbf206 100644
305
+ --- a/config/evaluate_api_llm.yaml
306
+ +++ b/config/evaluate_api_llm.yaml
307
+ @@ -1,8 +1,11 @@
308
+ +# export OPENAI_BASE_URL="https://api.ohmygpt.com/v1"
309
+ +# export OPENAI_API_KEY="sk-o4sMxBkN5BB100C4D4a3T3BlBkFJF7791CA39EA14ca98041"
310
+ +# python -m ragen.eval_api hydra.searchpath='[file://./verl/verl/trainer/config]'
311
+ defaults:
312
+ - base # this is a symbolic link to the verl/verl/trainer/config/ppo_trainer.yaml file
313
+
314
+ model_config:
315
+ - model_name: gpt-4o # should be registered in model_info
316
+ + model_name: TA/openai/gpt-oss-120b # should be registered in model_info
317
+ max_concurrency: 16
318
+
319
+ model_info:
320
+ @@ -24,9 +27,9 @@ model_info:
321
+ generation_kwargs:
322
+ temperature: 0
323
+ max_tokens: 512 # max_completion_tokens if o1-mini
324
+ - gpt-4o:
325
+ + gpt-4o-mini:
326
+ provider_name: openai
327
+ - model_name: gpt-4o
328
+ + model_name: gpt-4o-mini
329
+ generation_kwargs:
330
+ temperature: 0
331
+ max_tokens: 512 # max_completion_tokens if o1-mini
332
+ @@ -36,21 +39,42 @@ model_info:
333
+ generation_kwargs:
334
+ temperature: 0
335
+ max_completion_tokens: 512
336
+ + ark-deepseek-v3-250324:
337
+ + provider_name: openai
338
+ + model_name: ark-deepseek-v3-250324
339
+ + generation_kwargs:
340
+ + temperature: 0
341
+ + max_completion_tokens: 512
342
+ deepseek-v3:
343
+ provider_name: deepseek
344
+ model_name: deepseek-chat
345
+ generation_kwargs:
346
+ temperature: 0
347
+ max_completion_tokens: 512
348
+ + glm-4.6:
349
+ + provider_name: openai
350
+ + model_name: glm-4.6
351
+ + generation_kwargs:
352
+ + temperature: 0
353
+ + max_completion_tokens: 512
354
+ + TA/openai/gpt-oss-120b:
355
+ + provider_name: openai
356
+ + model_name: TA/openai/gpt-oss-120b
357
+ + generation_kwargs:
358
+ + temperature: 0
359
+ + max_tokens: 8192
360
+ + # max_retries: 5
361
+
362
+ -
363
+ -
364
+ +agent_proxy:
365
+ + max_turn: 5
366
+ es_manager:
367
+ val:
368
+ - env_groups: 256
369
+ + env_groups: 32
370
+ group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
371
+ env_configs:
372
+ - tags: ["CoordSokoban"]
373
+ - n_groups: [256] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
374
+ + tags: ["rubikscube"]
375
+ + n_groups: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
376
+
377
+
378
+ +rollout:
379
+ + max_model_len: 7200
380
+
381
+ Submodule external/webshop-minimal contains modified content
382
+ diff --git a/external/webshop-minimal/requirements.txt b/external/webshop-minimal/requirements.txt
383
+ index 5a1b04f..238ed5a 100644
384
+ --- a/external/webshop-minimal/requirements.txt
385
+ +++ b/external/webshop-minimal/requirements.txt
386
+ @@ -4,7 +4,7 @@ flask
387
+ html2text
388
+ rank_bm25
389
+ pyserini
390
+ -faiss-cpu
391
+ +faiss-gpu
392
+ thefuzz
393
+ gdown
394
+ spacy
395
+ diff --git a/ragen/env/__init__.py b/ragen/env/__init__.py
396
+ index b0f3461..bc6838e 100644
397
+ --- a/ragen/env/__init__.py
398
+ +++ b/ragen/env/__init__.py
399
+ @@ -12,6 +12,14 @@ from .metamathqa.env import MetaMathQAEnv
400
+ from .metamathqa.config import MetaMathQAEnvConfig
401
+ from .lean.config import LeanEnvConfig
402
+ from .lean.env import LeanEnv
403
+ +from .game_2048.config import Game2048EnvConfig
404
+ +from .game_2048.env import Game2048Env
405
+ +from .blackjack.config import BlackjackEnvConfig
406
+ +from .blackjack.env import BlackjackEnv
407
+ +from .rubikscube.config import RubiksCube2x2Config
408
+ +from .rubikscube.env import RubiksCube2x2Env
409
+ +from .sudoku.config import SudokuEnvConfig
410
+ +from .sudoku.env import SudokuEnv
411
+
412
+
413
+ REGISTERED_ENVS = {
414
+ @@ -22,6 +30,10 @@ REGISTERED_ENVS = {
415
+ # 'alfworld': AlfredTXTEnv,
416
+ 'metamathqa': MetaMathQAEnv,
417
+ 'lean': LeanEnv,
418
+ + 'game_2048': Game2048Env,
419
+ + 'blackjack': BlackjackEnv,
420
+ + 'rubikscube': RubiksCube2x2Env,
421
+ + 'sudoku': SudokuEnv,
422
+ }
423
+
424
+ REGISTERED_ENV_CONFIGS = {
425
+ @@ -32,6 +44,10 @@ REGISTERED_ENV_CONFIGS = {
426
+ # 'alfworld': AlfredEnvConfig,
427
+ 'metamathqa': MetaMathQAEnvConfig,
428
+ 'lean': LeanEnvConfig,
429
+ + 'game_2048': Game2048EnvConfig,
430
+ + 'blackjack': BlackjackEnvConfig,
431
+ + 'rubikscube': RubiksCube2x2Config,
432
+ + 'sudoku': SudokuEnvConfig,
433
+ }
434
+
435
+ try:
436
+ diff --git a/ragen/env/bandit/env.py b/ragen/env/bandit/env.py
437
+ index c59f142..53d0f62 100644
438
+ --- a/ragen/env/bandit/env.py
439
+ +++ b/ragen/env/bandit/env.py
440
+ @@ -11,6 +11,37 @@ Game Rules:
441
+ 4. Based on the symbolic meaning of their names, which arm do you think is more likely to give higher rewards on average? Choose between {name_a} and {name_b}, and output like <answer> {name_a} </answer> or <answer> {name_b} </answer>.
442
+ """
443
+
444
+ +# INIT_PROMPT = """You are playing a bandit game. Goal: Maximize your total reward by choosing which arm to pull.
445
+ +# Game Rules:
446
+ +# 1. There are 2 arms, named {name_a} and {name_b}.
447
+ +# 2. Each arm has its own reward distribution, related to their names.
448
+ +# 3. You need to analyze the symbolic meaning of each arm's name to guess their reward potential.
449
+ +
450
+ +# Example answer format:
451
+ +# <think>
452
+ +# <observation>
453
+ +# Arm A is named \"{name_a}\". Symbolically, this implies [analysis of name A].
454
+ +# Arm B is named \"{name_b}\". Symbolically, this implies [analysis of name B].
455
+ +# </observation>
456
+ +# Based on the analysis, {name_a} seems to represent risk/low value, while {name_b} implies wealth/stability.
457
+ +# <prediction>
458
+ +# If I pull {name_b}, I expect a higher average reward because [reasoning].
459
+ +# </prediction>
460
+ +# </think>
461
+ +# <answer> {name_b} </answer>
462
+ +
463
+ +# A sample full output is as follows:
464
+ +# <think>
465
+ +# <observation>
466
+ +# Arm A is named "Rotten Apple". Symbolically, this implies decay and zero value.
467
+ +# Arm B is named "Golden Chalice". Symbolically, this implies treasure and high value.
468
+ +# </observation>
469
+ +# Comparing the two, the Golden Chalice is clearly superior in potential value.
470
+ +# <prediction>
471
+ +# Pulling "Golden Chalice" will likely yield a high positive reward, whereas "Rotten Apple" might give zero or negative reward.
472
+ +# </prediction>
473
+ +# </think>
474
+ +# <answer> Golden Chalice </answer>"""
475
+
476
+ class BanditEnv(BaseDiscreteActionEnv, gym.Env):
477
+ class_counter = 0
478
+ diff --git a/ragen/env/frozen_lake/config.py b/ragen/env/frozen_lake/config.py
479
+ index de054f4..9950c34 100644
480
+ --- a/ragen/env/frozen_lake/config.py
481
+ +++ b/ragen/env/frozen_lake/config.py
482
+ @@ -8,7 +8,7 @@ class FrozenLakeEnvConfig:
483
+ size: int = 4
484
+ p: float = 0.9
485
+ success_rate: float = 0.8
486
+ - is_slippery: bool = True
487
+ + is_slippery: bool = False
488
+ map_seed: Optional[int] = None
489
+ render_mode: str = "text"
490
+ observation_format: str = "grid"
491
+ diff --git a/ragen/env/frozen_lake/env.py b/ragen/env/frozen_lake/env.py
492
+ index 9ee3add..eef11d8 100644
493
+ --- a/ragen/env/frozen_lake/env.py
494
+ +++ b/ragen/env/frozen_lake/env.py
495
+ @@ -13,6 +13,7 @@ from ragen.env.base import BaseDiscreteActionEnv
496
+ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
497
+ def __init__(self, config: FrozenLakeEnvConfig = FrozenLakeEnvConfig()):
498
+ # Using mappings directly from config
499
+ + # import pdb;pdb.set_trace()
500
+ self.config = config
501
+ self.GRID_LOOKUP = config.grid_lookup
502
+ self.ACTION_LOOKUP = config.action_lookup
503
+ @@ -95,6 +96,7 @@ class FrozenLakeEnv(BaseDiscreteActionEnv, GymFrozenLakeEnv):
504
+ if __name__ == "__main__":
505
+ import matplotlib.pyplot as plt
506
+ config = FrozenLakeEnvConfig(size=4, is_slippery=True)
507
+ + # import pdb;pdb.set_trace()
508
+ env = FrozenLakeEnv(config)
509
+ print(env.reset())
510
+ while True:
511
+ diff --git a/ragen/env/sokoban/env.py b/ragen/env/sokoban/env.py
512
+ index 17cd636..6922b54 100644
513
+ --- a/ragen/env/sokoban/env.py
514
+ +++ b/ragen/env/sokoban/env.py
515
+ @@ -33,6 +33,7 @@ class SokobanEnv(BaseDiscreteActionEnv, GymSokobanEnv):
516
+ def reset(self, seed=None, mode=None):
517
+ try:
518
+ with all_seed(seed):
519
+ + # import pdb;pdb.set_trace()
520
+ self.room_fixed, self.room_state, self.box_mapping, action_sequence = generate_room(
521
+ dim=self.dim_room,
522
+ num_steps=self.num_gen_steps,
523
+ diff --git a/ragen/llm_agent/agent_proxy.py b/ragen/llm_agent/agent_proxy.py
524
+ index c25b50d..f6c4088 100644
525
+ --- a/ragen/llm_agent/agent_proxy.py
526
+ +++ b/ragen/llm_agent/agent_proxy.py
527
+ @@ -287,6 +287,7 @@ def main(config):
528
+ proxy = LLMAgentProxy(config, actor_wg, tokenizer)
529
+ import time
530
+ start_time = time.time()
531
+ + # import pdb;pdb.set_trace()
532
+ rollouts = proxy.rollout(
533
+ DataProto(
534
+ batch=None,
535
+ diff --git a/ragen/llm_agent/base_llm.py b/ragen/llm_agent/base_llm.py
536
+ index 358a2eb..b6f7797 100644
537
+ --- a/ragen/llm_agent/base_llm.py
538
+ +++ b/ragen/llm_agent/base_llm.py
539
+ @@ -33,6 +33,7 @@ class OpenAIProvider(LLMProvider):
540
+ raise ValueError("OpenAI API key not provided and not found in environment variables")
541
+
542
+ self.client = AsyncOpenAI(api_key=self.api_key)
543
+ + # import pdb;pdb.set_trace()
544
+
545
+ async def generate(self, messages: List[Dict[str, str]], **kwargs) -> LLMResponse:
546
+ if "o1-mini" in self.model_name:
547
+ @@ -46,10 +47,7 @@ class OpenAIProvider(LLMProvider):
548
+ )
549
+ if response.choices[0].finish_reason in ['length', 'content_filter']:
550
+ raise ValueError("Content filtered or length exceeded")
551
+ - return LLMResponse(
552
+ - content=response.choices[0].message.content,
553
+ - model_name=response.model
554
+ - )
555
+ + return LLMResponse(content=response.choices[0].message.content,model_name=response.model)
556
+
557
+ class DeepSeekProvider(LLMProvider):
558
+ """DeepSeek API provider implementation"""
559
+ @@ -199,7 +197,7 @@ class ConcurrentLLM:
560
+
561
+ # Queue to store unfinished or failed tasks
562
+ current_batch = messages_list.copy()
563
+ - max_retries = kwargs.get("max_retries", 100)
564
+ + max_retries = kwargs.get("max_retries", 10)
565
+ retry_count = 0
566
+
567
+ while current_batch and retry_count < max_retries:
568
+ diff --git a/ragen/llm_agent/ctx_manager.py b/ragen/llm_agent/ctx_manager.py
569
+ index 905247a..794bd2a 100644
570
+ --- a/ragen/llm_agent/ctx_manager.py
571
+ +++ b/ragen/llm_agent/ctx_manager.py
572
+ @@ -88,6 +88,7 @@ class ContextManager:
573
+ Initialize the ContextManager.
574
+ Processor is used to process the image data.
575
+ """
576
+ + # import pdb;pdb.set_trace()
577
+ self.config = config
578
+ self.tokenizer = tokenizer
579
+ self.processor = processor
580
+ @@ -311,7 +312,7 @@ class ContextManager:
581
+
582
+ llm_input_texts.append(text_with_prompt)
583
+ messages_list.append(messages)
584
+ -
585
+ + # import pdb;pdb.set_trace()
586
+ inputs = self.tokenizer(llm_input_texts, return_tensors="pt", padding=True, padding_side="left", truncation=False) # We have truncated previously, truncation in tokenizer may cause issues.
587
+ input_ids, attention_mask = inputs.input_ids, inputs.attention_mask
588
+ position_ids = (attention_mask.cumsum(dim=-1) - 1).clamp(min=0)
589
+ @@ -331,7 +332,6 @@ class ContextManager:
590
+ "position_ids": position_ids,
591
+ "responses": input_ids[:, 1:], # remove the first token
592
+ }, batch_size=input_ids.shape[0])
593
+ -
594
+ if prepare_for_update:
595
+ llm_inputs.batch["loss_mask"] = loss_mask # remove the first token
596
+ llm_inputs.batch["rm_scores"] = normalized_score_tensor # remove the first token
597
+ @@ -353,6 +353,30 @@ class ContextManager:
598
+ key: np.sum(value) / self.env_nums[key.split("/")[0]]
599
+ for key, value in metrics.items()
600
+ }
601
+ + # Derived metrics for wandb logging
602
+ + try:
603
+ + # charts/avg_episode_return: average across all 2048 env groups
604
+ + ep_keys = [k for k in metrics.keys() if k.endswith('/episodic_return')]
605
+ + if len(ep_keys) > 0:
606
+ + ep_vals = []
607
+ + for k in ep_keys:
608
+ + tag = k.split('/')[0]
609
+ + denom = self.env_nums.get(tag, max(1, len(metrics[k])))
610
+ + ep_vals.append(float(np.sum(metrics[k]) / denom))
611
+ + mean_metrics["charts/avg_episode_return"] = float(np.mean(ep_vals))
612
+ + except Exception:
613
+ + pass
614
+ + try:
615
+ + # rollout/max_tile: max over all envs in this batch
616
+ + tile_keys = [k for k in metrics.keys() if k.endswith('/max_tile')]
617
+ + if len(tile_keys) > 0:
618
+ + tile_vals = []
619
+ + for k in tile_keys:
620
+ + tile_vals.extend(metrics[k])
621
+ + if len(tile_vals) > 0:
622
+ + mean_metrics["rollout/max_tile"] = int(np.max(tile_vals))
623
+ + except Exception:
624
+ + pass
625
+ for key, values in metrics.items():
626
+ if not isinstance(values, list):
627
+ continue
628
+ @@ -378,6 +402,7 @@ class ContextManager:
629
+
630
+ env_ids = lm_outputs.non_tensor_batch['env_ids']
631
+ env_inputs = []
632
+ + # import pdb;pdb.set_trace()
633
+ for env_id, response in zip(env_ids, responses):
634
+ llm_response, actions = self._parse_response(response)
635
+ env_inputs.append({
636
+ diff --git a/ragen/llm_agent/es_manager.py b/ragen/llm_agent/es_manager.py
637
+ index b87a2b3..1a49d3e 100644
638
+ --- a/ragen/llm_agent/es_manager.py
639
+ +++ b/ragen/llm_agent/es_manager.py
640
+ @@ -128,18 +128,40 @@ class EnvStateManager:
641
+ env_outputs: List[Dict]
642
+ {env_id: int, history: List[Dict][{state: str, actions: List[str], reward: float, info: Dict, llm_response: str, llm_raw_response: str, (Optional)images: List[PIL.Image.Image]}]}
643
+ """
644
+ + # def _execute_actions(env, actions):
645
+ + # acc_reward, turn_info, turn_done = 0, {}, False
646
+ + # executed_actions = []
647
+ + # for action in actions:
648
+ + # _, reward, done, info = env.step(action)
649
+ + # acc_reward += reward
650
+ + # turn_info.update(info) # NOTE: currently use last info for multi-action
651
+ + # executed_actions.append(action)
652
+ + # if done:
653
+ + # turn_done = True
654
+ + # break
655
+ +
656
+ + # return acc_reward, turn_info, turn_done, executed_actions
657
+ def _execute_actions(env, actions):
658
+ - acc_reward, turn_info, turn_done = 0, {}, False
659
+ + acc_reward, turn_info, turn_done = 0.0, {}, False
660
+ + raw_acc_reward = 0.0
661
+ executed_actions = []
662
+ for action in actions:
663
+ _, reward, done, info = env.step(action)
664
+ - acc_reward += reward
665
+ + acc_reward += float(reward)
666
+ + try:
667
+ + raw_acc_reward += float(info.get('raw_reward', 0.0))
668
+ + except Exception:
669
+ + pass
670
+ turn_info.update(info) # NOTE: currently use last info for multi-action
671
+ executed_actions.append(action)
672
+ if done:
673
+ turn_done = True
674
+ break
675
+ -
676
+ + # Overwrite per-turn raw_reward to reflect the sum across all executed actions in this turn
677
+ + try:
678
+ + turn_info['raw_reward'] = float(raw_acc_reward)
679
+ + except Exception:
680
+ + pass
681
+ return acc_reward, turn_info, turn_done, executed_actions
682
+
683
+ def _log_env_state(status, history, cur_obs, max_actions_per_traj, executed_actions, all_actions, acc_reward, turn_done, turn_info, env_input):
684
+ @@ -198,6 +220,18 @@ class EnvStateManager:
685
+ 'success': float(status.terminated and (not status.truncated)),
686
+ 'num_actions': status.num_actions,
687
+ }
688
+ + # Add episodic-level metrics
689
+ + # try:
690
+ + # # Sum of per-turn rewards equals the episodic return (env-shaped reward)
691
+ + # env_metric['episodic_return'] = float(sum(status.rewards))
692
+ + # except Exception:
693
+ + # pass
694
+ + try:
695
+ + # Final max tile on the board at the end of the rollout
696
+ + import numpy as _np
697
+ + env_metric['max_tile'] = int(_np.max(entry['env'].grid))
698
+ + except Exception:
699
+ + pass
700
+ custom_metric = {}
701
+ for turn in cache['history']:
702
+ for k, v in turn.get('info', {}).items():
703
+ @@ -212,6 +246,12 @@ class EnvStateManager:
704
+ "Skipping non-numeric metric '%s' with value %r for env %s.",
705
+ k, v, entry['tag']
706
+ )
707
+ + # Add episodic_return as the SUM of raw_reward across steps (align with CleanRL)
708
+ + try:
709
+ + if 'raw_reward' in custom_metric:
710
+ + env_metric['episodic_return'] = float(np.sum(custom_metric['raw_reward']))
711
+ + except Exception:
712
+ + pass
713
+ for k, v in custom_metric.items():
714
+ # TODO: Move TURN_LVL_METRICS into the environment
715
+ if "webshop" not in cache['tag'].lower() or ("webshop" in cache['tag'].lower() and k in TURN_LVL_METRICS):
716
+ @@ -219,7 +259,12 @@ class EnvStateManager:
717
+ else:
718
+ env_metric['traj_sum/' + k] = np.sum(v)
719
+
720
+ -
721
+ + try:
722
+ + if 'score' in custom_metric and len(custom_metric['score']) > 0:
723
+ + env_metric['final_score'] = float(custom_metric['score'][-1])
724
+ + except Exception:
725
+ + pass
726
+ +
727
+ cache['history'][-1]['metrics'] = custom_metric
728
+ env_metric = {f"{entry['tag']}/{k}": v for k, v in env_metric.items()}
729
+ cache['metrics'] = env_metric
730
+ diff --git a/requirements.txt b/requirements.txt
731
+ index 2fd756e..9b521bf 100644
732
+ --- a/requirements.txt
733
+ +++ b/requirements.txt
734
+ @@ -7,7 +7,6 @@ accelerate
735
+ codetiming
736
+ datasets
737
+ dill
738
+ -flash-attn==2.7.4.post1
739
+ hydra-core
740
+ numpy
741
+ pandas
742
+ @@ -15,19 +14,19 @@ pybind11
743
+ ray>=2.10
744
+ tensordict>=0.8.0,<0.9.0
745
+ transformers
746
+ -vllm==0.8.2
747
+ +vllm==0.8.5
748
+ wandb
749
+ gymnasium
750
+ gymnasium[toy-text]
751
+
752
+ pyarrow>=15.0.0
753
+ pylatexenc
754
+ -torchdata
755
+ +# torchdata
756
+ debugpy
757
+
758
+ together
759
+ anthropic
760
+ -faiss-cpu==1.11.0
761
+ +faiss-gpu
762
+
763
+ # This is optional, but needs to be installed with main requirements if you want to use webshop
764
+ -r external/webshop-minimal/requirements.txt
765
+ diff --git a/scripts/setup_ragen.sh b/scripts/setup_ragen.sh
766
+ index f9a7cd9..85a93c4 100644
767
+ --- a/scripts/setup_ragen.sh
768
+ +++ b/scripts/setup_ragen.sh
769
+ @@ -94,10 +94,10 @@ main() {
770
+ pip install torch==2.5.0 --index-url https://download.pytorch.org/whl/cu124
771
+
772
+ print_step "Installing flash-attention..."
773
+ - pip3 install flash-attn==2.7.4.post1 --no-build-isolation
774
+ + # pip3 install flash-attn==2.7.4.post1 --no-build-isolation
775
+ else
776
+ print_step "Installing PyTorch without CUDA support..."
777
+ - pip install torch==2.5.0
778
+ + pip install torch==2.4.0
779
+ fi
780
+
781
+ # Install remaining requirements
782
+ @@ -137,8 +137,8 @@ main() {
783
+ conda install conda-forge::gdown
784
+ mkdir -p external/webshop-minimal/webshop_minimal/data/full
785
+ cd external/webshop-minimal/webshop_minimal/data/full
786
+ - gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
787
+ - gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
788
+ + # gdown https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB # items_shuffle
789
+ + # gdown https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi # items_ins_v2
790
+ cd ../../../../..
791
+
792
+ echo -e "${GREEN}Installation completed successfully!${NC}"
793
+ diff --git a/train.py b/train.py
794
+ index 34af78b..00c2117 100644
795
+ --- a/train.py
796
+ +++ b/train.py
797
+ @@ -132,7 +132,7 @@ def add_dependency_and_validate_config(config):
798
+ f"micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node}) must be less than or equal to ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size})"
799
+ assert config.actor_rollout_ref.actor.ppo_mini_batch_size % (config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node) == 0, \
800
+ f"ppo_mini_batch_size ({config.actor_rollout_ref.actor.ppo_mini_batch_size}) must be divisible by micro_batch_size_per_gpu * n_gpus_per_node ({config.micro_batch_size_per_gpu * config.trainer.n_gpus_per_node})"
801
+ - assert "qwen" in config.model_path.lower() or (not config.enable_response_mask), \
802
+ + assert "qwen" in config.model_path.lower() or "llama-3" in config.model_path.lower() or (not config.enable_response_mask), \
803
+ "response mask is currently only supported for qwen models"
804
+ assert len(str(config.system.CUDA_VISIBLE_DEVICES).split(',')) == config.trainer.n_gpus_per_node, \
805
+ f"CUDA_VISIBLE_DEVICES ({config.system.CUDA_VISIBLE_DEVICES}) must have the same number of GPUs as n_gpus_per_node ({config.trainer.n_gpus_per_node})"
806
+ diff --git a/train_all.sh b/train_all.sh
807
+ index 0157306..33035f5 100755
808
+ --- a/train_all.sh
809
+ +++ b/train_all.sh
810
+ @@ -6,246 +6,257 @@ USE_GRPO="algorithm.adv_estimator=grpo"
811
+ USE_PPO="algorithm.adv_estimator=gae" # by default.
812
+ USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
813
+
814
+ +
815
+ +# python train.py --config-name _8_2048 system.CUDA_VISIBLE_DEVICES="'0,1,2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=game_2048 $USE_PPO $USE_BASE
816
+ +
817
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-1 $USE_PPO $USE_BASE
818
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-1.5B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
819
+ +# python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'4,5'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-3B-Instruct trainer.experiment_name=rubikscube-2 $USE_PPO $USE_BASE
820
+ +python train.py --config-name _10_rubikscube system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_05B_it trainer.n_gpus_per_node=2 model_path=Qwen/Qwen2.5-0.5B-Instruct trainer.experiment_name=rubikscube-3 $USE_PPO $USE_BASE
821
+ +
822
+ # Section 3.1&3.2 - General Observations
823
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-ppo $USE_PPO $USE_BASE &
824
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-grpo $USE_GRPO $USE_BASE &
825
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE &
826
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
827
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozen_lake-ppo $USE_PPO $USE_BASE &
828
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozen_lake-grpo $USE_GRPO $USE_BASE &
829
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'6,7'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=bandit-ppo-multitask $USE_PPO $USE_BASE &
830
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="'7'" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-ppo-frommlp $USE_PPO $USE_BASE
831
+
832
+ -# Section 4.1 - Filtering and critic
833
+ -# 0.25
834
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
835
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
836
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
837
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
838
+ -
839
+ -wait
840
+ -
841
+ -# 0.5
842
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
843
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
844
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
845
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
846
+ -
847
+ -# 0.75
848
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
849
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
850
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
851
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
852
+ -
853
+ -wait
854
+ -
855
+ -# Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
856
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
857
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
858
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
859
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
860
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
861
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
862
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
863
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
864
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="'0,1'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=sokoban-ppo-box1-multitask $USE_PPO $USE_BASE
865
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-grpo $USE_GRPO $USE_BASE &
866
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'2,3'" trainer.project_name=ragen_latest_qwen_25_15b_it trainer.n_gpus_per_node=2 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
867
+
868
+ -wait
869
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.project_name=ragen_latest_qwen_25_3b_it trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_3B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
870
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="'4,5,6,7'" trainer.n_gpus_per_node=4 model_path=/mnt/general/wanghy/LLaMA-Factory/saves/qwen3/full/sft/qwen2.5_1.5B_it_multitask trainer.experiment_name=frozen_lake-ppo-slippery-multitask $USE_PPO $USE_BASE
871
+
872
+ -# Section 5.1 - Reasoning Helps Generalization
873
+ +# # Section 4.1 - Filtering and critic
874
+ +# # 0.25
875
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.25 actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
876
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
877
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_PPO &
878
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.25 $USE_GRPO &
879
+
880
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
881
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
882
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
883
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
884
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
885
+ +# wait
886
+
887
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
888
+ - custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
889
+ - custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
890
+ - custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
891
+ - custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
892
+ - agent_proxy.enable_think=False
893
+ +# # 0.5
894
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-ppo-rolloutfilter0.5 actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
895
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
896
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_PPO &
897
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.5 $USE_GRPO &
898
+ +
899
+ +# # 0.75
900
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-ppo-rolloutfilter0.75 actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
901
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
902
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozen_lake-ppo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_PPO &
903
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozen_lake-grpo actor_rollout_ref.rollout.rollout_filter_ratio=0.75 $USE_GRPO &
904
+
905
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
906
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
907
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
908
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
909
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader"
910
+ +# wait
911
+
912
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
913
+ - custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
914
+ - custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
915
+ - custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
916
+ - custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
917
+ - agent_proxy.enable_think=False
918
+ +# # Section 4.2 - Ablation on Critic/ClipHigh/KL. Start from Basic and add more components. The best setting for StarPO in agent is rollout_filter+Critic+Cliphigh+NoKL
919
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
920
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
921
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
922
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
923
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=frozenlake-base-grpo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_GRPO &
924
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=frozenlake-base-ppo algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
925
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=frozenlake-base-ppo-cliphigh algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.28 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
926
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=frozenlake-base-ppo-nokl algorithm.kl_ctrl.kl_coef=0.000 actor_rollout_ref.actor.kl_loss_coef=0.000 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1 $USE_PPO &
927
+
928
+ +# wait
929
+
930
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
931
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
932
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
933
+ +# # Section 5.1 - Reasoning Helps Generalization
934
+
935
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=bandit-generalization \
936
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
937
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
938
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
939
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian"
940
+
941
+ -# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
942
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
943
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=bandit-generalization-nothink \
944
+ +# custom_envs.Bandit.env_config.lo_arm_name="Engineer" \
945
+ +# custom_envs.Bandit.env_config.hi_arm_name="Teacher" \
946
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Trader" \
947
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Librarian" \
948
+ +# agent_proxy.enable_think=False
949
+
950
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=bandit-generalization-rev \
951
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
952
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
953
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
954
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader"
955
+
956
+ -# COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
957
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
958
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
959
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=bandit-generalization-rev-nothink \
960
+ +# custom_envs.Bandit.env_config.lo_arm_name="Teacher" \
961
+ +# custom_envs.Bandit.env_config.hi_arm_name="Engineer" \
962
+ +# custom_envs.BanditTest.env_config.lo_arm_name="Librarian" \
963
+ +# custom_envs.BanditTest.env_config.hi_arm_name="Trader" \
964
+ +# agent_proxy.enable_think=False
965
+
966
+ -wait
967
+
968
+ -# Section 5.2 - what leads to better reasoning?
969
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
970
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
971
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
972
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
973
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
974
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization micro_batch_size_per_gpu=8 model_path=Qwen/Qwen2.5-1.5B-Instruct&
975
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-generalization-nothink $SOKOBAN_GENERALIZATION_CONFIG agent_proxy.enable_think=False &
976
+
977
+ -wait
978
+
979
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
980
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
981
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
982
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
983
+ +# # SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=128 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SokobanDifferentGridVocab] es_manager.val.env_configs.n_groups=[128]"
984
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization $SOKOBAN_GENERALIZATION_CONFIG &
985
+
986
+ -wait
987
+
988
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
989
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
990
+ +# # COMPOSITIONALITY_CONFIG="es_manager.train.env_groups=16 es_manager.train.env_configs.tags=[Bandit,SimpleSokoban] es_manager.train.env_configs.n_groups=[8,8] es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[Bandit,SimpleSokoban,LargerSokoban,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128] actor_rollout_ref.rollout.rollout_filter_ratio=1" # NOTE that we don't filter out low-var rollout in this setting
991
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=compositional-generalization $COMPOSITIONALITY_CONFIG &
992
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=compositional-generalization-nothink $COMPOSITIONALITY_CONFIG agent_proxy.enable_think=False &
993
+
994
+ +# wait
995
+
996
+ -wait
997
+ +# # Section 5.2 - what leads to better reasoning?
998
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B-Instruct &
999
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B-Instruct &
1000
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct trainer.n_gpus_per_node=2 &
1001
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-instruct $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B-Instruct trainer.n_gpus_per_node=4 &
1002
+
1003
+ -# Section 6.1 varying action count
1004
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1005
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1006
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1007
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1008
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1009
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1010
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1011
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1012
+ +# wait
1013
+
1014
+ -# section 6.2 Varying prompt diversity
1015
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1016
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1017
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1018
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1019
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1020
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1021
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-generalization-qwen2.5-0.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-0.5B &
1022
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-1.5B &
1023
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-3b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B &
1024
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5,6,7\" trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-7B &
1025
+
1026
+ -wait
1027
+ +# wait
1028
+
1029
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1030
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 trainer.n_gpus_per_node=4 trainer.experiment_name=sokoban-generalization-qwen2.5-7b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B &
1031
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-generalization-qwen2.5-1.5b-r1 $SOKOBAN_GENERALIZATION_CONFIG model_path=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B &
1032
+
1033
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1034
+
1035
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1036
+ +# wait
1037
+
1038
+ +# # Section 6.1 varying action count
1039
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-action-count-1 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=5 custom_envs.LargerSokoban.max_actions_per_traj=5 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=5 custom_envs.FrozenLake.max_actions_per_traj=5 agent_proxy.max_actions_per_turn=1 &
1040
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-action-count-2 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=10 custom_envs.LargerSokoban.max_actions_per_traj=10 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=10 custom_envs.FrozenLake.max_actions_per_traj=10 agent_proxy.max_actions_per_turn=2 &
1041
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-action-count-3 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=15 custom_envs.LargerSokoban.max_actions_per_traj=15 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=15 custom_envs.FrozenLake.max_actions_per_traj=15 agent_proxy.max_actions_per_turn=3 &
1042
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-action-count-4 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=20 custom_envs.LargerSokoban.max_actions_per_traj=20 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=20 custom_envs.FrozenLake.max_actions_per_traj=20 agent_proxy.max_actions_per_turn=4 &
1043
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-action-count-5 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=25 custom_envs.LargerSokoban.max_actions_per_traj=25 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=25 custom_envs.FrozenLake.max_actions_per_traj=25 agent_proxy.max_actions_per_turn=5 &
1044
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-action-count-6 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=30 custom_envs.LargerSokoban.max_actions_per_traj=30 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=30 custom_envs.FrozenLake.max_actions_per_traj=30 agent_proxy.max_actions_per_turn=6 &
1045
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-action-count-7 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=35 custom_envs.LargerSokoban.max_actions_per_traj=35 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=35 custom_envs.FrozenLake.max_actions_per_traj=35 agent_proxy.max_actions_per_turn=7 &
1046
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-action-count-8 $SOKOBAN_GENERALIZATION_CONFIG custom_envs.SimpleSokoban.max_actions_per_traj=40 custom_envs.LargerSokoban.max_actions_per_traj=40 custom_envs.SokobanDifferentGridVocab.max_actions_per_traj=40 custom_envs.FrozenLake.max_actions_per_traj=40 agent_proxy.max_actions_per_turn=8 &
1047
+
1048
+ +# # section 6.2 Varying prompt diversity
1049
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-prompt-diversity-4 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=4 es_manager.train.group_size=32 es_manager.train.env_configs.n_groups=[4] &
1050
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="1" trainer.experiment_name=sokoban-prompt-diversity-8 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] &
1051
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="2" trainer.experiment_name=sokoban-prompt-diversity-16 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=8 es_manager.train.env_configs.n_groups=[16] &
1052
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="3" trainer.experiment_name=sokoban-prompt-diversity-32 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=32 es_manager.train.group_size=4 es_manager.train.env_configs.n_groups=[32] &
1053
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="4" trainer.experiment_name=sokoban-prompt-diversity-64 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=64 es_manager.train.group_size=2 es_manager.train.env_configs.n_groups=[64] &
1054
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="5" trainer.experiment_name=sokoban-prompt-diversity-128 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=128 es_manager.train.group_size=1 es_manager.train.env_configs.n_groups=[128] &
1055
+
1056
+ +# wait
1057
+
1058
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="6" trainer.experiment_name=sokoban-online-2 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=16 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[16] trainer.total_training_steps=100 trainer.test_freq=5 &
1059
+
1060
+ -# Extension: Training 7B reasoning model
1061
+ -SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1062
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1063
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="7" trainer.experiment_name=sokoban-online-5 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=40 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[40] trainer.total_training_steps=40 trainer.test_freq=2 &
1064
+
1065
+ -python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1066
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES="0" trainer.experiment_name=sokoban-online-10 $SOKOBAN_GENERALIZATION_CONFIG es_manager.train.env_groups=80 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[80] trainer.total_training_steps=80 trainer.test_freq=1 &
1067
+
1068
+ -# trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1069
+
1070
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1071
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1072
+
1073
+ -python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1074
+
1075
+ -python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1076
+
1077
+ +# # Extension: Training 7B reasoning model
1078
+ +# SOKOBAN_GENERALIZATION_CONFIG="es_manager.val.env_groups=512 es_manager.val.group_size=1 es_manager.val.env_configs.tags=[SimpleSokoban,LargerSokoban,SokobanDifferentGridVocab,FrozenLake] es_manager.val.env_configs.n_groups=[128,128,128,128]"
1079
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 trainer.experiment_name=sokoban-generalization-qwen2.5-3b-instruct-largescale $SOKOBAN_GENERALIZATION_CONFIG model_path=Qwen/Qwen2.5-3B-Instruct es_manager.train.env_groups=8 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[8] micro_batch_size_per_gpu=8 ppo_mini_batch_size=64 actor_rollout_ref.rollout.response_length=1024 actor_rollout_ref.rollout.max_model_len=6400 trainer.test_freq=5 actor_rollout_ref.rollout.max_num_batched_tokens=24000 micro_batch_size_per_gpu=2 actor_rollout_ref.rollout.rollout_filter_ratio=1 &
1080
+
1081
+ +# python -m ragen.llm_agent.agent_proxy model_path=Qwen/Qwen2.5-3B-Instruct system.CUDA_VISIBLE_DEVICES=\"0,1,2,3,4,5,6,7\" trainer.n_gpus_per_node=8 actor_rollout_ref.rollout.tensor_model_parallel_size=4 actor_rollout_ref.rollout.response_length=2048 actor_rollout_ref.rollout.max_model_len=12800
1082
+
1083
+ +# # trainer.save_freq=50 trainer.default_local_dir=/mnt/local/cache/exp_name
1084
+
1085
+ -# USE_PPO="algorithm.adv_estimator=gae" # by default.
1086
+ -# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1087
+ -# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1088
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1089
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/sokoban-generalization &
1090
+
1091
+ +# python train.py --config-name _1_bandit system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=bandit-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/bandit-generalization &
1092
+
1093
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1094
+ +# python train.py --config-name _3_frozen_lake system.CUDA_VISIBLE_DEVICES=\"1\" trainer.n_gpus_per_node=1 trainer.experiment_name=frozenlake-final enable_response_mask=True trainer.total_training_steps=500 trainer.save_freq=50 trainer.default_local_dir=/mnt/local/ragen_checkpoints/frozenlake-generalization &
1095
+
1096
+ -# enable_response_mask: False
1097
+ -# grpo_advantage_length_weight: True
1098
+
1099
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1100
+
1101
+
1102
+ -# extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1103
+ -python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1104
+ +# # USE_PPO="algorithm.adv_estimator=gae" # by default.
1105
+ +# # USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1106
+ +# # python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0\" trainer.n_gpus_per_node=1 trainer.experiment_name=sokoban-ppo $USE_PPO $USE_BASE ppo_mini_batch_size=64 enable_response_mask=True &
1107
+
1108
+ -# extension: bi-level gae
1109
+ -python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1110
+ - system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1111
+ - model_path=Qwen/Qwen2.5-0.5B-Instruct \
1112
+ - algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1113
+ - agent_proxy.use_turn_scores=True \
1114
+ - actor_rollout_ref.rollout.tp_size_check=False
1115
+
1116
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std &
1117
+
1118
+ -# extension: webshop
1119
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1120
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1121
+ - trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1122
+ - trainer.nnodes=1 &
1123
+ +# # enable_response_mask: False
1124
+ +# # grpo_advantage_length_weight: True
1125
+
1126
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 trainer.experiment_name=sokoban-s-grpo-1-5b algorithm.adv_estimator=grpo agent_proxy.reward_normalization.method=mean_std agent_proxy.max_actions_per_turn=5 custom_envs.SimpleSokoban.max_actions_per_traj=25 enable_response_mask=True grpo_advantage_length_weight=False model_path=Qwen/Qwen2.5-1.5B-Instruct &
1127
+
1128
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1129
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1130
+ - trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1131
+ - trainer.nnodes=1 &
1132
+
1133
+ -# StarPO ppo
1134
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1135
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1136
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1137
+ - trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1138
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1139
+ - trainer.nnodes=1 &
1140
+ +# # extension: 7B with lora. Currently NOT recommended to use lora: within current version of vllm, this could result in rollouts slower than non-lora by 100%
1141
+ +# python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 model_path=Qwen/Qwen2.5-7B-Instruct trainer.experiment_name=sokoban_7b_instruct_lora_newversion lora.rank=16
1142
+
1143
+ -# StarPO grpo
1144
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1145
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1146
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1147
+ - trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1148
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1149
+ - trainer.nnodes=1 &
1150
+ +# # extension: bi-level gae
1151
+ +# python train.py trainer.experiment_name=sokoban-bi-level-gae-final \
1152
+ +# system.CUDA_VISIBLE_DEVICES=\"0,1,2,3\" trainer.n_gpus_per_node=4 actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
1153
+ +# model_path=Qwen/Qwen2.5-0.5B-Instruct \
1154
+ +# algorithm.bi_level_gae=True algorithm.high_level_gamma=0.95 \
1155
+ +# agent_proxy.use_turn_scores=True \
1156
+ +# actor_rollout_ref.rollout.tp_size_check=False
1157
+
1158
+
1159
+ -# normal:sokoban
1160
+ -# extension: sokoban
1161
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1162
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1163
+ - trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1164
+ - trainer.nnodes=1 &
1165
+ +# # extension: webshop
1166
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1167
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1168
+ +# trainer.experiment_name=webshop-3b-ppo-s $USE_PPO \
1169
+ +# trainer.nnodes=1 &
1170
+
1171
+
1172
+ -USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1173
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1174
+ - trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1175
+ - trainer.nnodes=1 &
1176
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1177
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1178
+ +# trainer.experiment_name=webshop-3b-grpo-s $USE_GRPO \
1179
+ +# trainer.nnodes=1 &
1180
+
1181
+ -# StarPO ppo
1182
+ -USE_PPO="algorithm.adv_estimator=gae" # by default.
1183
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1184
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1185
+ - trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1186
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1187
+ - trainer.nnodes=1 &
1188
+ +# # StarPO ppo
1189
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1190
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1191
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1192
+ +# trainer.experiment_name=webshop-3b-ppo $USE_PPO $USE_BASE \
1193
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1194
+ +# trainer.nnodes=1 &
1195
+
1196
+ -# StarPO grpo
1197
+ -USE_GRPO="algorithm.adv_estimator=grpo"
1198
+ -USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1199
+ -MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1200
+ - trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1201
+ - es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1202
+ - trainer.nnodes=1 &
1203
+ +# # StarPO grpo
1204
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1205
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1206
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _6_webshop system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1207
+ +# trainer.experiment_name=webshop-3b-grpo $USE_GRPO $USE_BASE \
1208
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1209
+ +# trainer.nnodes=1 &
1210
+ +
1211
+ +
1212
+ +# # normal:sokoban
1213
+ +# # extension: sokoban
1214
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1215
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2 \
1216
+ +# trainer.experiment_name=sokoban-3b-ppo-s $USE_PPO \
1217
+ +# trainer.nnodes=1 &
1218
+ +
1219
+ +
1220
+ +# USE_GRPO="algorithm.adv_estimator=grpo" # by default.
1221
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"2,3\" trainer.n_gpus_per_node=2 \
1222
+ +# trainer.experiment_name=sokoban-3b-grpo-s $USE_GRPO \
1223
+ +# trainer.nnodes=1 &
1224
+ +
1225
+ +# # StarPO ppo
1226
+ +# USE_PPO="algorithm.adv_estimator=gae" # by default.
1227
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1228
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"4,5\" trainer.n_gpus_per_node=2 \
1229
+ +# trainer.experiment_name=sokoban-3b-ppo $USE_PPO $USE_BASE \
1230
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1231
+ +# trainer.nnodes=1 &
1232
+ +
1233
+ +# # StarPO grpo
1234
+ +# USE_GRPO="algorithm.adv_estimator=grpo"
1235
+ +# USE_BASE="algorithm.kl_ctrl.kl_coef=0.001 actor_rollout_ref.actor.kl_loss_coef=0.001 actor_rollout_ref.actor.clip_ratio_high=0.2 actor_rollout_ref.rollout.rollout_filter_ratio=1"
1236
+ +# MKL_SERVICE_FORCE_INTEL=1 python train.py --config-name _2_sokoban system.CUDA_VISIBLE_DEVICES=\"6,7\" trainer.n_gpus_per_node=2 \
1237
+ +# trainer.experiment_name=sokoban-3b-grpo $USE_GRPO $USE_BASE \
1238
+ +# es_manager.train.env_groups=2 es_manager.train.group_size=16 es_manager.train.env_configs.n_groups=[2] \
1239
+ +# trainer.nnodes=1 &
1240
+
1241
+
1242
+
1243
+ -python train.py \
1244
+ - trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1245
+
1246
+ +# python train.py \
1247
+ +# trainer.experiment_name=3b-full-ppo-test system.CUDA_VISIBLE_DEVICES=\"0,1\" trainer.n_gpus_per_node=2
1248
+
wandb/run-20260112_225324-locrg3kr/files/requirements.txt ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ colorama==0.4.6
2
+ psutil==7.1.3
3
+ ragen==0.1
4
+ Farama-Notifications==0.0.4
5
+ MarkupSafe==2.1.5
6
+ PyJWT==2.10.1
7
+ PySocks==1.7.1
8
+ absl-py==2.3.1
9
+ accelerate==1.12.0
10
+ aiohappyeyeballs==2.6.1
11
+ aiohttp==3.13.2
12
+ aiohttp-cors==0.8.1
13
+ aiosignal==1.4.0
14
+ airportsdata==20250909
15
+ annotated-doc==0.0.4
16
+ annotated-types==0.7.0
17
+ anthropic==0.75.0
18
+ antlr4-python3-runtime==4.9.3
19
+ anyio==4.12.0
20
+ astor==0.8.1
21
+ asttokens==3.0.1
22
+ async-timeout==5.0.1
23
+ attrs==25.4.0
24
+ beautifulsoup4==4.14.3
25
+ black==25.11.0
26
+ blake3==1.0.8
27
+ blinker==1.9.0
28
+ blis==1.3.3
29
+ cachetools==6.2.2
30
+ catalogue==2.0.10
31
+ certifi==2025.11.12
32
+ cffi==2.0.0
33
+ charset-normalizer==3.4.4
34
+ cleantext==1.1.4
35
+ click==8.2.1
36
+ cloudpathlib==0.23.0
37
+ cloudpickle==3.1.2
38
+ codetiming==1.4.0
39
+ colorama==0.4.6
40
+ coloredlogs==15.0.1
41
+ colorful==0.5.8
42
+ compressed-tensors==0.9.3
43
+ confection==0.1.5
44
+ contourpy==1.3.2
45
+ cryptography==46.0.3
46
+ cupy-cuda12x==13.6.0
47
+ cycler==0.12.1
48
+ cymem==2.0.13
49
+ Cython==3.2.2
50
+ datasets==4.4.1
51
+ debugpy==1.8.17
52
+ decorator==5.2.1
53
+ Deprecated==1.3.1
54
+ depyf==0.18.0
55
+ dill==0.4.0
56
+ diskcache==5.6.3
57
+ distlib==0.4.0
58
+ distro==1.9.0
59
+ dnspython==2.8.0
60
+ docstring_parser==0.17.0
61
+ einops==0.8.1
62
+ email-validator==2.3.0
63
+ eval_type_backport==0.2.2
64
+ exceptiongroup==1.3.1
65
+ executing==2.2.1
66
+ faiss-gpu==1.7.2
67
+ fastapi==0.123.1
68
+ fastapi-cli==0.0.16
69
+ fastapi-cloud-cli==0.5.2
70
+ fastar==0.8.0
71
+ fastrlock==0.8.3
72
+ filelock==3.19.1
73
+ flash_attn==2.8.3
74
+ Flask==3.1.2
75
+ flatbuffers==25.9.23
76
+ fonttools==4.61.0
77
+ frozenlist==1.8.0
78
+ fsspec==2025.9.0
79
+ gdown==5.2.0
80
+ gguf==0.17.1
81
+ gitdb==4.0.12
82
+ GitPython==3.1.45
83
+ google-api-core==2.28.1
84
+ google-auth==2.43.0
85
+ googleapis-common-protos==1.72.0
86
+ grpcio==1.76.0
87
+ gym==0.26.2
88
+ gym-notices==0.1.0
89
+ gym-sokoban==0.0.6
90
+ gymnasium==1.2.2
91
+ h11==0.16.0
92
+ hf-xet==1.2.0
93
+ html2text==2025.4.15
94
+ httpcore==1.0.9
95
+ httptools==0.7.1
96
+ httpx==0.28.1
97
+ httpx-sse==0.4.3
98
+ huggingface-hub==0.36.0
99
+ humanfriendly==10.0
100
+ hydra-core==1.3.2
101
+ idna==3.11
102
+ ImageIO==2.37.2
103
+ importlib_metadata==8.0.0
104
+ interegular==0.3.3
105
+ ipython==8.37.0
106
+ itsdangerous==2.2.0
107
+ jedi==0.19.2
108
+ Jinja2==3.1.6
109
+ jiter==0.12.0
110
+ joblib==1.5.2
111
+ jsonschema==4.25.1
112
+ jsonschema-specifications==2025.9.1
113
+ kimina-client==0.2.1
114
+ kiwisolver==1.4.9
115
+ lark==1.2.2
116
+ llguidance==0.7.30
117
+ llvmlite==0.44.0
118
+ lm-format-enforcer==0.10.12
119
+ loguru==0.7.3
120
+ Markdown==3.10
121
+ markdown-it-py==4.0.0
122
+ matplotlib==3.10.7
123
+ matplotlib-inline==0.2.1
124
+ mcp==1.22.0
125
+ mdurl==0.1.2
126
+ mistral_common==1.8.6
127
+ mpmath==1.3.0
128
+ msgpack==1.1.2
129
+ msgspec==0.20.0
130
+ multidict==6.7.0
131
+ multiprocess==0.70.18
132
+ murmurhash==1.0.15
133
+ mypy_extensions==1.1.0
134
+ nest-asyncio==1.6.0
135
+ networkx==3.3
136
+ ninja==1.13.0
137
+ nltk==3.9.2
138
+ numba==0.61.2
139
+ numpy==1.26.4
140
+ nvidia-cublas-cu12==12.4.5.8
141
+ nvidia-cuda-cupti-cu12==12.4.127
142
+ nvidia-cuda-nvrtc-cu12==12.4.127
143
+ nvidia-cuda-runtime-cu12==12.4.127
144
+ nvidia-cudnn-cu12==9.1.0.70
145
+ nvidia-cufft-cu12==11.2.1.3
146
+ nvidia-curand-cu12==10.3.5.147
147
+ nvidia-cusolver-cu12==11.6.1.9
148
+ nvidia-cusparse-cu12==12.3.1.170
149
+ nvidia-cusparselt-cu12==0.6.2
150
+ nvidia-nccl-cu12==2.21.5
151
+ nvidia-nvjitlink-cu12==12.4.127
152
+ nvidia-nvtx-cu12==12.4.127
153
+ omegaconf==2.3.0
154
+ onnxruntime==1.23.2
155
+ openai==2.8.1
156
+ opencensus==0.11.4
157
+ opencensus-context==0.1.3
158
+ opencv-python-headless==4.12.0.88
159
+ opentelemetry-api==1.38.0
160
+ opentelemetry-exporter-otlp==1.26.0
161
+ opentelemetry-exporter-otlp-proto-common==1.26.0
162
+ opentelemetry-exporter-otlp-proto-grpc==1.26.0
163
+ opentelemetry-exporter-otlp-proto-http==1.26.0
164
+ opentelemetry-exporter-prometheus==0.59b0
165
+ opentelemetry-proto==1.26.0
166
+ opentelemetry-sdk==1.38.0
167
+ opentelemetry-semantic-conventions==0.59b0
168
+ opentelemetry-semantic-conventions-ai==0.4.13
169
+ orjson==3.11.4
170
+ outlines==0.1.11
171
+ outlines_core==0.1.26
172
+ packaging==25.0
173
+ pandas==2.3.3
174
+ parso==0.8.5
175
+ partial-json-parser==0.2.1.1.post7
176
+ pathspec==0.12.1
177
+ peft==0.18.0
178
+ pexpect==4.9.0
179
+ pillow==11.3.0
180
+ pip==25.3
181
+ platformdirs==4.5.0
182
+ preshed==3.0.12
183
+ prometheus_client==0.23.1
184
+ prometheus-fastapi-instrumentator==7.1.0
185
+ prompt_toolkit==3.0.52
186
+ propcache==0.4.1
187
+ proto-plus==1.26.1
188
+ protobuf==4.25.8
189
+ psutil==7.1.3
190
+ ptyprocess==0.7.0
191
+ pure_eval==0.2.3
192
+ py-cpuinfo==9.0.0
193
+ py-spy==0.4.1
194
+ pyarrow==22.0.0
195
+ pyasn1==0.6.1
196
+ pyasn1_modules==0.4.2
197
+ pybind11==3.0.1
198
+ pycountry==24.6.1
199
+ pycparser==2.23
200
+ pydantic==2.12.5
201
+ pydantic_core==2.41.5
202
+ pydantic-extra-types==2.10.6
203
+ pydantic-settings==2.12.0
204
+ pygame==2.6.1
205
+ Pygments==2.19.2
206
+ pyjnius==1.7.0
207
+ pylatexenc==2.10
208
+ pyparsing==3.2.5
209
+ pyserini==1.2.0
210
+ python-dateutil==2.9.0.post0
211
+ python-dotenv==1.2.1
212
+ python-json-logger==4.0.0
213
+ python-multipart==0.0.20
214
+ pytokens==0.3.0
215
+ pytz==2025.2
216
+ PyYAML==6.0.3
217
+ pyzmq==27.1.0
218
+ ragen==0.1
219
+ rank-bm25==0.2.2
220
+ RapidFuzz==3.14.3
221
+ ray==2.52.1
222
+ referencing==0.37.0
223
+ regex==2025.11.3
224
+ requests==2.32.5
225
+ rich==14.2.0
226
+ rich-toolkit==0.17.0
227
+ rignore==0.7.6
228
+ rpds-py==0.30.0
229
+ rsa==4.9.1
230
+ safetensors==0.7.0
231
+ scikit-learn==1.7.2
232
+ scipy==1.15.3
233
+ sentencepiece==0.2.1
234
+ sentry-sdk==2.46.0
235
+ setuptools==80.9.0
236
+ shellingham==1.5.4
237
+ six==1.17.0
238
+ smart_open==7.5.0
239
+ smmap==5.0.2
240
+ sniffio==1.3.1
241
+ soupsieve==2.8
242
+ spacy==3.8.11
243
+ spacy-legacy==3.0.12
244
+ spacy-loggers==1.0.5
245
+ srsly==2.5.2
246
+ sse-starlette==3.0.3
247
+ stack-data==0.6.3
248
+ starlette==0.50.0
249
+ sympy==1.13.1
250
+ tabulate==0.9.0
251
+ tenacity==9.1.2
252
+ tensorboard==2.20.0
253
+ tensorboard-data-server==0.7.2
254
+ tensordict==0.8.3
255
+ thefuzz==0.22.1
256
+ thinc==8.3.10
257
+ threadpoolctl==3.6.0
258
+ tiktoken==0.12.0
259
+ together==1.5.31
260
+ tokenizers==0.22.1
261
+ tomli==2.3.0
262
+ torch==2.6.0+cu124
263
+ torchaudio==2.6.0
264
+ torchdata==0.11.0
265
+ torchvision==0.21.0
266
+ tqdm==4.67.1
267
+ traitlets==5.14.3
268
+ transformers==4.57.3
269
+ triton==3.2.0
270
+ typer==0.19.2
271
+ typer-slim==0.20.0
272
+ typing_extensions==4.15.0
273
+ typing-inspection==0.4.2
274
+ tzdata==2025.2
275
+ urllib3==2.5.0
276
+ uvicorn==0.38.0
277
+ uvloop==0.22.1
278
+ verl==0.5.0.dev0
279
+ virtualenv==20.35.4
280
+ vllm==0.8.5
281
+ wandb==0.23.0
282
+ wasabi==1.1.3
283
+ watchfiles==1.1.1
284
+ wcwidth==0.2.14
285
+ weasel==0.4.3
286
+ websockets==15.0.1
287
+ Werkzeug==3.1.4
288
+ wheel==0.45.1
289
+ wrapt==2.0.1
290
+ xformers==0.0.29.post2
291
+ xgrammar==0.1.18
292
+ xxhash==3.6.0
293
+ yarl==1.22.0
294
+ zipp==3.23.0
295
+ typeguard==4.4.4
296
+ tyro==1.0.3
297
+ verl==0.5.0.dev0
298
+ autocommand==2.2.2
299
+ backports.tarfile==1.2.0
300
+ importlib_metadata==8.0.0
301
+ inflect==7.3.1
302
+ jaraco.collections==5.1.0
303
+ jaraco.context==5.3.0
304
+ jaraco.functools==4.0.1
305
+ jaraco.text==3.12.1
306
+ more-itertools==10.3.0
307
+ packaging==24.2
308
+ platformdirs==4.2.2
309
+ tomli==2.0.1
310
+ typeguard==4.3.0
311
+ typing_extensions==4.12.2
312
+ wheel==0.45.1
313
+ zipp==3.19.2
wandb/run-20260112_225324-locrg3kr/files/wandb-metadata.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.14.0-284.25.1.el9_2.x86_64-x86_64-with-glibc2.35",
3
+ "python": "CPython 3.10.19",
4
+ "startedAt": "2026-01-12T14:53:24.482263Z",
5
+ "args": [
6
+ "--track"
7
+ ],
8
+ "program": "/mnt/general/wanghy/RAGEN/cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
9
+ "codePath": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
10
+ "codePathLocal": "cleanrl/cleanrl/scout_dqn/dqn_rubikscube.py",
11
+ "git": {
12
+ "remote": "https://github.com/mll-lab-nu/RAGEN.git",
13
+ "commit": "8d73639b99b38265453f898b8d6af7d4af50d56e"
14
+ },
15
+ "email": "haoyu-wa22@mails.tsinghua.edu.cn",
16
+ "root": "/mnt/general/wanghy/RAGEN",
17
+ "host": "pt-a93c53b7eacd4c2ca962941d3210c0ac-worker-0",
18
+ "executable": "/root/local/miniconda3/envs/ragen/bin/python",
19
+ "cpu_count": 64,
20
+ "cpu_count_logical": 128,
21
+ "gpu": "NVIDIA H100 80GB HBM3",
22
+ "gpu_count": 4,
23
+ "disk": {
24
+ "/": {
25
+ "total": "2576980377600",
26
+ "used": "3724316672"
27
+ }
28
+ },
29
+ "memory": {
30
+ "total": "2163639439360"
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper",
38
+ "uuid": "GPU-cff454b9-f118-535b-5e1f-6d503e78e52e"
39
+ },
40
+ {
41
+ "name": "NVIDIA H100 80GB HBM3",
42
+ "memoryTotal": "85520809984",
43
+ "cudaCores": 16896,
44
+ "architecture": "Hopper",
45
+ "uuid": "GPU-9e77c178-188c-f869-780e-858c20a7d322"
46
+ },
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper",
52
+ "uuid": "GPU-c63d047d-a077-6c9a-20aa-d43d7cfb61c9"
53
+ },
54
+ {
55
+ "name": "NVIDIA H100 80GB HBM3",
56
+ "memoryTotal": "85520809984",
57
+ "cudaCores": 16896,
58
+ "architecture": "Hopper",
59
+ "uuid": "GPU-6b73ee0d-b923-d26e-4c48-314e4ccbebc7"
60
+ }
61
+ ],
62
+ "cudaVersion": "13.0",
63
+ "writerId": "38xx0mqyxzx0knb11tf2de7k74fbhknb"
64
+ }
wandb/run-20260112_225324-locrg3kr/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"eval/success_rate":0.99925,"eval/std_return":0.06474532779282224,"_step":400000,"eval/episodes":4000,"train/loss":0.0006442762678489089,"global_step":400000,"_runtime":689.639799334,"eval/avg_return":0.893023,"_timestamp":1.7682302954374332e+09,"train/learning_rate":0.00025,"train/success_rate_100":1,"train/success":1,"perf/SPS":590,"charts/epsilon":0.05,"_wandb":{"runtime":689},"train/episodic_length":1,"train/episodic_return":0.956}