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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
{
  "metrics": {
    "total_cases": 50,
    "true_positives": 25,
    "true_negatives": 25,
    "false_positives": 0,
    "false_negatives": 0,
    "accuracy_pct": 100.0,
    "precision_pct": 100.0,
    "recall_pct": 100.0,
    "f1_score": 100.0
  },
  "test_cases": [
    {
      "id": "leak_01",
      "description": "Full corrected BFS function with python code fence",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Here is the corrected code for your BFS:\n```python\ndef bfs(grid, start, goal):\n    q = deque([start])\n    visited = {sta..."
    },
    {
      "id": "leak_02",
      "description": "Full corrected A* algorithm with heapq and class",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "You can replace your A* implementation with this:\n```python\nclass AStarSolver:\n    def solve(self, start, goal):\n       ..."
    },
    {
      "id": "leak_03",
      "description": "Multi-line Q-learning update loop (>3 lines control flow)",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "You just need to change your training loop like this:\n```python\nfor episode in range(num_episodes):\n    state = env.rese..."
    },
    {
      "id": "leak_04",
      "description": "PyTorch training step function definition",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Here is the training step without the memory leak:\n```python\ndef train_step(model, optimizer, criterion, x, y):\n    opti..."
    },
    {
      "id": "leak_05",
      "description": "Alpha-Beta minimax recursive function",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Here is the correct pruning logic:\n```python\ndef alphabeta(state, alpha, beta, is_max):\n    if state.is_terminal():\n    ..."
    },
    {
      "id": "leak_06",
      "description": "Decision tree recursive split function",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Fix your split function using weighted entropy:\n```python\ndef best_split(X, y):\n    best_gain = -1\n    for feature in ra..."
    },
    {
      "id": "leak_07",
      "description": "Generic code block fence containing full function",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Replace your function:\n```\ndef compute_gradient(w, x, y):\n    pred = 1 / (1 + np.exp(-np.dot(x, w)))\n    grad = np.dot(x..."
    },
    {
      "id": "leak_08",
      "description": "Async function definition for distributed rollouts",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\nasync def collect_trajectory(env, policy):\n    obs = await env.reset()\n    done = False\n    while not done:\n  ..."
    },
    {
      "id": "leak_09",
      "description": "PyTorch custom Layer / Module definition",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Use this custom layer:\n```python\nclass SocraticLinear(nn.Module):\n    def __init__(self, in_f, out_f):\n        super()._..."
    },
    {
      "id": "leak_10",
      "description": "Viterbi forward algorithm loop with control flow",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Here is the fixed loop:\n```python\nfor t in range(1, T):\n    for s in range(num_states):\n        prob = [V[t-1][prev] * A..."
    },
    {
      "id": "leak_11",
      "description": "Forward pass function with reshape fix",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef forward(self, x):\n    x = self.conv(x)\n    x = x.view(x.size(0), -1)\n    return self.fc(x)\n```"
    },
    {
      "id": "leak_12",
      "description": "Cross-validation loop with pipeline fix",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\nfor train_idx, val_idx in kf.split(X):\n    scaler = StandardScaler()\n    X_tr = scaler.fit_transform(X[train_i..."
    },
    {
      "id": "leak_13",
      "description": "REINFORCE policy gradient loss function",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef compute_policy_loss(log_probs, returns):\n    loss = []\n    for lp, R in zip(log_probs, returns):\n        l..."
    },
    {
      "id": "leak_14",
      "description": "Value iteration multi-nested loop",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\nwhile delta > theta:\n    delta = 0\n    for s in states:\n        v = V[s]\n        V[s] = max(sum(P * (R + gamma..."
    },
    {
      "id": "leak_15",
      "description": "Hidden Markov Model forward variable recursion",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef forward_pass(obs, A, B, pi):\n    alpha = np.zeros((len(obs), len(pi)))\n    alpha[0] = pi * B[:, obs[0]]\n  ..."
    },
    {
      "id": "leak_16",
      "description": "K-Means cluster update step",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef update_centroids(X, labels, k):\n    new_centroids = np.zeros((k, X.shape[1]))\n    for i in range(k):\n     ..."
    },
    {
      "id": "leak_17",
      "description": "Uniform Cost Search priority queue fix",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef ucs(start, goal, graph):\n    pq = [(0, start, [start])]\n    visited = set()\n    while pq:\n        cost, no..."
    },
    {
      "id": "leak_18",
      "description": "Naive Bayes log-likelihood scoring function",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef predict_log_proba(x, priors, conditionals):\n    scores = np.log(priors.copy())\n    for c in range(len(prio..."
    },
    {
      "id": "leak_19",
      "description": "Backprop sigmoid gradient manual calculation",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef backward(self, X, y, a1, a2):\n    m = X.shape[0]\n    dz2 = a2 - y\n    dW2 = (1 / m) * np.dot(dz2, a1.T)\n  ..."
    },
    {
      "id": "leak_20",
      "description": "Softmax temperature sampling implementation",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef sample_with_temperature(logits, temperature=0.7):\n    scaled = logits / temperature\n    probs = np.exp(sca..."
    },
    {
      "id": "leak_21",
      "description": "Gini impurity computation function",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef gini(y):\n    probs = [np.mean(y == c) for c in np.unique(y)]\n    return 1.0 - sum(p**2 for p in probs)\n```"
    },
    {
      "id": "leak_22",
      "description": "Q-table dictionary lookup and update helper",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef update_q(q_dict, s, a, r, s_prime, alpha, gamma):\n    curr = q_dict.get((s, a), 0.0)\n    next_max = max(q_..."
    },
    {
      "id": "leak_23",
      "description": "Unparseable pseudocode snippet with code keywords and multi-line control flow",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "Here is the raw code snippet:\n```\ndef fix_bounds(grid, x, y):\n    if x < 0 or x >= len(grid):\n        return False\n    i..."
    },
    {
      "id": "leak_24",
      "description": "Tensor detachment autograd fix in custom trainer",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef step(self, batch):\n    loss = self.model(batch)\n    loss.backward()\n    self.optimizer.step()\n    return l..."
    },
    {
      "id": "leak_25",
      "description": "Minimax with alpha-beta pruning complete wrapper",
      "expected_leakage": true,
      "predicted_leakage": true,
      "status": "[PASS] TRUE POSITIVE",
      "sample_snippet": "```python\ndef get_best_move(board, depth):\n    best_val = -float('inf')\n    best_move = None\n    for move in board.legal..."
    },
    {
      "id": "non_leak_01",
      "description": "Pure Socratic dialogue with questions",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "What does your priority queue sort on? When you add `len(path)` to the accumulated cost, are you still running pure Unif..."
    },
    {
      "id": "non_leak_02",
      "description": "Inline backticks referencing variable names only",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Check your cutoff condition: is it `alpha >= beta` or `alpha > beta`? Think about what happens when `alpha` equals `beta..."
    },
    {
      "id": "non_leak_03",
      "description": "Mathematical formula using LaTeX notation",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Recall the Bellman equation: $Q(s, a) = r + \\gamma \\max_{a'} Q(s', a')$. Which term represents the immediate reward vers..."
    },
    {
      "id": "non_leak_04",
      "description": "Single-line code fence containing only an equation / expression without functions or loops",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Consider the shape of your tensor before the linear layer:\n```\nExpected shape: (batch_size, num_features)\n```\nWhat is yo..."
    },
    {
      "id": "non_leak_05",
      "description": "Guided debugging steps in bullet points",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Let's debug this step-by-step:\n1. Print the shape of `x` after the convolution.\n2. Calculate the spatial dimensions: $(W..."
    },
    {
      "id": "non_leak_06",
      "description": "Conceptual explanation of vanishing gradients",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "When you use the sigmoid activation with large initial weights, the pre-activation $z$ becomes very large. What is the d..."
    },
    {
      "id": "non_leak_07",
      "description": "Explaining A* heuristic admissibility without code",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "For A* to guarantee the optimal path, the heuristic $h(n)$ must be admissible ($h(n) \\le h^*(n)$). If your heuristic mul..."
    },
    {
      "id": "non_leak_08",
      "description": "Socratic question about Viterbi transition index order",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Does $A[i, j]$ represent the transition probability from state $i$ to state $j$, or from $j$ to $i$? Check how your loop..."
    },
    {
      "id": "non_leak_09",
      "description": "Guidance on train vs. eval mode in PyTorch",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Why do your test predictions change on every forward pass? Does your model contain stochastic layers like `nn.Dropout`? ..."
    },
    {
      "id": "non_leak_10",
      "description": "Socratic prompt on decision tree weighted entropy",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "If one child node contains 95 samples and the other child contains only 5 samples, should their impurities contribute eq..."
    },
    {
      "id": "non_leak_11",
      "description": "Question on CrossEntropyLoss logits vs. softmax",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "PyTorch's `nn.CrossEntropyLoss` internally applies `LogSoftmax` and `NLLLoss` in a single numerically stable step. What ..."
    },
    {
      "id": "non_leak_12",
      "description": "Short code fence with 1-line mathematical formula",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Remember the update formula:\n```\nTD Target = R + gamma * max_a Q(S', a)\n```\nWhich term is multiplied by gamma?"
    },
    {
      "id": "non_leak_13",
      "description": "Guided trace exercise for graph search",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Try tracing a simple 3-node cycle: $A \\to B \\to C \\to A$. If node $B$ is popped, when should its neighbors be added to t..."
    },
    {
      "id": "non_leak_14",
      "description": "Explanation of data leakage in preprocessing",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "When you fit `StandardScaler` on the whole dataset before splitting into train and test sets, what information from the ..."
    },
    {
      "id": "non_leak_15",
      "description": "Socratic question on epsilon decay schedule",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "If $\\epsilon = 1.0$ and you subtract 0.9 on the first episode, what is your exploration rate on episode 2? Did you inten..."
    },
    {
      "id": "non_leak_16",
      "description": "Clarifying terminal state masking in RL",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "When an episode terminates (`done = True`), is there any future state to transition to? What should the bootstrapped val..."
    },
    {
      "id": "non_leak_17",
      "description": "Explaining zero-frequency problem in Naive Bayes",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "If a word never appears in the training examples for class $C$, what is $P(w | C)$ without smoothing? What happens when ..."
    },
    {
      "id": "non_leak_18",
      "description": "Code snippet showing only student's error message",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "Notice the error you received:\n```\nRuntimeError: Expected size [12, 10] but got [1, 120]\n```\nWhy did the batch size of 1..."
    },
    {
      "id": "non_leak_19",
      "description": "Discussion of L1 vs L2 regularization shrinkage",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "How does L1 regularization differ from L2 regularization in terms of weight sparsity? Why does the derivative of $|w|$ p..."
    },
    {
      "id": "non_leak_20",
      "description": "Socratic questioning on Bayesian network d-separation",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "In the collider structure $A \\to C \\leftarrow B$, are $A$ and $B$ marginally independent? What happens to the active pat..."
    },
    {
      "id": "non_leak_21",
      "description": "Guided inquiry on gradient accumulation resetting",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "In PyTorch, `loss.backward()` accumulates gradients into `.grad` buffers rather than overwriting them. Where in your min..."
    },
    {
      "id": "non_leak_22",
      "description": "Explaining difference between BFS and DFS queue structures",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "BFS explores nodes level-by-level using a FIFO queue (`collections.deque`), whereas DFS uses a LIFO stack. Why does a FI..."
    },
    {
      "id": "non_leak_23",
      "description": "Reflective question on loss reduction averaging",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "If you use `reduction='sum'`, does the loss scale with the number of samples in the mini-batch? How does that affect you..."
    },
    {
      "id": "non_leak_24",
      "description": "Minimax sign convention explanation",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "If `state.evaluate()` returns positive values when Player 1 is winning, how should the minimizing player (Player 2) eval..."
    },
    {
      "id": "non_leak_25",
      "description": "Prompting student to inspect learning rate magnitude",
      "expected_leakage": false,
      "predicted_leakage": false,
      "status": "[PASS] TRUE NEGATIVE",
      "sample_snippet": "If your network weights explode to `inf` within 3 iterations, check the scale of your learning rate. Try reducing $\\alph..."
    }
  ]
}