token healing
**Token healing** is the **inference technique that repairs token-boundary inconsistencies between prompt endings and generated continuations** - it reduces artifacts caused by subword tokenization boundaries.
**What Is Token healing?**
- **Definition**: Adjustment step that revisits boundary tokens to ensure smooth continuation tokenization.
- **Problem Source**: Prompt truncation or partial-token endings can misalign next-token probabilities.
- **Healing Behavior**: Decoder may re-evaluate recent token boundary choices before continuing.
- **Applicability**: Especially useful for code, markup, and languages with complex subword splits.
**Why Token healing Matters**
- **Fluency Improvement**: Reduces awkward seams at prompt-to-generation transitions.
- **Syntax Stability**: Helps prevent malformed tokens in structured outputs.
- **Quality Consistency**: Lowers edge-case regressions in prefix-cached and resumed decoding.
- **Developer Trust**: Improves predictability when prompts end near token boundaries.
- **Serving Robustness**: Mitigates artifacts in streaming and continuation-heavy workloads.
**How It Is Used in Practice**
- **Boundary Detection**: Identify risky prompt endings where token splits are ambiguous.
- **Selective Recompute**: Re-score only local boundary region to limit latency overhead.
- **A/B Validation**: Measure artifact reduction and ensure no regression in throughput.
Token healing is **a targeted fix for tokenizer-boundary generation artifacts** - token healing improves continuity with modest runtime complexity.