pub fn clamp_trainable_to_vocab(
trainable: &[u32],
r: usize,
vocab: usize,
) -> Result<(Vec<u32>, usize)>Expand description
2026-09-25: Split trainable ids at the served vocab, keeping list order,
since delta row k belongs to the k-th id. Returns (kept_ids, skipped_count):
idx >= r(outside the adapter’s[R, h]table) is an error;vocab <= idx < ris dropped and counted;idx < vocabis kept.
Also an error: a kept id after a dropped one (dropped ids must be one
trailing run, so kept id k still matches delta row k), and a kept id
not greater than the previous kept id.