Views
No views yet
ac2. Checkpoint saved
after training step 17 (0-indexed). Strict upstream eval parity:
1100s hard kill, verbatim prompts/entrypoints, group 64x8, T=1.0, kl 0.1.1{
2 "step": 17,
3 "progress/batch": 17,
4 "optim/lr": 4e-05,
5 "progress/done_frac": 0.36,
6 "puct/buffer_size": 280,
7 "puct/sampled_size": 8,
8 "puct/T": 8704,
9 "puct/scale_last": 0.4378451425469384,
10 "puct/buffer_value/mean": 0.9224125732999638,
11 "puct/buffer_value/std": 0.05493455696646424,
12 "puct/buffer_value/min": 0.5041471954736918,
13 "puct/buffer_value/max": 0.9419923380206302,
14 "puct/buffer_timestep/mean": 7.742857142857143,
15 "puct/buffer_timestep/std": 5.055932058443017,
16 "puct/buffer_timestep/min": -1.0,
17 "puct/buffer_timestep/max": 16.0,
18 "puct/buffer_construction_len/mean": 2593.907142857143,
19 "puct/buffer_construction_len/std": 2569.8290615648475,
20 "puct/buffer_construction_len/min": 1024.0,
21 "puct/buffer_construction_len/max": 32768.0,
22 "puct/sampled_value/mean": 0.9415603027175038,
23 "puct/sampled_value/std": 0.0005579459320944292,
24 "puct/sampled_value/min": 0.940391642919903,
25 "puct/sampled_value/max": 0.9419923380206302,
26 "puct/sampled_timestep/mean": 16.0,
27 "puct/sampled_timestep/std": 0.0,
28 "puct/sampled_timestep/min": 16.0,
29 "puct/sampled_timestep/max": 16.0,
30 "puct/sampled_construction_len/mean": 2560.0,
31 "puct/sampled_construction_len/std": 886.8100134752651,
32 "puct/sampled_construction_len/min": 2048.0,
33 "puct/sampled_construction_len/max": 4096.0,
34 "time/sampling": 4244.447438001633,
35 "env/all/ac_tokens_per_turn": 9141.724609375,
36 "env/all/ob_tokens_per_turn": 4177.875,
37 "env/all/turns_per_episode": 1.0,
38 "env/all/total_episodes": 512,
39 "env/all/total_turns": 512,
40 "env/all/total_ac_tokens": 4680563,
41 "env/all/total_ob_tokens": 2139072,
42 "env/all/time/sampling_mean": 362.2539675189182,
43 "env/all/time/sampling_max": 477.3209397792816,
44 "env/all/time/env_step_mean": 1661.6694540353492,
45 "env/all/time/env_step_max": 3783.177567243576,
46 "env/all/reward/mean": 0.42416619707289027,
47 "env/all/reward/max": 0.9426164833500205,
48 "env/all/reward/min": 0.0,
49 "env/all/format": 1.0,
50 "env/all/format/min": 1.0,
51 "env/all/format/max": 1.0,
52 "env/all/reward": 0.42416619707289027,
53 "env/all/correctness": 0.505859375,
54 "env/all/correctness/min": 0.0,
55 "env/all/correctness/max": 1.0,
56 "env/all/raw_score": 0.8385061501981461,
57 "env/all/raw_score/min": 0.01672118273850871,
58 "env/all/raw_score/max": 0.9426164833500205,
59 "env/all/initial_raw_score": 0.9415603027175037,
60 "env/all/initial_raw_score/min": 0.940391642919903,
61 "env/all/initial_raw_score/max": 0.9419923380206302,
62 "env/all/msg": "Evaluation timed out after 1100 seconds.",
63 "env/all/parsed_code": "```python\nimport numpy as np\nfrom typing import Tuple\nimport time\nimport random\nfrom scipy.optimize import minimize\nfrom scipy.optimize import Bounds\n\ndef _simpson_l2sq(conv: np.ndarray) -> Tuple[float, np.ndarray]:\n \"\"\"Compute ||f*f||_2^2 via Simpson's rule with endpoint zeros and gradient.\"\"\"\n m = conv.size\n if m == 0:\n return 0.0, np.zeros_like(conv)\n dx = 1.0 / (m + 1)\n y = np.zeros(m + 2, dtype=conv.dtype)\n y[0] = 0.0\n y[1:-1] = conv\n y[-1] = 0.0\n lhs = y[:-1]\n rhs = y[1:]\n l2_sq = (dx / 3.0) * np.sum(lhs * lhs + lhs * rhs + rhs * rhs)\n grad_y = (dx / 3.0) * (4.0 * y + np.roll(y, 1) + np.roll(y, -1))\n grad_conv = grad_y[1:-1]\n return float(l2_sq), grad_conv\n\ndef _l1(conv: np.ndarray) -> Tuple[float, np.ndarray]:\n \"\"\"Compute ||f*f||_1 and its gradient.\"\"\"\n m = conv.size\n dx = 1.0 / (m + 1) if m > 0 else 1.0\n val = dx * float(np.sum(conv)) if m > 0 else 0.0\n grad = np.full_like(conv, dx)\n return val, grad\n\ndef _linf(conv: np.ndarray) -> Tuple[float, np.ndarray]:\n \"\"\"Compute ||f*f||_inf and its subgradient.\"\"\"\n if conv.size == 0:\n return 0.0, np.zeros_like(conv)\n m = float(np.max(conv))\n mask = conv == m\n count = int(mask.sum())\n if count == 0 or m <= 0.0:\n return m, np.zeros_like(conv)\n grad = mask.astype(conv.dtype)\n return m, grad\n\ndef _objective_and_grad_conv(conv: np.ndarray) -> Tuple[float, np.ndarray]:\n \"\"\"Compute C = l2_sq / (l1 * linf) and its gradient.\"\"\"\n l2_sq, g_l2 = _simpson_l2sq(conv)\n l1, g_l1 = _l1(conv)\n linf, g_linf = _linf(conv)\n if l1 <= 0.0 or linf <= 0.0:\n return 0.0, np.zeros_like(conv)\n denom = l1 * linf\n c_value = l2_sq / denom\n num_grad = g_l2 * denom - l2_sq * (g_l1 * linf + l1 * g_linf)\n g_conv = num_grad / (denom * denom)\n return float(c_value), g_conv\n\ndef _grad_h_from_conv_grad(h: np.ndarray, g_conv: np.ndarray) -> np.ndarray:\n \"\"\"Compute gradient of C w.r.t h from gradient of C w.r.t conv.\"\"\"\n h_rev = h[::-1]\n g_h = np.convolve(g_conv, h_rev, mode=\"valid\")\n return 2.0 * g_h\n\nclass _Adam:\n \"\"\"Lightweight Adam optimizer for numpy arrays (per-candidate).\"\"\"\n def __init__(self, shape, lr=3e-2, beta1=0.9, beta2=0.999, eps=1e-8, dtype=np.float32):\n self.m = np.zeros(shape, dtype=dtype)\n self.v = np.zeros(shape, dtype=dtype)\n self.t = 0\n self.lr = lr\n self.b1 = beta1\n self.b2 = beta2\n self.eps = eps\n\n def step(self, params, grad):\n self.t += 1\n self.m = self.b1 * self.m + (1 - self.b1) * grad\n self.v = self.b2 * self.v + (1 - self.b2) * (grad * grad)\n m_hat = self.m / (1 - self.b1 ** self.t)\n v_hat = self.v / (1 - self.b2 ** self.t)\n return params + self.lr * m_hat / (np.sqrt(v_hat) + self.eps)\n\ndef _batch_objective(h_batch: np.ndarray) -> Tuple[np.ndarray, list[np.ndarray]]:\n \"\"\"Vectorized evaluation of objective and gradient.\"\"\"\n bsz = h_batch.shape[0]\n c_vals = np.zeros(bsz, dtype=np.float32)\n conv_grads = [None] * bsz\n for b in range(bsz):\n h = np.clip(h_batch[b], 0.0, None)\n conv = np.convolve(h, h, mode=\"full\")\n c_val, g_conv = _objective_and_grad_conv(conv)\n c_vals[b] = c_val\n conv_grads[b] = g_conv\n return c_vals, conv_grads\n\ndef _phase_update(h_batch, opt_list, lr, add_noise=False, t=0, eta=5e-3, gamma=0.3, noise_coeff=0.25):\n \"\"\"Update all candidates in the batch.\"\"\"\n bsz = h_batch.shape[0]\n c_vals, conv_grads = _batch_objective(h_batch)\n grads = np.zeros_like(h_batch, dtype=h_batch.dtype)\n for b in range(bsz):\n clipped = np.clip(h_batch[b], 0.0, None)\n grads[b] = _grad_h_from_conv_grad(clipped, conv_grads[b])\n if add_noise:\n sigma = eta / ((t + 1) ** gamma)\n noise = sigma * np.random.normal(size=grads.shape).astype(grads.dtype)\n grads += noise * noise_coeff\n for b in range(bsz):\n opt = opt_list[b]\n opt.lr = lr\n h_new = opt.step(h_batch[b], grads[b].astype(h_batch.dtype))\n h_batch[b] = np.clip(h_new, 0.0, None)\n return h_batch, c_vals\n\ndef _elitist_respawn(h_batch, c_vals, keep_frac, init_sampler, opt_list):\n \"\"\"Keep top fraction and respawn the rest.\"\"\"\n bsz = h_batch.shape[0]\n keep_n = max(1, int(bsz * keep_frac))\n idx = np.argsort(c_vals)[-keep_n:]\n survivors = h_batch[idx].copy()\n fresh = init_sampler(bsz - keep_n)\n new_batch = np.concatenate([survivors, fresh], axis=0)\n new_opts = [opt_list[i] for i in idx]\n for _ in range(bsz - keep_n):\n new_opts.append(_Adam(shape=h_batch.shape[1:], lr=opt_list[0].lr, dtype=h_batch.dtype))\n return new_batch, new_opts\n\ndef _upsample_1d(h: np.ndarray) -> np.ndarray:\n \"\"\"Upsample by linear interpolation for structured preservation.\"\"\"\n return np.interp(np.linspace(0, 1, 2 * h.size), np.linspace(0, 1, h.size), h)\n\ndef _single_candidate_finetune(h0: np.ndarray, lr=3e-3, steps=300_000) -> Tuple[np.ndarray, float]:\n \"\"\"Refine a single candidate using Adam with projection.\"\"\"\n h = h0.astype(np.float32).copy()\n opt = _Adam(h.shape, lr=lr, dtype=h.dtype)\n best_c = 0.0\n for _ in range(steps):\n h_clip = np.clip(h, 0.0, None)\n conv = np.convolve(h_clip, h_clip, mode=\"full\")\n c_val, g_conv = _objective_and_grad_conv(conv)\n g_h = _grad_h_from_conv_grad(h_clip, g_conv)\n h = np.clip(opt.step(h, g_h.astype(h.dtype)), 0.0, None)\n best_c = max(best_c, c_val)\n return h, float(best_c)\n\ndef construct_function():\n \"\"\"\n Construct optimized step function sequence using enhanced exploration, adaptive sampling,\n and refined optimization, emphasizing structured patterns like single peaks to reach high C_lower_bound.\n \"\"\"\n # Starting parameters with enhanced exploration\n n_start = 1024 # Initial resolution\n bsz = 32 # Increased batch size for diversity\n total_iter = 90_000 # Increased for deeper exploration\n explore_steps = 60_000 # Increased exploration phase\n drop_every = 1000 # Frequent respawns for diversity\n keep_frac = 0.8 # Moderate elite preservation\n\n # Initialize from previous best if available\n if 'height_sequence_1' in globals():\n prev = np.array(height_sequence_1, dtype=np.float32)\n else:\n prev = np.ones(n_start, dtype=np.float32)\n prev = np.clip(prev, 0.0, 1000.0)\n if prev.shape[0] != n_start:\n x_old = np.linspace(-0.5, 0.5, prev.shape[0])\n x_new = np.linspace(-0.5, 0.5, n_start)\n prev = np.interp(x_new, x_old, prev).astype(np.float32)\n\n # Enhanced initialization with more structured diversity\n def init_sampler(m):\n out = np.random.uniform(0.0, 1000.0, size=(m, n_start)).astype(np.float32)\n out[0] = prev # Include previous best\n\n for i in range(1, m):\n if np.random.random() < 0.8: # Higher probability for single peak\n # Single peak pattern\n pattern_idx = 0\n pos = np.random.randint(0, n_start)\n val = np.random.uniform(900, 1000) # Higher values to maximize C\n out[i] = np.zeros(n_start)\n out[i][pos] = val\n else:\n # Use 14 patterns for broader diversity\n pattern_idx = np.random.randint(0, 14)\n if pattern_idx == 0: # Gaussian-like distribution\n mean = np.random.uniform(0.2, 0.8)\n std = np.random.uniform(0.1, 0.2)\n out[i] = np.random.normal(loc=mean, scale=std, size=n_start).astype(np.float32)\n elif pattern_idx == 1: # Exponential distribution\n scale = np.random.uniform(0.2, 0.6)\n out[i] = np.random.exponential(scale=scale, size=n_start).astype(np.float32)\n elif pattern_idx == 2: # Sine wave with randomized frequency and phase\n freq = np.random.uniform(0.1, 0.5)\n phase = np.random.uniform(0, 2 * np.pi)\n t = np.linspace(-0.5, 0.5, n_start)\n out[i] = 0.5 * (1 + np.sin(2 * np.pi * freq * t + phase)).astype(np.float32)\n elif pattern_idx == 3: # Modulated sine wave\n freq1 = np.random.uniform(0.1, 0.5)\n freq2 = np.random.uniform(0.05, 0.2)\n phase = np.random.uniform(0, 2 * np.pi)\n t = np.linspace(-0.5, 0.5, n_start)\n out[i] = 0.5 * (1 + np.sin(2 * np.pi * freq1 * t + phase) * \n (1 + np.sin(2 * np.pi * freq2 * t))).astype(np.float32)\n elif pattern_idx == 4: # Random sparse spikes\n out[i] = np.random.uniform(0.0, 0.1, size=n_start).astype(np.float32)\n spike_pos = np.random.choice(n_start, 5, replace=False)\n out[i][spike_pos] += np.random.uniform(0.5, 1.5, size=5).astype(np.float32)\n elif pattern_idx == 5: # Multi-peak pattern\n num_peaks = np.random.randint(3, 6)\n peaks = np.zeros(n_start)\n for _ in range(num_peaks):\n pos = np.random.randint(0, n_start)\n val = np.random.uniform(200, 500)\n peaks[pos] = val\n out[i] = peaks.astype(np.float32)\n elif pattern_idx == 6: # Dense peak clusters\n cluster_count = np.random.randint(2, 5)\n out[i] = np.zeros(n_start)\n for _ in range(cluster_count):\n start = np.random.randint(0, n_start - 10)\n for j in range(start, start + 10):\n out[i][j] += np.random.uniform(50, 100)\n elif pattern_idx == 7: # Random uniform with small variations\n base = np.random.uniform(0.1, 0.5, size=n_start)\n noise = np.random.normal(0, 0.1, size=n_start)\n out[i] = np.clip(base + noise, 0.0, 1000.0).astype(np.float32)\n elif pattern_idx == 8: # Evenly spaced peaks\n num_peaks = np.random.randint(5, 10)\n positions = np.linspace(0, n_start - 1, num_peaks, dtype=int)\n vals = np.random.uniform(100, 200, size=num_peaks)\n out[i] = np.zeros(n_start)\n out[i][positions] = vals\n elif pattern_idx == 9: # Periodic low-amplitude peaks\n freq = np.random.uniform(0.2, 0.5)\n amp = np.random.uniform(50, 100)\n t = np.linspace(-0.5, 0.5, n_start)\n out[i] = amp * np.sin(2 * np.pi * freq * t + np.random.uniform(0, 2 * np.pi)).astype(np.float32)\n elif pattern_idx == 10: # Random sparse high peaks\n out[i] = np.random.uniform(0.0, 0.8, size=n_start).astype(np.float32)\n spike_pos = np.random.choice(n_start, 10, replace=False)\n spike_vals = np.random.uniform(800, 1000, size=10)\n out[i][spike_pos] = spike_vals\n elif pattern_idx == 11: # Random structured sparse peaks\n out[i] = np.random.uniform(0.0, 0.8, size=n_start).astype(np.float32)\n num_peaks = np.random.randint(5, 12)\n peak_indices = np.sort(np.random.choice(n_start, num_peaks, replace=False))\n peak_vals = np.random.uniform(100, 300, size=num_peaks)\n out[i][peak_indices] = peak_vals\n elif pattern_idx == 12: # Gaussian sum with random positions\n num_gaussians = np.random.randint(3, 6)\n out[i] = np.zeros(n_start)\n for _ in range(num_gaussians):\n pos = np.random.randint(0, n_start - 1)\n std = np.random.uniform(0.1, 0.4)\n val = np.random.uniform(100, 300)\n vals = np.exp(-((np.linspace(-0.5, 0.5, n_start) - pos) ** 2) / (2 * std ** 2))\n out[i] += val * vals\n elif pattern_idx == 13: # Sparse sharp pulses\n out[i] = np.random.uniform(0.0, 0.1, size=n_start).astype(np.float32)\n spike_pos = np.random.choice(n_start, 5, replace=False)\n out[i][spike_pos] = np.random.uniform(500, 1000, size=5)\n elif pattern_idx == 14: # Combination of two sine waves\n freq1 = np.random.uniform(0.1, 0.3)\n freq2 = np.random.uniform(0.2, 0.5)\n phase1 = np.random.uniform(0, 2 * np.pi)\n phase2 = np.random.uniform(0, 2 * np.pi)\n t = np.linspace(-0.5, 0.5, n_start)\n out[i] = (0.5 * (1 + np.sin(2 * np.pi * freq1 * t + phase1)) + \n 0.5 * (1 + np.sin(2 * np.pi * freq2 * t + phase2))).astype(np.float32)\n # Ensure non-negative and within bounds\n out[i] = np.clip(out[i], 0.0, 1000.0)\n return out\n\n h_batch = init_sampler(bsz)\n opt_list = [_Adam(shape=(n_start,), lr=0.015, dtype=np.float32) for _ in range(bsz)]\n best_h = h_batch.copy()\n best_c = np.full(bsz, -np.inf, dtype=np.float32)\n\n start_time = time.time()\n\n for t in range(total_iter):\n if t < explore_steps:\n # Enhanced exploration with adaptive learning rate and dynamic noise\n h_batch, c_vals = _phase_update(\n h_batch, opt_list, lr=0.015, add_noise=True, t=t, eta=5e-3, gamma=0.3, noise_coeff=0.35\n )\n else:\n # Precise refinement with controlled noise and optimized learning\n h_batch, c_vals = _phase_update(\n h_batch, opt_list, lr=3e-5, add_noise=True, t=t, eta=5e-3, gamma=0.3, noise_coeff=0.15\n )\n\n # Update best candidates\n improved_idx = c_vals > best_c\n best_c = np.where(improved_idx, c_vals, best_c)\n best_h[improved_idx] = h_batch[improved_idx]\n\n # Periodic elitist respawn for diversity maintenance\n if (t + 1) % drop_every == 0:\n h_batch, opt_list = _elitist_respawn(\n h_batch, c_vals, keep_frac=keep_frac, init_sampler=init_sampler, opt_list=opt_list\n )\n\n # Print and check for time constraints\n if t % 1000 == 0:\n elapsed = time.time() - start_time\n print(f\"Iteration {t} (elapsed: {elapsed:.1f}s) - Best score: {best_c[np.argmax(best_c)]:.6f}\")\n if elapsed > 950:\n print(\"Reached time limit, stopping early.\")\n break\n\n # Refinement with enhanced upsample and fine-tune\n idx = np.argmax(best_c)\n h_star = np.clip(best_h[idx].astype(np.float32), 0.0, None)\n \n h_up1 = _upsample_1d(h_star)\n h_up1, _ = _single_candidate_finetune(h_up1, lr=3e-3, steps=300_000)\n\n h_up2 = _upsample_1d(h_up1)\n h_up2, _ = _single_candidate_finetune(h_up2, lr=3e-3, steps=300_000)\n\n h_final = np.clip(h_up2, 0.0, 1000.0)\n heights = h_final.tolist()\n r_value = evaluate_sequence(heights)\n print(f\"Final C2 lower bound: {r_value:.6f}\")\n return heights\n```",
64 "env/all/time/policy": 362.2539675189182,
65 "env/all/time/policy/min": 194.97044849395752,
66 "env/all/time/policy/max": 477.3209397792816,
67 "env/all/time/env_step": 1661.6694540353492,
68 "env/all/time/env_step/min": 0.006661415100097656,
69 "env/all/time/env_step/max": 3783.177567243576,
70 "env/all/time/reward_compute": 2.919696271419525e-07,
71 "env/all/time/reward_compute/min": 1.825392246246338e-07,
72 "env/all/time/reward_compute/max": 7.748603820800781e-07,
73 "env/all/by_group/frac_mixed": 1.0,
74 "env/all/by_group/frac_all_good": 0.0,
75 "env/all/by_group/frac_all_bad": 0.0,
76 "advantage/mean": 0.0339106023311615,
77 "advantage/min": -1.0,
78 "advantage/max": 27.78571128845215,
79 "time/assemble_training_data": 6.7682154178619385,
80 "time/kl_vs_base": 104.92297506332397,
81 "kl_policy_base": 0.0006838893750682473,
82 "time/train": 653.6086547374725,
83 "time/save_checkpoint": 19.841790914535522,
84 "time/total": 5031.968190193176
85}[2026-07-09T06:38:34+00:00] job=1812632 node=node-30 ngpu=3 ntrain=1 replicas=2 flash_attn=no
[2026-07-09T06:45:52+00:00] job=1812704 node=node-30 ngpu=3 ntrain=1 replicas=2 flash_attn=no
[2026-07-09T07:00:42+00:00] job=1812735 node=node-1 ngpu=3 ntrain=1 replicas=2 flash_attn=no
[2026-07-09T07:26:33+00:00] job=1812827 node=node-14 ngpu=3 ntrain=1 replicas=2 flash_attn=yes
[2026-07-09T09:21:09+00:00] job=1813131 node=node-1 ngpu=3 ntrain=1 replicas=2 flash_attn=yes
[2026-07-09T14:53:48+00:00] job=1813132 node=node-2 ngpu=6 ntrain=2 replicas=4 flash_attn=yes
[2026-07-10T03:31:51+00:00] job=1816627 node=node-14 ngpu=3 ntrain=1 replicas=2 flash_attn=yes
[2026-07-10T03:54:03+00:00] job=1816628 node=node-29 ngpu=6 ntrain=2 replicas=4 flash_attn=yes
[2026-07-10T07:56:44+00:00] job=1817463 node=node-27 ngpu=3 ntrain=1 replicas=2 flash_attn=yes
[2026-07-10T09:10:26+00:00] job=1817464 node=node-7 ngpu=6 ntrain=2 replicas=4 flash_attn=yes