Guide-linked quiz · Medium Level

Guided Beam Search with Constraints Quiz

Covers beam search, lexical and grammar constraints, dynamic beam allocation, and the distinction between syntax and semantic validity.

Question 1 of 8

What does plain beam search keep at each generation step?

Preview every question8 questions

Answers and explanations appear as you take the quiz.

  1. What does plain beam search keep at each generation step?
    • The top-k most probable partial sequences
    • Only the single most probable token
    • All possible sequences
    • A random sample of sequences
  2. How do lexically constrained methods like Grid Beam Search organize beams?
    • By output length only
    • By how many required constraints each beam has satisfied
    • Alphabetically
    • By the model's confidence alone
  3. In grammar-constrained decoding, how is invalid output prevented?
    • By deleting bad tokens after generation
    • By retraining the model on valid examples
    • By masking token probabilities so only grammar-valid tokens are allowed
    • By lowering the temperature
  4. What problem does Dynamic Beam Allocation solve?
    • It removes the need for constraints
    • It makes the model larger
    • It eliminates beam search entirely
    • It efficiently shares beam slots across levels of constraint progress
  5. When can grammar-constrained decoding produce syntactically valid JSON?
    • When the grammar constraint is enforced through completion and the output is not truncated
    • Whenever JSON is mentioned in the prompt
    • Even if the runtime stops before required closing tokens
    • Regardless of whether the active grammar matches the intended schema
  6. Why can hard constraints crowd out good sequences without special handling?
    • They make all beams identical
    • High-probability beams that ignore constraints could dominate the top-k
    • They slow the GPU
    • They increase the vocabulary size
  7. A lexical constraint requires a translation to include “bridge” and “river.” What does constrained beam search enforce?
    • The output has exactly two words
    • The model uses only one beam
    • The completed output includes the required terms
    • The translation is factually accurate
  8. A grammar-constrained generator returns JSON that parses successfully. What does that not establish by itself?
    • That the output follows the grammar
    • That required fields can be present
    • That the syntax is valid
    • That the values are factually correct or appropriate for the application

Keep testing yourself

More quizzes picked for your level.

View all quizzes