230
Constraint spec
lines of specification
platform · 2025 · client unnamed
Conflict-free timetable generation across grades, sections, teachers and subjects, using a language model constrained by a hard specification and checked by real code.
230
Constraint spec
lines of specification
49
Route declarations
Independent
Validation
generator output is not trusted
The problem
Building a school timetable by hand takes days and still produces conflicts: a teacher double-booked across sections, a subject scheduled with no available teacher. The constraint set is small to state and painful to satisfy.
The approach
Treated the prompt as a specification rather than a request. It states the hard constraint, then immediately states what is deliberately not a conflict, because a model told no two classes at once over-generalises into no subject twice at once and produces unusable sparse timetables. It teaches by counterexample and specifies an algorithm rather than an outcome. Generated output is then validated against the constraint set by ordinary code before being accepted.
Architecture
Constraint specification, batched generation with staged temperature, three-layer response parser, independent conflict validator, retry with feedback. The validator is deliberately separate from the generator.
Each with what it cost
A decision without a stated tradeoff is a preference.
01
Why
A model producing well-formed, confident, conflicting output is the expected failure mode, not an edge case. Conflict detection runs as ordinary code against the result.
What it costs
The constraint logic exists twice, once as specification and once as code, duplication that buys the ability to reject a wrong answer.
02
Why
The first attempt runs near-deterministic. Retries widen slightly, because a strictly deterministic retry reproduces the same conflict.
What it costs
Later attempts are less predictable, which the validator absorbs.
Outcome
A term timetable generates in minutes, with teacher conflicts rejected programmatically rather than discovered in the first week of term.