Exact nondecreasing-subsequence constrained decoder
Equip an autoregressive model with a hard constraint that generated token ranks cannot contain a nondecreasing subsequence of length k. Maintain a patience-sorting-style state representing the smallest ending token rank achievable by subsequences of lengths 1 through k-1, mask tokens that would create a length-k subsequence, and optionally sample uniformly among valid continuations using exact suffix counts. This provides a mathematically controlled data-augmentation or decoding regime for…