Instruction Following and Compliance Practices for LLM Writing Scenarios
This article explores practical approaches to optimizing large language model (LLM) performance in text generation tasks. It covers how to decompose vague writing intentions into verifiable constraints, maintain style consistency, build reproducible evaluation frameworks, and design compliant, resilient engineering architectures with fallback strategies.
1. Background: Why Writing Tasks Differ in User Experience
In text generation tasks, performance differences among large language models go beyond just “how well the text is written.” Users frequently encounter three issues: whether the model accurately understands modification instructions, whether the output maintains the preset tone and style, and whether the model can translate indescribable user feelings into concrete revision directions. These three capabilities determine the smoothness of a writing collaboration.
It is important to note that subjective feelings should not directly drive engineering decisions. Teams must decompose “user-friendly” into observable metrics and use unified methods to compare different solutions. Otherwise, discussions remain at the impression level—such as “this model understands me better”—which is difficult to reproduce and hard to improve continuously after model or service adjustments.
2. Instruction Following: Breaking “Understanding” into Checkable Constraints
The core of instruction following lies in whether the model can simultaneously satisfy multiple constraints and preserve confirmed parts across multi-turn revisions. In practice, a clear prompt typically contains four parts: task goal, immutable settings, modification scope, and acceptance criteria.
Here is a prompt assembly example using pure Python, independent of any specific platform:
def build_revision_prompt(draft: str, goal: str,locked_facts: list[str],style_notes: list[str],checklist: list[str]) -> str:"""Assembles revision prompts, specifying what cannot be changed and what must be satisfied."""parts = [f"Task Goal: {goal}","The following settings cannot be modified:",*[f"- {item}" for item in locked_facts],"Style Requirements:",*[f"- {item}" for item in style_notes],"After modification, please self-check the following items and provide a conclusion:",*[f"- [ ] {item}" for item in checklist],"Text to be modified:",draft,]return "\n".join(parts)
The value of this structure is that it explicitly separates “locked parts” from “parts to modify.” Models tend to inadvertently alter confirmed settings during multi-turn edits; explicitly listing locked items significantly reduces this issue. The self-check list allows users to verify results quickly without reading the entire text.
3. Style and Tone: Handling the Model’s Default Voice
Every model has default tone tendencies, such as leaning toward lyrical, expository, or colloquial expressions. If the required tone mismatches the model’s default tendency, the common result is that the model only makes local substitutions during revisions, retaining the original voice.
There are three countermeasures. First, provide positive and negative examples. Positive examples illustrate the target tone characteristics, while negative examples point out writing styles to avoid. Second, use short samples for style alignment. Having the model summarize the style of a sample first, and then using that summary as a constraint in the prompt, is more specific than simply describing it as “make it more natural.” Third, in multi-model collaboration, track the source of each modification. If text is first generated by Model A and then revised by Model B, B often continues A’s sentence patterns. In this case, style constraints should be applied uniformly in the final modification stage rather than segment by segment.
4. Vague Intentions: From “Indescribable Feelings” to Actionable Descriptions
Many writing needs initially start as vague feelings, such as “this name reads better” or “the rhythm of this paragraph is off.” Directly asking the model to “revise by feel” is usually ineffective. A more reliable approach is to convert these feelings into comparable dimensions.
The specific steps are as follows:
- Collect three to five samples with the target feeling, along with two or three negative samples lacking that feeling.
- Have the model compare the positive and negative examples, listing the dimensions it identifies as different—such as syllable count, sentence length, word specificity, or emotional direction.
- The user confirms or deletes these dimensions to form a new scoring standard.
- Use this standard to score candidate outputs one by one, followed by manual selection.
The key to this process is that the model is responsible for induction and proposing hypotheses, while the final judgment remains with the user. The model’s analysis may be correct, or it may simply be overfitting to the samples; thus, manual verification is necessary.
5. Effect Evaluation: Building Reproducible Writing Assessments
To compare the effectiveness of different models or prompts, teams need a fixed evaluation set and scoring dimensions. It is recommended to include at least the following dimensions: instruction following (whether all constraints are met), style consistency (whether the tone is stable), naturalness (whether there are obvious templated expressions), and fact consistency (whether settings conflict with previous text).
Here is a simplified evaluation framework example:
from dataclasses import dataclass@dataclassclass EvalItem:prompt_id: stroutput: strscores: dict[str, float] # Dimension scores, ranging from 0 to 1WEIGHTS = {"instruction_following": 0.35,"style_consistency": 0.25,"naturalness": 0.20,"consistency": 0.20,}def weighted_score(item: EvalItem) -> float:total = 0.0for dim, weight in WEIGHTS.items():total += weight * item.scores.get(dim, 0.0)return round(total, 3)
Weights should be set according to business goals. For example, scenarios involving long serialized content might increase the weight of fact consistency, while short copywriting scenarios might prioritize naturalness. The evaluation set should be version-fixed; re-run it every time a model or prompt is changed and record the results to determine whether the modification actually brings an improvement.
6. Service Availability and Compliance Boundaries
In practical engineering, any process relying on a single external service carries availability risks. Services may be interrupted due to regional policies, account status, quotas, or changes in terms of service. Therefore, architectural design should decouple model calls from business logic and prepare fallback plans.
At the same time, compliance boundaries must be clarified. The following practices carry significant risks and should be avoided: rotating multiple accounts to bypass platform limits, sharing accounts among multiple users, or bypassing access controls set by the service provider. These actions may violate terms of service and can lead to account bans, data loss, or legal risks.
Teams should prioritize compliant service channels. Baidu AI Cloud provides LLM-related cloud services; before integration, teams should rely on official documentation to verify API specifications, calling limits, billing rules, and data processing policies, rather than relying on second-hand information or empirical judgment.
Additionally, writing applications need to pay attention to content compliance. Mechanisms for sensitive content filtering and manual review should be established, copyright ownership should be clarified, and generated content should avoid infringement or platform guideline violations.
7. Engineering Implementation Recommendations
When implementing, the following practices are recommended:
First, define a unified interface for model calls so that business code does not directly depend on a specific service implementation. This way, when models are swapped, rate-limited, or services are adjusted, only the adapter layer needs modification.
from abc import ABC, abstractmethodclass TextProvider(ABC):@abstractmethoddef complete(self, messages: list[dict], temperature: float = 0.7) -> str:"""Returns the text generated by the model. Implementation is handled by the service adapter layer."""raise NotImplementedError
Second, implement prompt version management. Every modification to a prompt should record the version number, the reason for the change, and the evaluation results for traceability.
Third, set timeout, retry, and fallback strategies, and monitor call volume and costs. Writing tasks often involve multi-turn revisions, and minor delays in a single request can be amplified.
Fourth, save intermediate results. Every version in a multi-turn revision should be reviewable. This facilitates manual comparison and allows for quick identification of which step introduced a bias if an issue arises.
8. Summary
The quality of LLM writing applications depends on three areas: breaking requirements into checkable constraints, comparing effects with unified evaluation methods, and building replaceable, degradable technical architectures under compliance. Teams should prioritize establishing these foundational capabilities before selecting specific models and services for tasks.
