Constrained-Aware Generative AI

Computer Science department, University of Virginia


Course description

Generative AI systems are increasingly deployed in settings where correctness is defined by explicit constraints and verifiable properties: physical feasibility in robotics, structural validity in proteins and materials, syntactic and semantic correctness in code, and safety and policy compliance in language. This course develops the algorithmic and mathematical foundations of constrained-aware generative AI. The central question is how to turn powerful probabilistic generators into reliable components for scientific and engineering workflows, where outputs must satisfy hard or verifiable requirements such as physical laws, discrete structure rules, safety specifications, and system-level constraints (for example, feasibility of a robot trajectory, validity of a molecular graph, or compliance with a policy).

Students will learn the algorithmic foundations of likelihood-based modeling, latent-variable methods, autoregressive Transformers, diffusion models, and flow matching, and then connect these models to optimization and control mechanisms such as projection and proximal steps, constrained decoding, differentiable optimization layers, and reinforcement learning for alignment. A short optimization bootcamp is included to support students who have had a first machine learning course but limited exposure to convex optimization.

Prerequisites

Students are expected to have completed a first graduate-level machine learning course (or equivalent). Familiarity with linear algebra, probability, and gradient-based optimization in ML is assumed. Some degree of knowledge on convex optimization is desirable. We will introduce optimization first as an operational tool (projection, penalties, prox), then formalized (duality, KKT, splitting), and finally used for differentiable layers and alignment.

Learning objectives

By the end of the course, students should be able to:

  1. Formalize constraint-aware generation as approximate inference, sampling, or optimization under hard and soft constraints.
  2. Derive and interpret core objectives for generative modeling, including maximum likelihood, ELBO-based objectives, and diffusion and flow-based training objectives.
  3. Explain and implement constraint enforcement mechanisms.
  4. Use core optimization concepts to analyze modern constrained generation algorithms.
  5. Critically evaluate constraint-aware generative systems using appropriate metrics for validity, constraint satisfaction, robustness, and generalization of constraints.

Course structure

The course is organized as follows:

A recurring course template is the constrained target distribution:

\[\text{sample} x \sim p_\theta(x | c) \quad \text{subject to} \quad x \in \mathcal{C}\ \text{(hard)} \text{or} \, g(x)\le 0\ \text{(soft)},\]

where constraints may be symbolic (grammars, automata, SAT/SMT), geometric (equivariance, manifolds, SE(3)), physical (PDEs, energy minimization, stability), or preference-based (toxicity, helpfulness). Each paper and method in the course will be analyzed by (i) how it represents constraints, (ii) where constraints enter (training, architecture, inference, post-processing), and (iii) how it performs constrained inference.

Course Schedule

Part 1: Instructor-led bootcamp

Symbols [R] denotes ``required’’ reading.

L1: Course overview and taxonomy of constraints

Tuesday, January 13, 2026

Lecture notes

We will review why constraints matter in generative AI: validity, safety, and controllability. Then define constrained-aware generation by specifying a target distribution that blends a base model with constraint terms, for example

\[\pi(x \mid c)\ \propto\ p_\theta(x \mid c)\,\exp(-\lambda \phi(x,c))\,\mathbf{1}\{x \in \mathcal{C}(c)\}.\]

Every method in the course chooses where to implement \(\phi\) or \(\mathcal{C}\) (training, architecture, inference, post-processing), and how to approximate sampling or optimization under \(\pi\).

Suggested readings:

L2: Likelihood and latent-variable modeling for control

Thursday, January 15, 2026

Lecture notes

We will review maximum likelihood, conditional modeling, ELBO for latent-variable models. The goal is to approach approximate inference because later we will need to ``add constraints’’ within this framework.

Suggested readings:

L3: VAEs and GANs

Tuesday, January 20, 2026

Lecture notes

We will cover conditional VAEs, structured priors, and posterior regularization as early ``weak control’’ strategies. Then GANs as implicit control, and why feasibility constraints are awkward without explicit likelihood. This will give us the necessary context for why iterative refinement methods are so attractive for constraints.

Suggested readings:

L4: Autoregressive Transformers and decoding

Thursday, January 22, 2026

Lecture notes

We will review transformers, factorization, and basic sampling. Then decoding methods (beam search, top-p, reranking). We will also cover constrained decoding via grammars or finite-state constraints as the first concrete example of ``generation as search subject to constraints’’.

Suggested readings:

L5: Architectures for control

January 27, 2026

This lecture will review the recent progress on geometric deep learning, equivariance, and inductive biases.

Suggested readings:

L6: Optimization essentials

Thursday, January 29, 2026

We will cover constraint sets, projections, why projections solve a least-squares problem, and what a penalty method is. We will introduce proximal operators for nonsmooth penalties and review duality.

L7: Diffusion models and Guidance

Tuesday, February 3, 2026

We will cover DDPM objective and the conceptual score view. The emphasis will be algorithmic: the reverse process is a sequence of updates, so it has natural insertion points for constraint forces, projection, or repair.

L8: Flow matching and rectified flows

Thursday, February 5, 2026

Flow matching as learning a vector field; rectified flows as simplified transport. The point is that ODE form makes constraint injection feel like adding a control term, and it motivates later splitting methods.

L9: Discrete diffusion models.

Tuesday, February 10, 2026

Masked or denoising diffusion for tokens, joint distribution control versus AR conditionals, and how constraints can act as (i) constrained unmasking policies, (ii) constrained decoding on intermediate representations, or (iii) projection onto probability simplices with constraints. This sets up your lab phase on discrete constraints without needing duality yet.

Part 2: Invited lectures

L11: Generative AI for Protein Design

Thursday, February 12, 2026

L12: Generative AI for Weather Prediction

Tuesday, February 17, 2026

L13: Generative AI for Material Science

Tuesday, February 19, 2026

L14: Preliminary Projects and Teams.

Thursday, February 24, 2026

We will use this time to discuss and refine project ideas proposed by various teams.

Teams are required to:

L15: Generative AI for Robotics

Tuesday, February 26, 2026

Part 3: Research-based lab (Proposed – will be subject to change)

Each lab lecture begins with a short micro-lecture followed by two student paper presentations and discussion.

Class Date Notes
Spring Recess February 28 - March 8
16 Tuesday, March 10, 2026 Paper & Group TBD
17 Thursday, March 12, 2026 Paper & Group TBD
18 Tuesday, March 17, 2026 Paper & Group TBD
19 Thursday, March 19, 2026 Paper & Group TBD
20 Tuesday, March 24, 2026 Paper & Group TBD
21 Thursday, March 26, 2026 Paper & Group TBD
22 Tuesday, March 31, 2026 Paper & Group TBD
23 Thursday, April 2, 2026 Paper & Group TBD
24 Tuesday, April 7, 2026 Paper & Group TBD
25 Thursday, April 9, 2026 Paper & Group TBD
26 Tuesday, April 14, 2026 Paper & Group TBD1
27 Thursday, April 16, 2026 Paper & Group TBD
28 Tuesday, April 21, 2026 Paper & Group TBD
29 Thursday, April 23, 2026 Final project presentations
30 Tuesday, April 28, 2026 Final project presentations

Assessment and grading

Paper Presentation – 40.0%

Objective: To enhance students’ ability to communicate complex AI concepts and engage in public speaking.

Expectations:

Assessment Criteria:

Final Project - 60%

(proposal + milestones + report + presentation)

The final project is the main deliverable and should include a reproducible baseline and a constraint-aware extension.

Objective: To design, implement, and evaluate a constraint-aware generative system that is technically sound, empirically validated, and reproducible.

Expectations:

Assessment Criteria:


Course policies (summary)

Collaboration: Discussion is encouraged. Submitted work must be written independently unless an assignment explicitly permits collaboration.

Late policy: TBA

Academic integrity: TBA

Accessibility: TBA

Use of generative AI tools: Permitted for brainstorming, debugging, and editing with attribution, unless a specific assignment forbids it. Students are responsible for correctness and for documenting tool use.