Module matcher

Module matcher 

Source

Structs§

BatchGrammarMatcher
A batched driver over many GrammarMatchers — fills one packed bitmask tensor for a whole decode batch in parallel.
BitmaskSlice
A mutable, vocab-sized view over a caller-owned i32 slice.
GrammarMatcher
A stateful matcher that matches sampled tokens against a compiled grammar — the core of grammar-guided generation.
TokenBitmask
A packed bit-per-token accept mask owned by a super::GrammarMatcher.

Enums§

FillError
Why GrammarMatcher::fill_next_token_bitmask could not fill.

Constants§

BITS_PER_WORD
Bits packed per i32 word — fixed by the C++ DynamicBitset.

Functions§

bitmask_size
Number of i32 words needed to hold a bit-per-token mask for a vocabulary of vocab_size tokens.