Score predictions on the text the model was trained on - #1038
Merged
Userunknown84 merged 1 commit intoAug 1, 2026
Conversation
Training fits the vectorizer on normalized text while the prediction path transformed the raw string, so homoglyphs, zero-width characters and spaced-out words reached the vocabulary intact. Introduce a single preparation contract that both regimes call, and key the response cache on the string that is actually scored.
|
@pavsoss is attempting to deploy a commit to the Aditya Sharma's projects Team on Vercel. A member of the Team first needs to authorize it. |
This was referenced Aug 1, 2026
Contributor
Author
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.
Summary
Training prepares text with the shared normalizer before fitting the TF-IDF vocabulary, but the prediction path handed the vectorizer the raw input — the normalizer was reached for only when building a cache key. The obfuscations it exists to undo (Cyrillic look-alikes, zero-width joiners,
f r e espacing) therefore survived into the vectorizer, fell out of vocabulary, and weakened detection on exactly the messages most likely to be evasive.Part of #1037.
Changes
Both regimes now go through one text-preparation contract. Training calls it, the prediction path calls it before vectorizing, and the response cache is keyed on the same prepared string that is actually scored — previously two different inputs reducing to the same canonical form could share one cache entry while being scored differently.
Preparation runs after translation, so a non-English message is canonicalised in the language the model was trained on.
Test plan