Skip to content
Roadmap0/111
not startedstudy day 5 of 6 · covers original day 68

Study grammar-constrained generation and structured decoding

P2 RAG platformS7D6
not started0/5 blocks
0/5
Jump & context

Week 9: AI-SDLC Release Gates, PyRIT CI/CD, CFG Output Caging & Model Extraction Defense

The five hours

  1. 01

    Concepts & system design

    60 min

    R30 — OWASP Improper Output Handling

    R07 — JSON Schema

    Read the assigned sections; map the mechanism, threat model and trade-offs.

  2. 02

    Project implementation

    120 min

    Study Context-Free Grammar (CFG) constrained decoding and structured output modes. Configure constrained generation on your local runtime where supported, paired with mandatory server-side validation in D6.

    Build, integrate, debug and improve the increment in the active project.

  3. 03

    Security lab

    60 min

    Document and test scenarios where output is 100% grammar/schema-valid (e.g., valid JSON types) but semantically unsafe (e.g., phishing link inside a valid string field or unauthorized business amount), proving why constrained decoding never replaces server-side policy validation.

    Test the abuse case, failure path, authorization bypass or resource limit.

  4. 04

    Verification & evidence

    30 min

    Constrained-decoding vs. server-validation comparison test and ADR.

    Add or run regression tests; record the 9-point evidence record.

  5. 05

    Deliberate practice & Socratic review

    30 min

    Answer the 8 Socratic questions without notes: What? Why? How? What if? Why not? How can I prove it? Where can it break? What have I learned?

    Re-explain the hardest concept aloud, inspect one edge case, update the gap log.

  6. total5 h

Read today · inside the concepts block

R07 R30

Read only the named sections needed for today's task. Reading sits inside the 60-minute concepts block; it is not extra time.

Free resources for this day

5 curated
  • docsvLLM docs
    Structured Outputs

    Shows how to turn a JSON Schema, regex, or grammar into a token mask on a local OpenAI-compatible runtime, the constrained-generation mode to enable on your own endpoint.

    R07checked 2026-11-11
  • videoEngineering Insider
    Constrained Decoding Explained: How LLMs Generate Perfect Structured Output

    Explains schema-guided decoding via finite-state machines and compares native vendor modes with Outlines and Instructor, mapping the options for your local runtime.

    R07checked 2026-11-11
  • videoAgent Engineering
    Constrained Decoding Explained: How JSON Mode Really Works

    Shows the per-step logit masking that makes JSON mode valid-by-construction, and therefore why validity at decode time still says nothing about truth or safety.

    R07checked 2026-11-11
  • articlepacket.ai
    Constrained Decoding Explained

    Explains grammar-based masking and the schema-design trap where an over-constrained schema silently degrades generation quality — the utility cost of CFG output caging.

    R07checked 2026-11-11
  • repodottxt (GitHub)
    dottxt-ai/outlines: Structured Outputs

    Library that compiles regex, JSON Schema, and CFG grammars into token masks, so you can run constrained generation locally and still validate server-side in D6.

    R07checked 2026-11-11

Evidence record · 9-point standard

0/9

A lab is complete only when it produces evidence. Installing PyRIT, Garak, Presidio or TransformerLens is not completion. Saved on this device only.

Day notes

empty

The two source formulations

verbatim · nothing summarised

Project & Deliverable Target

P2 | `D6` (CFG Output Caging Layer) | S7

Core Implementation

Study Context-Free Grammar (CFG) constrained decoding and structured output modes. Configure constrained generation on your local runtime where supported, paired with mandatory server-side validation in D6.

Security Lab

Document and test scenarios where output is 100% grammar/schema-valid (e.g., valid JSON types) but semantically unsafe (e.g., phishing link inside a valid string field or unauthorized business amount), proving why constrained decoding never replaces server-side policy validation.

Verification & Evidence

Constrained-decoding vs. server-validation comparison test and ADR.

Read Today (60m Concepts Block)

R30 (OWASP Improper Output Handling), R07 (JSON Schema).

---