Skip to content

feat(score): admit teacher scores across compatible token spaces - #66

Merged
FeathBow merged 1 commit into
mainfrom
feat/tokenspace
Oct 16, 2026
Merged

FeathBow merged 1 commit into
mainfrom
feat/tokenspace

Conversation

@FeathBow

Copy link
Copy Markdown
Owner

Why

A distillation teacher had to share the student's complete tokenizer identity. Scorers also checked the path against the target's prompt rendering and stopping rules. A teacher with a different chat template could not score a student path even when its token identifiers had the same meaning.

What

Tokenizer identity now hashes a canonical description with three layers: token space, text processing and execution. Inference and score load records carry the loaded tokenizer's description; the pure core verifies its identity and rejects source tokens outside its space.

Teacher scoring requires a directional consumption permit. The target must have the same base vocabulary and decoder, and matching added tokens on every source identifier; it may have additional identifiers. The permit binds the admitted trajectory to the loaded target and its input/output bounds. HF, MLX and vLLM consume the recorded path without rendering it again or applying the teacher's EOS. Probabilities remain normalized over every target output coordinate, and full-vocabulary probes must match that width. This permits scoring a path; it does not establish equivalence between the models' full distributions.

Input checks distinguish the tokens needed to score the response from extra tokens an executor feeds. HF and vLLM do not feed the last response token. MLX does for its discarded lookahead, so its worker checks that token before any forward, and the core checks it from the execution record. Online admission and replay use the same pure checks.

invar train adds --teacher-tokenizer-digest. Student rollout and learner roles still share a complete tokenizer identity, including the versions of tokenizers, transformers and jinja2, so their environments must agree on those versions. Tokenizer identities change; existing checkpoints and evidence need the corresponding earlier core and workers. The loop and backend documentation describe these requirements.

Validation

The core suite, formatting, lint, type fixtures and HF, MLX, vLLM and shared worker suites passed. Regression cases cover directional inclusion, implementation versions, probe widths and execution-specific input bounds. The HF distillation test uses a teacher with a different template through training, resume and history admission. Mutation checks exercise both omitted checks and an overly restrictive shared input bound.

On an RTX 6000 Ada, a Qwen3.5-4B student and frozen Qwen3.8-27B teacher completed scoring and two distillation updates with a PEFT learner and one resident teacher. The teacher's token space includes the student's. The run passed resume and history admission; the final core re-admitted its retained score and history with matching reports. Using different tokenizer package versions for student roles was refused at load.

…hecked token-space permit

Signed-off-by: Feathbow <feathbow@gmail.com>
@FeathBow
FeathBow merged commit 1cb55de into main Oct 16, 2026
3 checks passed
@FeathBow
FeathBow deleted the feat/tokenspace branch October 16, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant