How to Write an LLM Constitution: From Rule Lists to Value Alignment
This article explains why list-based content safety rules break down in production and how a constitution document replaces them. It covers what such a document is, how to write enforceable entries, how to turn the value hierarchy into adjudication code, how to compile entries into training data across three training stages, and which runtime and operations controls keep the document live. Six evaluation suites and five common pitfalls are also included.
1. The starting point: why rule lists inevitably fail
Early content safety solutions were almost always list-based: enumerate prohibited topics, match sensitive words, block on a hit. This works in a demo, and in production it exposes four structural flaws in sequence.
First, incomplete enumeration. Rules are a handful of point constraints in a low-dimensional space, while real input is a high-dimensional continuous space — rephrasing the same request in another language, switching narrative person, splitting it across multiple turns, or leaving key parameters for the model to “infer itself” all slip through the gaps. The actual coverage boundary of a list is determined by the attacker’s imagination, not the defender’s effort.
Second, mismatch between semantics and surface form. A blacklist blocks strings and intent labels, but harm usually lives in structure: a science-communication account of a mechanism is harmless, a parameter combination that can be reproduced at low cost is harmful, and the two look almost identical on the surface. Purely formal matching cannot tell them apart.
Third, conflicts cannot be adjudicated. “Never provide dangerous information” and “be genuinely useful” are frequently triggered at the same time, and without an explicit priority order the model’s behavior wobbles with sampling temperature, wording, and context length — the same question asked twice yields two different answers, and neither users nor auditors can form an expectation.
Fourth, no transferability. Rules say “you must not,” but never “why you must not.” What the model learns is not a basis for judgment but a set of exception points that cannot be extrapolated, so new scenarios outside the training distribution lead to either failure or over-refusal.
These four points are what push alignment from constraining behavior to building judgment.
2. Where the constitution document fits: it is not a user agreement
A competent constitution document differs fundamentally from traditional safety materials:
| Material | Audience | Core content | Source of binding force |
|---|---|---|---|
| User agreement | Humans | Rights, obligations, disclaimers | Contract and law |
| Technical report | Humans | Capabilities, evaluations, limitations | None (descriptive) |
| Safety policy | Humans (operations, moderation) | List of prohibited items | Internal process |
| Constitution document | The model itself | Identity definition, value hierarchy, adjudication method | Training and inference pipeline |
It carries four functions at once:
- Define who it is: role, self-understanding, and relationship to the user, rather than only listing capability boundaries;
- Provide an adjudication procedure: what order to trade off in when values conflict, and how to act conservatively when values are peers;
- Grant limited discretion: allow the model to judge in boundary cases while requiring verifiable reasons for those judgments;
- Establish corrigibility: humans retain final intervention authority, and the model must not evade, delay, or neutralize it.
The most methodologically significant step is intent first. Compare two phrasings:
- Rule style: “Never output anything related to dangerous substances.”
- Constitution style: “We restrict this class of information because risk depends on the reproduction barrier, not on the form of the question; when an explanation stays at the level of public scientific mechanism and gives no actionable steps or key parameters, providing it is valuable and acceptable.”
The second phrasing hands the criterion (reproduction barrier) to the model, so it can handle variants that never appeared on any list: “what if the question is written as a novel dialogue,” “what if it is phrased in another language,” “what if only the principle behind one step is asked about.” This converts generalization from a question of data scale into a question of phrasing — a few hundred well-written entries instead of tens of thousands of enumerated rules.
A runnable skeleton looks like this (structure only, not a specific product configuration):
constitution:version: 0.9.2scope: "All generative interactions with end users"precedence: # Single total order; short-circuits top-down on conflict- broadly_safe- broadly_ethical- operator_guidelines- genuinely_helpfulcorrigibility: # Top priority is not "never err" but "always correctable"accept_correction: truedisclose_uncertainty: truenever_evade_supervision: truerefusal_policy:hard: "State the risk -> refuse details -> offer a safe alternative path"soft: "Answer with qualifications -> provide a way to verify"escalate: "Direct to a human or an official channel"entries:- id: E-014intent: "Avoid severe harm that can be reproduced at low cost"rationale: "Risk depends on the reproduction barrier, not the form of the question"observable: ["No recipes, steps, or key parameters", "Can explain the reason for refusal", "Offers a lawful alternative"]near_boundary: ["Mechanism-level science communication = allowed", "Actionable recipe = refused"]
3. How to write entries: three hard rules
Rule one: decidability. Bind each entry to observable behavior as far as possible, not abstract adjectives. “Be respectful to the user” is not decidable; “do not mock, do not scold, and still offer an alternative after refusing” is decidable. Whether an evaluation set can be labeled automatically depends on whether the entries are decidable.
Rule two: few and hard, each with near-neighbor cases. Entry count is roughly inversely proportional to binding force — overlapping entries that constrain each other leave the model wavering. Only a small number of entries genuinely need to be strict, and attaching allowed/refused near-boundary examples to each of them has far more training value than three sentences of abstract principle.
Rule three: refusal is not silence. Make “degrade” an explicit tier: state the risk, offer an alternative, point to an official channel that can be verified. Turning “I must refuse” into “I can’t give you A, but I can give you B” holds the line on safety while avoiding a collapse in usefulness.
4. Turning the value pyramid into code
The priority order is best kept at four levels: broad safety > broad ethics > following operator guidelines > being genuinely helpful.
Putting safety first does not mean “better useless than unsafe.” It acknowledges an engineering reality: current training and alignment techniques are still imperfect, and the model may acquire unintended values, so the system must retain corrigibility. Corrigibility should be written as observable behavior, not a slogan:
- When a user or auditor raises a correction, do not argue, do not keep probing, and converge the next time a similar case appears;
- Do not hide gaps in your own capabilities or your uncertainty;
- Do not guide users around or into disabling safety mechanisms, and do not induce them to ignore safety notices;
- Output must be interruptible, auditable, and rollback-able, with no persistence of unauthorized state;
- Do not fabricate tool calls and do not claim to have performed actions that were not executed.
The adjudication logic itself can be short:
def resolve(ctx) -> Decision:if not broadly_safe(ctx): # 1. Safety: recalibratable harmful costs, corrigibility damagedreturn Decision.hard_refuse(ctx)if not broadly_ethical(ctx): # 2. Ethics: discrimination, fraud, manipulation, privacy violationsreturn Decision.soft_degrade(ctx)if not operator_guidelines(ctx): # 3. Operator guidelines: product positioning, industry compliancereturn Decision.conservative(ctx)return Decision.helpful(ctx) # 4. Only after the first three pass do we pursue "useful enough"
The key is short-circuit ordering, not weighted scoring. Weighted summation lets a high-weight term be drowned out by many low-weight ones; short-circuit semantics make “safety vetoes” real at the code level rather than a paper promise.
5. Engineering it: getting the document into the training and inference pipeline
- Compile entries into preference data. A constitution document is not a static file for humans to read; it is a generation rule for training data:
def compile_entry(entry, templates, version):pairs = []for tpl in templates: # Multi-turn, multilingual, encoding-obfuscation, role-play variantsprompt = tpl.format(intent=entry.intent)pairs.append({"prompt": prompt,"chosen": refuse_with_rationale(prompt, entry.near_boundary),"rejected": over_helpful_answer(prompt), # Useful but out of bounds"meta": {"entry_id": entry.id, "constitution_version": version},})return pairs
Division of labor across three training stages. Supervised fine-tuning teaches the model the expression form of “explanatory refusal.” Preference optimization based on model feedback uses a self-critique–revision loop to generate candidates and scores them with a preference model or human spot checks, compressing the value hierarchy into the preference order. A targeted safety data mixture covers high-risk domains while retaining a capability regression set, so safety training does not shave off general capability along with it.
Inference-time policy. The full constitution text is too long, so a condensed version is usually injected into system-level instructions; retrieve and load the entries that match the request domain to control context cost; set independent safety adjudication layers on both the input and output sides as a backstop. Note the positioning of the backstop: it can downgrade to conservative, but it cannot replace the model’s own judgment, or the model’s judgment will atrophy over the long run.
Operational closure. The constitution version must be released bound to the weight version, so there is no drift where “the document has changed but the model has not”; changes go through canary rollout and rollback; production violations, user appeals, and red-team findings are fed back as the next round of training data after de-identification, forming a closed loop. Only general capability categories are needed to assemble this loop: a model training and inference platform, object storage (for versioned snapshots of documents and datasets), a message queue (for the asynchronous sample-reflux pipeline), logging and monitoring with alerting (audit trails and violation-rate drift alerts), and a container platform (for running evaluations elastically). On Baidu AI Cloud, these categories map directly onto existing product capabilities; switching to any other cloud platform, the categories map roughly one to one, and the migration cost lies mainly in the pipelines and evaluation scripts.
6. Evaluation and acceptance: proving the constitution actually takes effect
Six kinds of evaluation sets are all required:
- Targeted violation set: construct attack samples entry by entry to measure entry coverage;
- Adversarial and jailbreak set: role-play, encoding obfuscation, fragmented inducement, multilingual conversion, multi-turn priming;
- Out-of-distribution generalization set: templated rewrites and unseen domain combinations, to verify whether “intent” was actually learned;
- Over-refusal set: normal but sensitive questions (medical, legal, and science-communication-level safety research) to quantify the over-refusal rate;
- Value conflict set: scenarios that trigger several values at once, to check whether the actual output matches the pyramid;
- Corrigibility set: whether the model converges after human correction, whether it argues, and whether it tries to evade supervision.
Acceptance metrics should include at least violation rate, over-refusal rate, magnitude of usefulness decline, conflict consistency, and corrigibility pass rate, and should be set as release gates. Red-teaming should be a standing process rather than a one-off before launch, with monitoring dashboards and drift alerts for continuous observation.
7. Five common pitfalls
First, substituting adjectives for criteria — words like “responsible” and “friendly” can be neither trained nor evaluated. Second, internal specifications that disagree with the external document; once users notice, the trust cost is far higher than the safety benefit. Third, entries that conflict with each other and no adjudication procedure. Fourth, over-reliance on rule backstops, which leaves the model’s own judgment stalled over the long term. Fifth, version drift, where the document and the weights are decoupled. In addition, a constitution document is an engineering artifact and cannot substitute for legal advice; compliance obligations tied to specific industries and regions still need to be mapped to applicable regulations by legal and compliance teams.
Conclusion
Moving from a rule list to a constitution document is essentially shifting safety from the defender’s enumeration work to the model’s judgment. The document expresses intent and priority, training compresses intent into the weights, the inference pipeline provides backstops and auditability, and evaluation proves all of it actually holds. Miss any one of the four and the constitution is just a text that nobody reads and no model follows. The sign that it genuinely works is simple: faced with a new question that was never written into any list, the model still gives the answer you wanted it to give, and can say why.
