evaluators icon indicating copy to clipboard operation
evaluators copied to clipboard

[BUG]: Math Standards Alignment fails the whole evaluation when one component's verdict can't be matched, and TypeScript never retries

Open taylorhaun opened this issue 1 month ago • 0 comments

Description

For some questions, MathStandardsAlignmentEvaluator.evaluate() fails with:

LLMOutputProcessingError: LLM response missing verified evaluations for LC identifiers: <id>. Standard: <code>

The completeness check is all or nothing, so when one component's verdict can't be matched, every other verdict is thrown away. We've seen two causes:

  1. A mis-copied id. 4.NBT.B.6 has 9 components, and components 3 and 5 differ only in three- vs four-digit dividends. The reply writes component 5's lc_id (9d81bd35-6783-5812-9ec4-ec99dcbba3c2) wrong, usually as some form of component 3's id: its tail (5f64-55aa-8287-a076bb8e5875), its full id repeated, or with the first digit changed (5e0b8067-…). The SDK keys verdicts by id, so component 5 has none.
  2. An omission. HSA-CED.A.1 has 41 components. For "A taxi charges a $4 initial fee plus $3 per mile. Write and solve an equation to find how many miles you can travel for $25.", the reply had 40 verdicts and left out component 12 (3abd1adb-d141-5fb7-a631-b846ae574ade).

Even at temperature 0 it's intermittent and shifts from day to day. The taxi question failed 13 of 13 runs on 2026-10-14 and 0 of 11 on 2026-10-19. The repro question below failed every run on both days (5 of 5, then 4 of 4).

Steps to reproduce

import { MathStandardsAlignmentEvaluator } from '@learning-commons/evaluators'

const evaluator = new MathStandardsAlignmentEvaluator({ anthropicApiKey, learningCommonsApiKey })
await evaluator.evaluate({
  question: 'Find the quotient and remainder for 2,347 ÷ 5. Explain your strategy.',
  statement_code: '4.NBT.B.6',
  jurisdiction: 'Multi-State',
})
// LLMOutputProcessingError: LLM response missing verified evaluations for LC identifiers:
//   9d81bd35-6783-5812-9ec4-ec99dcbba3c2. Standard: 4.NBT.B.6

Expected behavior

Every learning component the evaluator sends gets a verdict. When the reply leaves one unmatched, the SDK recovers instead of failing the whole evaluation.

Environment

  • Node.js 22.18 (local) and Vercel, server-side
  • @learning-commons/evaluators 1.2.0 (found on 1.1.1), default config; ai 7.0.139 and @ai-sdk/anthropic 4.0.69
  • claude-haiku-4-5-20251001 at temperature 0 (the contract's defaults); replies end with end_turn, so nothing is cut off

Additional context

  • TypeScript never retries this. The completeness check runs after generateStructured() returns, and maxRetries only covers failed API calls, so every run makes one model call even though LLMOutputProcessingError is marked retryable. Python resamples (#312), but at temperature 0 it tends to get the same reply: a MathFish task on 4.NBT.B.6 failed on component 5 in every call we made on Python 1.0.0.
  • A fix that worked for us: limit lc_id to the ids actually sent (an enum in the output schema). With only that change to the SDK's request, the prompts failing that day went from 15 of 15 runs failing to 0 of 15 on 2026-10-14 (the taxi omission included), and from 10 of 12 to 0 of 12 on 2026-10-19. Another option is to ask again for just the unmatched components.
  • In practice: 7 of 606 question–standard pairs across a partner's five uploads hit this, and 6 could never be scored.

taylorhaun avatar Oct 19 '26 15:10 taylorhaun