LLM-driven Constrained Copy Generation through Iterative Refinement

Varun Vasudevan, Faezeh Akhavizadegan, Abhinav Prakash, Yokila Arora, Jason Cho, Tanya Mendiratta, Sushant Kumar, Kannan AchanarXiv 2025

TL;DR

Researchers at Walmart Global Tech have developed an end-to-end LLM framework that automates e-commerce copywriting by mimicking the human editorial process. By combining automated generation with a multi-stage critique and refinement loop, the system successfully satisfies complex marketing constraints (like character limits and brand tone) simultaneously. When deployed in production, the framework boosted copy success rates by up to 35% and delivered a massive 38% to 45% lift in user click-through rates (CTR).

What Problem Does This Paper Address?

In e-commerce, digital banners need to change constantly to target different customer segments. While Large Language Models (LLMs) excel at generating creative text quickly, they notoriously struggle with constrained text generation.

Writing a marketing banner isn't just about being creative; the text must simultaneously satisfy a laundry list of strict business constraints:

  • Length limits (e.g., headers under 40 characters).
  • Keyword inclusion/exclusion (incorporating specific value propositions while avoiding off-brand words).
  • Brand tone (avoiding hyperbolic or exaggerated language).
  • Structural coherence (ensuring headers and subheaders flow logically together).

Standard LLMs often fail to hit all these marks on the first try. While prior research has explored iterative self-refinement, those studies typically focused on simple, isolated constraints (like just incorporating a keyword). This paper tackles the challenge of scaling copy generation under multiple, intricate, and competing industrial constraints.

Methods

The authors propose a modular, loop-based architecture consisting of four primary components:

  1. Generator: An LLM prompted with specific roles, contextual descriptions (like user cohort definitions), and a few in-context examples to generate a batch of initial copy candidates.
  2. Formatter: A rule-based component that parses the LLM's raw output into a structured JSON format and applies deterministic text cleanups (e.g., converting "and" to "&", stripping trailing punctuation).
  3. Evaluator Block: A sequential pipeline of specialized evaluators. Simple constraints like character length are checked using deterministic Python functions. Nuanced constraints—like tone of voice or coherence—are judged by an LLM using chain-of-thought (CoT) prompting.
  4. Refiner: If a copy candidate fails any evaluation step, the specific feedback is converted into an actionable instruction prompt. The same underlying LLM acts as the refiner, taking the failed copy and the critique to generate an updated version.

This loop repeats for a set number of attempts (typically 1 or 2). If the copy passes all evaluators, it moves to human-in-the-loop review; otherwise, it is discarded.

Figure 1: LLM-based end-to-end framework for scalable copy generation. It has three main blocks: a generator, an evaluator, and a refiner. The generated copy undergoes formatting and evaluation. If any evaluation fails, it is sent to the refiner for revision. This process continues until the copy passes all evaluations or the maximum number of refine attempts is reached. Once a copy passes all evaluations, it goes to human reviewers.

Datasets

Because this is an industrial application, the framework was evaluated on internal production data across three distinct marketing use cases at Walmart:

  • Campaign-A (Low Complexity): Single-topic generation consisting of just a header with a length constraint of 40–60 characters.
  • Campaign-B (Medium Complexity): Single-topic generation requiring both a header (30–40 chars) and a subheader (60–80 chars) that must be mutually coherent.
  • Campaign-C (High Complexity): Multi-topic, highly personalized generation targeting specific user personas (e.g., families, pet owners) with strict header/subheader constraints.

Key Insights and Ideas

  • The Character Count Struggle: Confirming prior academic findings, the authors noted that LLMs struggle heavily with fine-grained numerical constraints. In Campaign-B, over 72% of initial failures for free delivery copy were due to violating the short header length constraint.
  • Targeted Critique > Blind Self-Correction: Instead of just asking the LLM to "try again," providing explicit, structured feedback about why a piece of copy failed (e.g., identifying the exact hyperbolic word) makes the refinement step highly effective.
Figure 2: Example of iterative refinement. The generated copy in (1) is rejected by a tone of voice evaluator with feedback shown in (2). This feedback is used in the refine prompt in (3) to get the refined copy in (4). The tone of voice evaluator accepts the refined copy with feedback shown in (5). {tone} contains tone of voice keywords. {campaign_name} is the name for the campaign and {service_qualifier} is any specific attribute such as “free trial”.
  • The Reality of "Criteria Drift": The authors highlight a practical challenge in deploying evaluation systems: as human reviewers grade more LLM outputs, their own internal standards evolve, noticing new types of errors. This means automated evaluator blocks cannot remain static; they must continually evolve alongside human feedback.

Key Results

The framework was evaluated both offline for constraint satisfaction and online for business impact:

  • Higher Success Rates: Implementing the iterative refinement loop increased the copy success rate (the percentage of generated copies passing all constraints) by 16.25% to 35.91% across the three campaigns compared to a base LLM.
  • Ablation Performance: In a deep-dive study on persona targeting, the refinement loop successfully salvaged 46.72% of copy variants that initially failed the persona constraint.
  • Massive Business Impact: The system's outputs were tested in live production against human-curated copies using a Multi-Armed Bandit (MAB) framework. The LLM-refined winning variants achieved a 38.5% CTR increase for Campaign-A and a 45.21% CTR increase for Campaign-B.

Limitations and Future Work

While highly successful, the authors note a few practical hurdles:

  • Semantic Diversity: When generating large batches of copy ($N > 50$), LLMs tend to produce near-duplicates. The team had to introduce a secondary diverse subset selection algorithm to filter out repetitive options.
  • Evolving Constraints: Business requirements and brand guidelines change frequently, requiring ongoing prompt engineering and updates to the evaluator block to prevent the system from drifting out of alignment with corporate goals.

Summary updated

BibTeX
@misc{vasudevan2025llm,
  author = {Varun Vasudevan and Faezeh Akhavizadegan and Abhinav Prakash and Yokila Arora and Jason Cho and Tanya Mendiratta and Sushant Kumar and Kannan Achan},
  title = {{LLM-driven Constrained Copy Generation through Iterative Refinement}},
  year = {2025},
  eprint = {2504.10391},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.10391},
}
Figure