Beam Search & Constrained DecodingTheory, math, and algorithms of beam search and constrained decoding for LLM generation.