SPB Git

spb/llmindex Public

The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.

TypeScript 77.9% TeX 15.2% Python 3.7% SQL 1.4% JavaScript 1.1% Shell 0.5%
3.9 KB · 91 lines typescript
Raw Blame History
1/**2 * llmindex.io — reasoning item templates (generated deduction puzzles, unique solution)3 * Author:  Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */7import { ANSWER_FORMAT_INSTRUCTIONS } from '../answer';8import type { ItemTemplate } from '../types';910const NAMES = [11  'Alice', 'Bruno', 'Chen', 'Dara', 'Emil', 'Farah', 'Goran', 'Hana', 'Ines', 'Jonas',12  'Kira', 'Liam', 'Mona', 'Nadir', 'Ola', 'Priya', 'Quinn', 'Rosa', 'Sami', 'Tessa',13];14const ATTRIBUTES = [15  { adj: 'taller', sup: 'tallest', inv: 'shortest' },16  { adj: 'older', sup: 'oldest', inv: 'youngest' },17  { adj: 'faster', sup: 'fastest', inv: 'slowest' },18  { adj: 'heavier', sup: 'heaviest', inv: 'lightest' },19];2021export const reasoningOrder: ItemTemplate = {22  id: 'reasoning.deduction.order-v2',23  domain: 'reasoning',24  description:25    'Total-order deduction over 7 people with non-adjacent transitive clues, an inert distractor person, and a rank query (not just the extremes).',26  paramSpace: NAMES.length ** 8 * ATTRIBUTES.length * 5040 * 7,27  render(rng, perturbSeed) {28    const people = rng.shuffle(NAMES).slice(0, 8);29    const ordered = people.slice(0, 7); // hidden order; ordered[0] greatest30    const distractor = people[7]!;31    const attr = rng.pick(ATTRIBUTES);32    // Clue set: adjacent relations pin the order, but present them mixed with33    // redundant non-adjacent clues (harder to assemble) and one distractor34    // clue about an unrelated attribute for an unrelated person.35    const relations: string[] = [];36    for (let i = 0; i < ordered.length - 1; i++) {37      relations.push(`${ordered[i]} is ${attr.adj} than ${ordered[i + 1]}.`);38    }39    for (let k = 0; k < 3; k++) {40      const i = rng.int(0, ordered.length - 3);41      const j = rng.int(i + 2, ordered.length - 1);42      relations.push(`${ordered[i]} is ${attr.adj} than ${ordered[j]}.`);43    }44    const otherAttr = rng.pick(ATTRIBUTES.filter((a) => a !== attr));45    relations.push(`${distractor} is ${otherAttr.adj} than everyone here, but ${distractor} is not being ranked.`);46    const clues = rng.shuffle(relations).join(' ');47    const rank = rng.int(2, 6); // interior ranks are harder than extremes48    const ordinal = ['', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh'][rank]!;49    return {50      templateId: this.id,51      domain: this.domain,52      prompt:53        `Seven people are ranked by who is ${attr.adj} (rank 1 = ${attr.sup}). ${clues} ` +54        `Who is ${ordinal} (rank ${rank})?\n\nAnswer with the name only.\n\n${ANSWER_FORMAT_INSTRUCTIONS}`,55      answerKey: ordered[rank - 1]!,56      grading: 'exact',57      perturbSeed,58    };59  },60};6162export const reasoningSchedule: ItemTemplate = {63  id: 'reasoning.deduction.position-v1',64  domain: 'reasoning',65  description:66    'Positional deduction: 4 people in a queue with relative-position clues; ask who occupies a given position.',67  paramSpace: NAMES.length ** 4 * 24 * 4,68  render(rng, perturbSeed) {69    const people = rng.shuffle(NAMES).slice(0, 4);70    const order = rng.shuffle(people); // order[0] = front of the queue71    const clues: string[] = [];72    // Clues that jointly force the permutation: position of one, plus relative constraints.73    const anchorIdx = rng.int(0, 3);74    clues.push(`${order[anchorIdx]} is number ${anchorIdx + 1} in the queue.`);75    for (let i = 0; i < 3; i++) {76      if (i !== anchorIdx) clues.push(`${order[i]} is directly ahead of ${order[i + 1]}.`);77    }78    const askPos = rng.int(1, 4);79    return {80      templateId: this.id,81      domain: this.domain,82      prompt:83        `Four people stand in a queue (number 1 is the front). ${rng.shuffle(clues).join(' ')} ` +84        `Who is number ${askPos}?\n\nAnswer with the name only.\n\n${ANSWER_FORMAT_INSTRUCTIONS}`,85      answerKey: order[askPos - 1]!,86      grading: 'exact',87      perturbSeed,88    };89  },90};91