Plan-and-Write: Controlling Text Length Through Explicit Word Counting
TL;DR
Plan-and-Write is a prompting technique for precise control over text length. It works in two stages within a single prompt: first the model generates a draft, numbering every word (1:first 2:second 3:third...), then it reformats the draft into coherent text of the required length.
LLMs are bad at counting words "in their heads." Ask for 100 words and you get 80 one time, 150 the next. The model doesn't track how much it has already written. Short texts suffer most: instead of 20 words you can easily get 40. The reason: an abstract constraint ("write 100 words") doesn't create any tracking mechanism.
The method turns the abstract limit into an explicit counter. Numbering the words makes the model see its progress: "I'm at 47, 53 to go." The second stage is a clean copy without numbers. The result: accuracy improvements of up to 37.6% for several models, especially on texts under 500 words.
Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.
Method Blueprint
STEP 1 (in one prompt): Planning → draft with numbered words
"1:Amazon 2:reported 3:its 4:quarterly..."
STEP 2 (in the same prompt): Verification → clean text between <answer> tags
Exactly N words, coherent prose
Both steps run in a single request: the model moves from the draft to the final text on its own.
Example in Practice
Task: You're a social media manager. You need to write a LinkedIn post about the company's quarterly results. The brief: exactly 50 words, no more, no less, to fit the page's format.
Prompt:
You are a copywriter. Your task: write a text with precise length control.
Follow this process:
STEP 1: PLANNING
- Number every word in your draft
- Format: "1:word 2:word 3:word..." until you reach the target
- Target: EXACTLY 50 words
STEP 2: FINAL TEXT
- Write the text between <answer></answer> tags
- Exactly 50 words, coherent prose without numbers
Write a LinkedIn post about our Q3 results: revenue +15%, launched a new product, hired 20 people.
Result:
The model first shows the numbered draft (1:In 2:the 3:third...), then outputs clean text between the <answer> tags. The text will be exactly 50 words; you can check it with any word counter.
Why It Works
LLM weakness: Models can't count "on the fly." When you write, you don't think about word count every second, and neither does the model. The instruction "write 100 words" stays abstract; the model doesn't check against it during generation.
LLM strength: Models are great at following step-by-step instructions and formatting output. Give them an explicit structure and they'll execute it.
How the method connects the two: Numbering the words turns the abstract limit into a procedural task. The model sees its progress: 45:almost 46:done 47:remaining.... It's like using a ruler instead of eyeballing it. The second stage removes the cognitive load: no more counting, just reformatting.
Control knobs:
- Target word count: adjust to the task (20 to 500 works best)
- Output format: drop the
<answer>tags if you want to see the whole process - Splitting the stages: for very precise control, split into two separate requests
Prompt Template
You are a {role}. Your task: {task_type} with precise length control.
Follow this process:
STEP 1: PLANNING
- Number every word in your draft
- Format: "1:word 2:word 3:word..." until you reach the target
- Target: EXACTLY {word_count} words
STEP 2: FINAL TEXT
- Write the text between <answer></answer> tags
- Exactly {word_count} words, coherent prose without numbers
{task_and_context}
Placeholders:
{role}: who is writing (copywriter, analyst, editor){task_type}: what we're doing (write a summary, shorten a text, retell){word_count}: target length (20-500 works best){task_and_context}: the specific assignment and source material
Limitations
⚠️ Not for every task: The method works for compressing information (summaries, retellings, rewrites). For creative generation (stories, fiction), vanilla prompts work better, in 5 out of 6 models.
⚠️ Not for long texts: Beyond 500 words, accuracy drops for every method. For 1000+ word texts the improvement is minimal.
⚠️ Model-dependent: Llama 3.1 70B already controls length well without the method. Claude 3.7 Sonnet and Claude 3.5 show the biggest gains. Mistral Large barely improves.
⚠️ More tokens: The numbered draft increases token usage by roughly 50-60% and adds generation time.
How They Tested It
An Amazon Web Services team tested the method on 6 models (Claude 3/3.5/3.7, Llama 3.1 70B, Mistral Large) and 8 target lengths (from 20 to 5000 words). The task: summarizing a real document (Amazon's 2023 shareholder letter). Each model-length combination was run 5 times, for 960 generations in total.
They compared 4 prompt variants: two vanilla ("write X words") and two with counting (Plan-and-Write). They measured MAPD, the percentage deviation from the target length. Best result: Claude 3.7 Sonnet cut the deviation from 14.1% to 8.8% (a 37.6% improvement).
The surprise: the method doesn't work for stories. In a separate story-generation experiment, vanilla prompts won in 5 of 6 models. Takeaway: explicit counting helps compress information but gets in the way of creating new content; apparently the numbering breaks the creative flow.
Text quality was checked with LLM-as-a-Judge on 4 criteria. Plan-and-Write not only didn't hurt quality, it actually improved completeness (0.85 vs 0.81) and relevance (0.87 vs 0.71) compared with vanilla.
Original Prompts from the Paper
Thinking V1 (main prompt):
You are a document analyst. Your task is to summarize documents while precisely controlling output length.
Follow this exact process:
STEP 1: PLANNING (HIDDEN)
- Count every word you write by numbering them
- Plan content to hit EXACTLY [TARGET] words
- Format: "1:word 2:word 3:word..." until you reach the target
STEP 2: FINAL OUTPUT
- Write ONLY the summary between <answer> tags
- Must be EXACTLY [TARGET] words
- Natural, flowing prose only
Remember: The numbered planning is for your accuracy. Only content between <answer> tags will be evaluated.
Summarize the following document in EXACTLY [TARGET] words:
[DOCUMENT]
Thinking V2 (academic phrasing):
You are a document analyst with expertise in precise language generation. Your task is to summarize the given document while adhering to strict length constraints.
OBJECTIVE: Create a summary of EXACTLY [TARGET] words
METHODOLOGY:
Phase 1 - Word Count Planning
First, you will create a draft where each word is numbered sequentially. This creates an explicit counting mechanism that ensures accuracy. Format: "1:first 2:word 3:next..."
Phase 2 - Verification & Output
Convert your numbered draft into natural prose. Place your final answer within <answer></answer> tags.
CONSTRAINTS:
- Final output must contain EXACTLY [TARGET] words
- Maintain factual accuracy
- Preserve key information density
- Only content within <answer> tags counts
Begin analysis of the document below, targeting exactly [TARGET] words:
[DOCUMENT]
Context: The researchers tested both variants. V1 did best for Claude 3.5/3.7 Sonnet, V2 for Claude 3 Haiku. The wording difference is minimal, but it can matter for a specific model.
Adaptations and Extrapolations
💡 Adaptation for editing: trimming text to a limit
The method is perfect for "fit it into X words" tasks, a classic pain point for editors and copywriters.
You are an editor. Cut the text to EXACTLY 80 words while keeping the main idea.
STEP 1: PLANNING
Number the words: "1:word 2:word..." up to 80.
STEP 2: FINAL
Text between <answer></answer>, exactly 80 words.
Source text:
{paste_text_to_shorten}
🔧 Technique: drop the tags → see the process
If you want to understand how the model counts and where it slips, remove the instruction about the <answer> tags. You'll get the whole numbered draft and can debug it.
🔧 Technique: split into two requests → maximum accuracy
For critical tasks (legal documents, specs with a hard limit):
Request 1: "Write a draft, numbering every word. Target: 100 words."
Request 2: "Here's the draft. Remove the numbers and make it coherent text of exactly 100 words."
Splitting removes the cognitive load entirely: the model focuses on one task at a time.
Resources
Paper: Plan-and-Write: Structure-Guided Length Control for LLMs without Model Retraining (KDD Workshop on Prompt Optimization, 2025)
Authors: Adewale Akinfaderin, Shreyas Subramanian, Akarsha Sehwag, Amazon Web Services, Seattle
Related research:
- Yuan et al. (2024), Following length constraints in instructions: a length-control benchmark
- Dubois et al. (2024), Length-controlled AlpacaEval: on LLMs' bias toward verbosity