promptdojo_

Attention weights must sum to 1, but this normalizes by the count of scores instead of their sum — so the weights come out as [0.5, 1.5] and don't sum to 1 (the "average" is broken). Fix line 2 to divide by the total score.

Expected output:

[0.25, 0.75]
The break is on line 2 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.