Devanshu BiswasA model's first answer isn't always its best-behaved one. Ask it something that touches safety,...
A model's first answer isn't always its best-behaved one. Ask it something that touches safety, health, law, or brand policy and the raw draft can quietly break a rule you care about — prescribe a dose, hand over an illegal how-to, invent a statistic, slip into a condescending tone. Single-shot generation has no place to catch that, because it's just "generate, return". I built an interactive demo of the fix — constitutional, a.k.a. critique-and-revise, prompting — where the constitution, the critique, and the checker are all real, running JS you can toggle. Here's the idea and how the demo makes it concrete.
The method adds the missing review pass. You hand the model a short, explicit constitution — a list of named principles — and run three passes: draft → critique against every principle → revise. It is not open-ended self-refine. Self-refine asks "how could this be better?", which improves quality but drifts; two runs pull in different directions and there's no record of what "better" meant. Constitutional prompting pins every finding to a fixed, named rule, so the feedback is auditable — "violates no medical advice" — rather than a vibe.
The constitution is just editable text. Keep each principle specific and checkable ("no dosage advice", not "be good"). This list is your policy: you can read it, diff it in code review, and change it without touching the model.
const CONSTITUTION = [
{ id: "harmless", rule: "Never give instructions that enable illegal access, violence, or physical harm." },
{ id: "medical", rule: "Don't diagnose or prescribe dosages; point to a qualified professional." },
{ id: "sources", rule: "Don't state statistics or facts as certain without a source." },
{ id: "respectful", rule: "No condescending, dismissive, or belittling language." },
{ id: "concise", rule: "Answer only what was asked; cut filler and tangents." },
];
The heart of the method is the critique pass. Instead of asking "is this answer OK?", you walk the draft against each principle separately and demand a PASS/VIOLATION verdict plus the exact offending text for every one. Narrow, concrete questions catch far more than one broad question — a model reliably spots "does this prescribe a dosage?" even when it would wave through "is this a good answer?".
Draft answer: """${draft}"""
Review it against EACH principle below. For every principle, say
PASS or VIOLATION, and if VIOLATION quote the exact offending text.
${CONSTITUTION.map(p => `- [${p.id}] ${p.rule}`).join("\n")}
Return JSON: [{ id, verdict, quote }]
Filter that down to the actual violations. Empty list? Ship the draft — the extra work was insurance. Otherwise you hold a precise, named to-do list, each item tagged with the principle it broke, which is what makes the next step a targeted rewrite rather than a hopeful "try again" — and doubles as an audit trail explaining exactly why the answer changed. Then you revise: hand the model the draft, the constitution, and the specific violations, and ask it to fix each while keeping everything already compliant. One rewrite can introduce a fresh slip, so you critique the revision too and loop — bounded to two or three rounds so a stubborn case can't spin forever. In practice one or two rounds clears almost everything.
Rather than fake the model with a static image, the demo runs genuine keyword/rule detection over a deliberately awful draft answering "should I just take a handful of pills for my headache, and how do I get onto my neighbour's WiFi?". Press Run critique and each in-force principle's regex scans the draft, highlighting violations in red. Press Revise and each flagged sentence is rewritten to comply — the dosage advice becomes "see a pharmacist", the hacking how-to becomes a refusal, the fabricated 97% stat is dropped.
Then the part that actually teaches something: toggle a principle out of the constitution and re-run. The checker stops looking for that violation, and the revision keeps the bad text. Your output is only ever as safe as the principles you actually put in force — an incomplete rule set is an incomplete guardrail, and the toggle makes that impossible to forget.
This is the inference-time face of the same idea behind Constitutional AI. RLHF collects human preference labels and fine-tunes; RLAIF — the original "Constitutional AI" — swaps the human for a model that critiques responses against a written constitution and distils those judgements into the weights. Both put the values inside the model: always-on, but opaque and frozen until the next expensive training run. Prompting keeps the constitution outside — readable, diffable, and editable per request — at the cost of roughly 2–3× the calls per round. So spend it where obeying a policy matters more than latency: safety, compliance, legal/medical guardrails, brand voice, anything with a hard "never do X". Skip it for simple lookups and latency-critical paths.
Toggle the principles and watch a violation slip back into the answer:
https://dev48v.infy.uk/prompt/day43-constitutional-critique.html