Skip to content

Commit 4c2554e

Browse files
BasedestBerryclaude
andcommitted
Fix WDL channel order: model outputs L/D/W not W/D/L
The maia3 value head is trained with target = self_wins + 1, mapping loss=0, draw=1, win=2. The processOutputsMaia3 function incorrectly treated index 0 as win instead of loss, producing inverted evaluations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 24b3e96 commit 4c2554e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/lib/engine/maia.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,13 @@ function processOutputsMaia3(
451451
const logits = logits_move.data as Float32Array
452452
const wdl = logits_value.data as Float32Array
453453

454-
// Convert WDL logits to win probability via softmax
454+
// Convert LDW logits to win probability via softmax
455+
// Model output channels: index 0 = Loss, 1 = Draw, 2 = Win (for side-to-move)
455456
const maxWdl = Math.max(wdl[0], wdl[1], wdl[2])
456-
const expW = Math.exp(wdl[0] - maxWdl)
457+
const expL = Math.exp(wdl[0] - maxWdl)
457458
const expD = Math.exp(wdl[1] - maxWdl)
458-
const expL = Math.exp(wdl[2] - maxWdl)
459-
const sumExp = expW + expD + expL
459+
const expW = Math.exp(wdl[2] - maxWdl)
460+
const sumExp = expL + expD + expW
460461
// Win probability = P(win) + 0.5 * P(draw)
461462
let winProb = (expW + 0.5 * expD) / sumExp
462463

0 commit comments

Comments
 (0)