class
DCCD
local dc = Grammar.dccd(ctx, vocab, {
seq_id = session.seq_id,
draft_sampler = free_sampler,
constrain_sampler = grammar_sampler,
max_draft_tokens = 128,
close_thinking = true, -- required for Qwen3.5 / DeepSeek-R1
})
local result = dc:generate()
print(result.text) -- grammar-valid output
print(result.draft) -- unconstrained draft for debugging
Functions
DCCD.new
Create a DCCD generator.
DCCD.new(ctx, vocab, opts)
ctxanyion7-core Context.
vocabanyion7-core Vocab.
optstable
→ DCCD
DCCD:_run_pass
DCCD:_run_pass(sampler, max_tokens, on_token)
DCCD:generate
Generate using Draft-Conditioned Constrained Decoding. Implements the algorithm from arXiv:2603.03305 (Feb 2026). Requires the configured seq to already hold the prompt — call after your pipeline has decoded the prompt tokens into that seq.
DCCD:generate(opts)
optstable?
→ table?
DCCD:best_of
Convenience: run DCCD with best-of-K draft selection.
DCCD:best_of(k, opts)
knumberNumber of drafts to try.
optstable?Same as generate().
→ table?Best result across K attempts.