Spaces:
Sleeping
Sleeping
deploy rater (Docker/FastAPI): registration + completeness gate + /api/submit → dataset
Browse files- static/index.html +7 -1
static/index.html
CHANGED
|
@@ -1586,15 +1586,21 @@ function renderVideoControls(c) {
|
|
| 1586 |
// Per-row shuffle of slot positions. Seeded by (rater, case, q_key) so the
|
| 1587 |
// order is deterministic across refreshes/devices for the same rater but
|
| 1588 |
// independent across rows — prevents positional bias on any single question.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1589 |
function rowSlotOrder(caseId, qKey, slotCount) {
|
| 1590 |
// Admin "Reveal models" mode short-circuits to the case-level order so the
|
| 1591 |
// researcher can spot-check.
|
| 1592 |
if (!anonymize) return Array.from({ length: slotCount }, (_, i) => i);
|
| 1593 |
const idx = Array.from({ length: slotCount }, (_, i) => i);
|
| 1594 |
let s = hashStr(RATER.id + ":" + caseId + ":" + qKey);
|
|
|
|
| 1595 |
for (let i = idx.length - 1; i > 0; i--) {
|
| 1596 |
s = (s * 1664525 + 1013904223) >>> 0;
|
| 1597 |
-
const j = s % (i + 1);
|
| 1598 |
[idx[i], idx[j]] = [idx[j], idx[i]];
|
| 1599 |
}
|
| 1600 |
return idx;
|
|
|
|
| 1586 |
// Per-row shuffle of slot positions. Seeded by (rater, case, q_key) so the
|
| 1587 |
// order is deterministic across refreshes/devices for the same rater but
|
| 1588 |
// independent across rows — prevents positional bias on any single question.
|
| 1589 |
+
//
|
| 1590 |
+
// LCGs have poor low-order bits, so a naive `s % (i+1)` over 2 slots was
|
| 1591 |
+
// returning the same answer for ~90% of q_keys with a shared prefix. We
|
| 1592 |
+
// (1) warm up the LCG several steps so similar seeds diverge, then
|
| 1593 |
+
// (2) sample from the high bits of the state instead of the low bits.
|
| 1594 |
function rowSlotOrder(caseId, qKey, slotCount) {
|
| 1595 |
// Admin "Reveal models" mode short-circuits to the case-level order so the
|
| 1596 |
// researcher can spot-check.
|
| 1597 |
if (!anonymize) return Array.from({ length: slotCount }, (_, i) => i);
|
| 1598 |
const idx = Array.from({ length: slotCount }, (_, i) => i);
|
| 1599 |
let s = hashStr(RATER.id + ":" + caseId + ":" + qKey);
|
| 1600 |
+
for (let k = 0; k < 6; k++) s = (s * 1664525 + 1013904223) >>> 0;
|
| 1601 |
for (let i = idx.length - 1; i > 0; i--) {
|
| 1602 |
s = (s * 1664525 + 1013904223) >>> 0;
|
| 1603 |
+
const j = (s >>> 16) % (i + 1);
|
| 1604 |
[idx[i], idx[j]] = [idx[j], idx[i]];
|
| 1605 |
}
|
| 1606 |
return idx;
|