evaluators icon indicating copy to clipboard operation
evaluators copied to clipboard

[BUG]: Math Standards Alignment evaluate() scores a code's first Knowledge Graph match, so 174 state codes return 0 of 0

Open taylorhaun opened this issue 1 month ago • 1 comments

Description

When a statement code matches several Knowledge Graph standards, MathStandardsAlignmentEvaluator.evaluate() judges the first match. If that match has no learning components and a later one does, it returns aligned_count: 0, total_count: 0 without calling the model. StandardsCatalog.validateCodes() resolves the same code to the later match (the resolver from #149), so a code that passes the SDK's own check scores 0 of 0. Python's evaluate_by_code() also returns 0 of 0 for the example below, with and without grade_level='9'.

California HSN-RN.B.3 has three matches with identical descriptions, all grades 9–12:

Match caseIdentifierUUID Learning components
1 28445563-14aa-40a6-853b-83265cd5332e 0
2 7bb9a770-d7cc-11e8-824f-0242ac160002 0
3 519f4bd8-113a-4237-a89e-b1fbd9e94a20 3

A sweep of every coded K–12 math statement in all 52 jurisdictions found 174 affected codes in five states. validateCodes() resolves 173 of them; it calls Utah F.IF.7.b (the example in #149) ambiguous.

Jurisdiction Codes Example (components per match)
California 86 HSN-RN.B.3 (0, 0, 3)
Georgia 43 8.FGR.5.3 (0, 8)
Arkansas 24 5.GM.7 (0, 3)
Utah 17 A.CED.4 (0, 6, 0)
South Dakota 4 HSF-BF.A.1.b (0, 4)

Steps to reproduce

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

const catalog = new StandardsCatalog({ learningCommonsApiKey, academicSubject: 'Mathematics' })
const [check] = await catalog.validateCodes(['HSN-RN.B.3'], { jurisdiction: 'California' })
// check.status === 'resolved', check.uuid === '519f4bd8-113a-4237-a89e-b1fbd9e94a20' (3 components)

const evaluator = new MathStandardsAlignmentEvaluator({ anthropicApiKey, learningCommonsApiKey })
const { result, metadata } = await evaluator.evaluate({
  question: 'Explain why the sum of 1/2 and √2 is irrational.',
  statement_code: 'HSN-RN.B.3',
  jurisdiction: 'California',
})
// result: { statement_code: 'HSN-RN.B.3', learning_components: [], aligned_count: 0, total_count: 0 }
// metadata.tokenUsage: { inputTokens: 0, outputTokens: 0 }  (no model call)

Expected behavior

evaluate() judges the question against the standard validateCodes() resolves to: match 3, with its three learning components.

Environment

  • Node.js 22.18 (local) and Vercel, server-side; Python 3.12 and 3.14
  • @learning-commons/evaluators 1.2.0 and learning-commons-evaluators 1.1.0 (found on 1.1.1 and 1.0.0)
  • Knowledge Graph API v0, checked 2026-10-13, 2026-10-14 and 2026-10-19

Additional context

  • #377 addresses this.
  • This is the follow-up #149 left open: "wiring _evaluateCore to the resolver is a follow-up".
  • We found it on a partner's California high school items, which passed validateCodes() and then scored 0 of 0 in every run.

taylorhaun avatar Oct 19 '26 15:10 taylorhaun

Addressed in #377 (draft). I checked the example from this issue against the live Knowledge Graph:

  • validateCodes() resolves HSN-RN.B.3 to 519f4bd8-… with 3 components.
  • TypeScript evaluate() now judges that copy: case_identifier_uuid: 519f4bd8-…, total_count: 3, 3 components sent to the model. The model was stubbed, so the verdicts are not checked.
  • Python's resolver picks the same copy with and without grade_level='9'.

Not covered: #381 (the component-ID failure) is a separate change.

adnanrhussain avatar Oct 19 '26 16:10 adnanrhussain