LLM Evaluation: Testing Negative Constraints and Logical Reasoning
Effective LLM evaluation requires more than judging whether an answer sounds natural. This article explains how to test prohibited content and formatting constraints, validate logical reasoning through state transitions, and assess business writing for accuracy and usability. It also outlines scoring methods and evaluation governance practices that support reproducible testing, regression analysis, and risk management.
As large language models enter enterprise production workflows, evaluation must move beyond subjective judgments about whether an answer “sounds human.” It should become a reproducible, explainable engineering process that supports regression testing.
Accurate information is essential to decision-making: errors at the source can amplify operational and management risks. Similarly, fluent model outputs can create hidden business costs if they violate constraints or fail to perform verifiable reasoning. Evaluation therefore needs to cover three dimensions: compliance with hard requirements, reasoning correctness, and usable communication.
1. Negative Constraint Testing: From Fluent Output to Reliable Compliance
Negative constraint testing places explicit prohibitions and strict formatting requirements in a prompt, then checks whether the model follows them consistently within the available output space.
This approach often reflects enterprise requirements more closely than open-ended question answering. Business tasks frequently combine length limits, paragraph counts, prohibited terminology, tone requirements, and factual boundaries.
Common constraints include:
- Do not use specified prohibited terms.
- Produce an exact number of paragraphs.
- Keep each paragraph within a defined length range.
- Do not invent facts that were not provided.
- Avoid exaggerated promises.
- Preserve the required output format.
Evaluation should not stop at detecting prohibited terms. It must also check whether the output can be parsed, whether paragraphs are complete, and whether length deviations fall within the permitted tolerance.
A practical test case can be represented as follows:
case_id: neg_format_001prompt: Explain the value of accurate information for decision-making in three paragraphs of approximately 40 characters each. Do not use the specified prohibited terms or invent data.constraints:forbidden_terms: [...]paragraph_count: 3chars_per_paragraph: 40tolerance: 0format: plain_text
A validator can use the following pseudocode:
function check_negative(output, case):violations = []for term in case.forbidden_terms:if contains(output, term):violations.append("forbidden:" + term)paragraphs = split_non_empty_lines(output)if length(paragraphs) != case.paragraph_count:violations.append("paragraph_count")for p in paragraphs:if abs(char_count(p) - case.chars_per_paragraph) > case.tolerance:violations.append("char_count")return {passed: length(violations) == 0, violations: violations}
Scoring should combine automatic failure for critical violations, violation-type statistics, and human review. A prohibited-term match, an unparseable format, or an incorrect paragraph count should constitute a hard failure. Minor length deviations can be graded according to business tolerance, while naturalness and professionalism are better assessed through blind human review.
The example configuration uses zero tolerance, so its length requirement is effectively exact despite the prompt’s use of “approximately.” Evaluation specifications should make that distinction clear.
Negative constraint testing should not consist of repeatedly running a single prompt. Combine different constraints, output lengths, and tones, then measure pass rates and violation distributions. This reduces the risk of a model passing by chance because the prompt pattern is too narrow.
2. Logical Reasoning Tests: Validate State Transitions, Not Just Answers
Reasoning evaluations should favor tasks whose answers can be verified and whose intermediate steps can be checked.
The classic river-crossing puzzle is a useful example. A boat carries one person and, at most, one item at a time. A wolf cannot be left with a goat without the person present, and the goat cannot be left with a cabbage. The goal is to move everyone and everything safely to the opposite bank.
The value of this task lies not in the puzzle itself, but in its requirement for a complete sequence of steps, each of which can be validated against explicit rules.
Evaluation should check more than whether the final answer claims that everything reaches the other bank. It should verify:
- Whether every action is legal.
- Whether every intermediate state is safe.
- Whether the sequence contains unnecessary return trips.
- Whether the explanation matches the listed steps.
A state-machine validator can define the initial state, target state, legal actions, and conflict rules. It then executes the model’s proposed actions one at a time. Any illegal action or unsafe state causes a failure; after all actions have been applied, the validator checks whether the target state has been reached.
function validate_crossing(steps, start_state, goal_state, conflict_rules):state = start_statefor step in steps:if not legal_action(state, step):return false, "Illegal action"state = apply(state, step)if has_conflict(state, conflict_rules):return false, "Conflicting state"return state == goal_state, "Completed"
This approach can be extended to tasks involving changing capacity, multiple conflict pairs, irreversible actions, hidden conditions, or counterfactual questions.
Scoring dimensions can include step completeness, action legality, safety, minimum step count, and explanation clarity. For enterprise applications, the central question is whether the model maintains consistent state across a long sequence—not merely whether it produces a plausible-looking conclusion.
3. Business Writing and Information Quality: Beyond Correct Templates
Business documents often impose requirements on paragraph count, paragraph length, professional tone, and logical structure. For example, a task might request three paragraphs addressing decision-making, efficiency, and trust, respectively, with approximately 40 characters per paragraph.
Evaluation should examine whether the output:
- Presents accurate information.
- Provides a complete structure.
- Uses terminology correctly.
- Avoids empty language and formulaic filler.
- Meets mandatory length and formatting requirements.
- Provides judgments that can inform action.
A businesslike tone is not enough. Low information density or unverifiable conclusions should still reduce the score.
A useful scorecard separates four assessment dimensions:
- Hard-constraint compliance: Does the output meet all mandatory requirements?
- Factual and logical reliability: Are its claims supported and its reasoning sound?
- Structural clarity: Is the information organized coherently?
- Professional, measured language: Is the wording precise and appropriately restrained?
For requirements such as “40 characters per paragraph,” define the counting convention and tolerance explicitly. In Chinese-language tasks, this means specifying how Chinese characters are counted so that automated validation and human review apply the same rules. Character counts should not be silently treated as word counts when localizing or adapting a test.
For factual boundaries such as “do not invent data,” verify the output strictly against the supplied reference material. The model must not add data that the material does not provide.
4. Evaluation Governance and Implementation
Reliable evaluation requires more than individual test cases. It also needs a process for organizing evidence, reviewing results, and tracking changes.
Build separate evaluation sets
Manage negative constraint tests, logical reasoning tasks, business writing tasks, and fact-checking tasks separately. A single aggregate score can obscure important differences in risk.
Use blind evaluation and independent review
Blind scoring and review by two evaluators help reduce brand preference and subjective impressions.
Preserve outputs and assessment records
Retain raw model outputs, validation results, and human scores. These records support regression testing across model versions and make failures easier to investigate.
Combine offline evaluation with production sampling
Use offline test suites alongside sampled reviews of production outputs. Pay particular attention to prohibited-term matches, formatting failures, state conflicts, and factual deviations.
Keep conclusions within the scope of the evidence
Describe results as performance “under the specified test set and scoring rules.” Avoid generalizing beyond what the evaluation actually measures.
Conclusion
Professional LLM evaluation is not simply a contest to determine which model appears “smarter.” It translates business requirements, reasoning processes, and communication quality into verifiable criteria.
Negative constraint testing checks compliance with non-negotiable requirements. Logical reasoning validation checks the correctness of intermediate steps. Business writing evaluation examines information density and practical usefulness.
Bringing these dimensions into a unified evaluation process helps ensure that model outputs support decisions, improve efficiency, and reduce operational risk.
