Repository navigation
laya scorer: load the tokenizer once, not on every score() call - #217
Conversation
Scorer::score() read tokenizer.json again on every call, ~48 ms of each routing decision on strixhalo. The scorer now keeps the tokenizer it loads in load(). CPU scorer on the 200 routing cases: 411 -> 352 ms a decision, 191/200 either way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Docs7 for 1bit-monster/engine
Commit |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Scorer::score()read and parsedtokenizer.jsonagain on every call. On strixhalo that costs about 48 ms of each routing decision; the timings come from instrumentingscore()while running the Laya encoder on the NPU. The scorer now keeps the tokenizer it already loads inload()for the special-token ids.Measured on strixhalo with
laya_classify_evalon the 200 routing cases (typed-decisions checkpoint, CPU scorer):Scorergets an out-of-line constructor and destructor, because it now holds astd::unique_ptrto the forward-declarednpu::Tokenizer. It was never copied.score()was already not re-entrant (it writeserr_), so sharing one tokenizer adds no new constraint.Local ctest passes 12/12. The
laya_gategolden tests aren't configured on this box becausegolden.jsonisn't present.🤖 Generated with Claude Code