Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/gpu-head-to-head/blob/main/q35-9b/tools/test-token-audit.mjs # gpu-head-to-head aien-dev/gpu-head-to-head Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `gpu-head-to-head / q35-9b / tools / test-token-audit.mjs` 22 lines ยท 1331 bytes Raw Blame History 1 import test from 'node:test'; 2 import assert from 'node:assert/strict'; 3 import {compareTokens,uniqueRows,findObservation} from './token-audit.mjs'; 4 test('short prefixes and extra tokens cannot become identical',()=>{ 5 assert.equal(compareTokens([10,20],[10]).identical,false); 6 assert.equal(compareTokens([10],[10,20]).first_div,1); 7 assert.equal(compareTokens([10,20],[10,20]).identical,true); 8 assert.equal(compareTokens([10,20],[10,21]).token_b,21); 9 }); 10 test('a different token or divergence position cannot borrow an old tie',()=>{ 11 const records=[{prompt_id:'p',first_div:1,oracle_tok:20,arm_tok:21,oracle_len:2,logit_gap:0}]; 12 assert(findObservation(records,'p',compareTokens([10,20],[10,21]))); 13 assert.equal(findObservation(records,'p',compareTokens([10,20],[10,22])),null); 14 assert.equal(findObservation(records,'p',compareTokens([20,10],[21,10])),null); 15 assert.equal(findObservation(records,'other',compareTokens([10,20],[10,21])),null); 16 assert.equal(findObservation(records,'p',compareTokens([10,20],[10])),null); 17 }); 18 test('invalid IDs and duplicated/missing prompts fail closed',()=>{ 19 for(const ids of [[-1],[1.5],['1'],null]) assert.throws(()=>compareTokens(ids,[])); 20 assert.throws(()=>uniqueRows([{prompt_id:'p'},{prompt_id:'p'}])); 21 assert.throws(()=>uniqueRows([{}])); 22 });