Repository navigation
fix(eval): keep F1 finite for constructor tokens - #898
Merged
Merged
Conversation
External contribution policy✅ This PR now complies with the external contribution policy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix for the public
AxEvalUtil.f1Scoremetric.What is the current behavior?
AxEvalUtil.f1Score('constructor', 'constructor')returnsNaN, as do partial and disjoint comparisons involving that word. The token-count dictionary inheritsObject.prototype.constructor, which is mistaken for an existing count. This can contaminate evaluation averages. The merged novel-F1 fix fix(eval): compute novel F1 token overlap #856 explicitly leaves the ordinary F1 helper unchanged; this covers that remaining public path.What is the new behavior (if this is a feature change)?
Start the private token-count dictionary without a prototype. Identical constructor tokens score 1, disjoint tokens 0, and multiset overlap stays bounded by occurrence counts. Normalization, empty-input semantics, exact match and novel F1 are unchanged.
AxIR portable behavior check:
The portable behavior changes in
src/ax/dsp/eval.ts, with regressions insrc/ax/dsp/eval.test.ts. New open backlog entryaxir-2026-11-15-keep-ordinary-f1-token-counts-independent-of-inherited-object-pris bound to fix(eval): keep F1 finite for constructor tokens #898 and lists those exact two files. Only the requiredir/axir-backlog.jsonand rendereddocs/AXIR_BACKLOG.mdexception accompany the handwritten TypeScript. Existing entries/exemptions are unchanged.npm run axir:backlog:check -- --base origin/main --head HEADandnpm run axir:backlog:validatepass. No generated language or AxIR source change is included.Other information:
Against main
007ab8366e5bfa98d871feb1af188cc029295c58, the public-export regression produced 5 failures and 23 passing controls/existing tests. All 28 pass after the one-line fix.npm run test:unit --workspace=@ax-llm/ax -- --maxWorkers=2: 4,157 passed, 4 skipped. Run with local HTTP/controlled subprocess permission; the initial restricted-environment attempt was not an acceptance result.npm run test:type-check --workspace=@ax-llm/axandnpm run build --workspace=@ax-llm/ax: passed.git diff --check: passed.Reproduction calls the exported metric in Node directly; no model, provider, or external service is involved. AI assistance (Codex) was used for investigation, implementation, review and testing. No human code review is claimed.