← 🧠 Foundations of LLMs & GenAI
Core
Constrained Decoding
Constrained decoding forces a model's output to match a schema or grammar by masking the logits at each step so the model can only sample tokens the grammar still allows. It guarantees structurally valid output (JSON, SQL, a fixed enum) at a small latency cost, which is why FDE loops reach for it the moment a pipeline depends on parseable model output.
a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
LLM & GenAI FundamentalsYou need guaranteed JSON from the model, but it keeps breaking the schema. What do you do?→SQL & Data EngineeringWrite PySpark to read a directory of JSON files, flatten the nested schema, and write a Delta table partitioned by date.→LLM & GenAI FundamentalsAt millions of calls a day, do you guarantee structured output with constrained decoding or validate-and-retry? Defend the economics.→AI Security, Privacy & GovernanceSet up a red-teaming evaluation framework for a code-generation model that sometimes emits malicious scripts→Coding & DSAParse a JSON-lines file of LLM logs and aggregate tokens generated per request.→ML Infrastructure & GPUsWrite a GPU kernel that masks logits to a grammar's DFA during decoding, with under 1% overhead.→
