SimpleOPD for cross-tokenizer on-policy distillation.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add hiyenwong/ai_collection --skill simple-tokenizer-agnostic-on-policy-distillation --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Simple Tokenizer Agnostic On Policy Distillation?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hiyenwong-simple-tokenizer-agnostic-on-policy-distillation)More formats (shields.io, HTML) on the badges page.
---
name: simple-tokenizer-agnostic-on-policy-distillation
description: "SimpleOPD for cross-tokenizer on-policy distillation."
version: 1.0
author: Haonan He et al.
license: CC-BY-4.0
tags:
- on-policy distillation
- knowledge distillation
- tokenizer alignment
- long-context reasoning
related_skills:
- simple-opd-on-policy-distillation
- on-policy-distillation-dlm-transformation
- tt-opd-medical-agent-training
---
# SimpleOPD: Simple Tokenizer-Agnostic On-Policy Distillation
## When to Use
Use SimpleOPD when:
- Transferring reasoning capabilities from long-context teacher models to short-context student models
- Working with teacher and student models that have different tokenizers
- Experiencing training instability, response length explosion, or excessive truncation in standard OPD
- Needing to stabilize on-policy distillation across different model families
- Improving mathematical or scientific reasoning in student models through distillation
## Overview
SimpleOPD is a methodology for transferring reasoning capabilities from long-context teacher models to short-context student models, even across different tokenizers. It addresses key challenges in on-policy distillation (OPD): tokenizer mismatch, teacher-student distribution mismatch, response length explosion, and training instability.
## Key Components
### 1. Cross-tokenizer Alignment
- Perform OPD in a shared text space rather than token space
- Align teacher and student tokens only when they occupy identical text spans in the response string
- Use a linear two-pointer scan to find aligned token pairs
- Unmatched positions fall back to the student's log-probability
- This provides reliable token-level supervision without requiring artificial correspondence between incompatible tokenizations
### 2. Student Reference KL Loss
- Add a KL divergence loss between the student policy and its initial policy
- This constrains the student from drifting excessively from its initial policy
- Mitigates teacher-student distribution mismatch
- Larger teacher-student gaps generally require stronger KL regularization
- Helps foster steady response length growth within the student's context budget
### 3. Termination Token Advantage Masking
- Mask the advantages of special termination tokens such as `< /think>` and `< |im_end| >`
- Prevents teacher supervision from directly suppressing termination
- Addresses the issue where long-context teachers discourage students from terminating their thinking process
- Reduces truncation and promotes appropriate response lengths
## Implementation Steps
1. **Generate Student Responses**: Sample response-token sequences using the student policy
2. **Reconstruct Teacher Context**: Use the teacher's chat template and append the student response string
3. **Tokenize with Both Tokenizers**: Tokenize the response with both student and teacher tokenizers
4. **Align Tokens**: Find token pairs that occupy identical text spans using the two-pointer scan algorithm
5. **Construct Teacher Targets**: For aligned positions, use teacher log-probabilities; for unmatched positions, use student log-probabilities
6. **Apply OPD Objective**: Use the cross-tokenizer distillation objective with PPO clipped policy loss
7. **Add Regularization**: Include student reference KL loss and mask termination token advantages
8. **Train**: Update the student policy using the combined objective
## Best Practices
- Set appropriate KL loss coefficients based on the teacher-student gap (e.g., 0.5 for same-family models, 1.0 for cross-family models)
- Monitor training dynamics including truncation rate, repetition rate, and average response length
- Use multiple rollouts per prompt (typically 4) for stable training
- Select the best checkpoint based on validation performance on both reasoning tasks and output quality metrics
## Use Cases
- Transferring long-context reasoning capabilities to short-context models
- Cross-tokenizer knowledge distillation
- Mathematical proof generation transfer
- Stabilizing on-policy distillation training
- Improving mathematical and scientific reasoning in student models
## Activation Keywords
simpleopd, tokenizer-agnostic, on-policy distillation, cross-tokenizer, kl regularization, termination masking, long-context reasoning, knowledge distillation
## References
- arXiv: [2608.14277v1](https://arxiv.org/abs/2608.14277v1)
- Original paper: "SimpleOPD: Simple Tokenizer-Agnostic On-Policy Distillation for Long-Context Reasoning"Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!