Directional Stimulus Prompting

La Lakshmi Priya Updated 06 Nov 2026
11 min read ·Lesson 57 of 80

What Is Directional Stimulus Prompting? Directional stimulus prompting adds a short, input-specific hint, called a stimulus, to the prompt to guide the model toward the desired output. The hint does not contain the answer; it points the model in the right direction.

The most common form of stimulus is a list of keywords that the output should include:

Summarize the article in 2 sentences.

Hint (keywords to include): classroom platform, 1 December, login email, 25 November

Article: ... The technique was introduced in the 2023 paper "Guiding Large Language Models via Directional Stimulus Prompting" by Li et al.

The Key Idea General instructions such as "Summarize the article" are the same for every input. A directional stimulus is different for each input: it tells the model what matters in this particular text.

Prompt Element Same for Every Input? Example Instruction Yes "Summarize in 2 sentences." Directional stimulus No "Hint: classroom platform, 1 December, login email" How the Original Method Works In the original research, the stimulus is produced by a separate, small model called the policy model (the authors used a T5 model). The setup works like this:

Input text ↓ Small policy model → generates a hint (for example, keywords) ↓ Large model (unchanged) receives: instruction + hint + input text ↓ Output guided by the hint How the Policy Model Learns Supervised fine-tuning: the small model is first trained on examples of inputs and good hints, such as keywords extracted from reference summaries. Reinforcement learning: the small model is then improved by rewarding hints that lead the large model to produce better outputs, as measured by an evaluation metric. Why This Design Is Interesting The large model is treated as a black box: it is not modified or fine-tuned. Only the small hint generator is trained, which is far cheaper. The researchers applied this to tasks such as summarization, where the hints were keywords, and dialogue response generation, where the hints were dialogue acts describing the intended type of reply.

Training a policy model is beyond the scope of everyday prompting. However, the core idea, generating an input-specific hint and including it in the prompt, can be applied without any training, as the rest of this lesson shows.

Why Hints Help They Focus Attention on What Matters Without guidance, a summary might focus on a detail the reader does not care about. Keywords state which facts must appear.

They Reduce Missing Information Summaries and responses often omit specific details such as dates, names, and amounts. Including them as keywords makes their omission less likely.

They Encode Requirements That Change Per Input A customer reply for a refund request should mention different things than a reply for a login problem. A hint can carry these per-input requirements, while the instruction stays general.

Example: With and Without a Stimulus Article:

GOCOURSE is moving its live classes from Zoom to its own classroom platform from 1 December. Students will receive classroom login details by email on 25 November. The new classroom platform supports recordings, so recorded classes will appear in the course library within two hours. Students with login problems should contact support before 30 November. The Zoom links will stop working after 30 November. Without a stimulus, a two-sentence summary may focus on the new platform's recording feature and omit the dates.

With the stimulus classroom platform, 1 December, login details, 25 November, Zoom links stop 30 November, the summary is guided to include exactly the information a student needs to act on.

Possible output with stimulus:

From 1 December, live classes move from Zoom to GOCOURSE's own classroom platform, and login details will be emailed on 25 November. Zoom links stop working after 30 November, so contact support before then if you have login problems. Ways to Generate the Stimulus Without Training Method 1: Rules or Code Extract keywords with simple code, such as word frequency, named dates, or a list of important terms.

Advantages: free, fast, predictable. Limitations: frequency is a weak signal of importance; it can miss rare but critical words.

Method 2: A Smaller or Cheaper Model Call Use a fast, inexpensive model to extract the key points, and the main model to write the output. This mirrors the original design of a small model guiding a large one, without training.

Method 3: Your Own Data Hints often already exist in your application: the ticket category, the customer's plan, the product name, or fields from a database. These are reliable stimuli because they come from your system rather than from a model.

Hint: customer plan = Pro; issue type = refund; purchase 4 days ago Method 4: A Human In editorial workflows, an editor can provide 3 to 5 keywords for each article, and the model writes the summary. This is a simple and effective form of human guidance.

Implementing Directional Stimulus in Python The example below uses code-based keyword extraction as the stimulus, generates a summary guided by the keywords, and checks whether the summary actually covers them.

Keyword Extraction and Coverage import re from collections import Counter

STOPWORDS = { "the", "a", "an", "and", "or", "of", "to", "in", "on", "for", "is", "are", "was", "were", "be", "will", "with", "by", "at", "from", "that", "this", "it", "as", "their", "its", "has", "have", "after", "per", "all", "new", "also", }

def extract_keywords(text: str, k: int = 5) -> list[str]: """Return the k most frequent non-stopword words in the text.""" words = re.findall(r"[a-zA-Z][a-zA-Z0-9-]+", text.lower()) counts = Counter(w for w in words if w not in STOPWORDS and len(w) > 2) return [word for word, _ in counts.most_common(k)]

def keyword_coverage(output: str, keywords: list[str]) -> float: """Fraction of keywords that appear in the output.""" lowered = output.lower() return sum(1 for k in keywords if k in lowered) / len(keywords) if keywords else 1.0

article = ( "GOCOURSE is moving its live classes from Zoom to its own classroom platform from " "1 December. Students will receive classroom login details by email on 25 November. " "The new classroom platform supports recordings, so recorded classes will appear in " "the course library within two hours. Students with login problems should contact " "support before 30 November. The Zoom links will stop working after 30 November." )

print(extract_keywords(article)) Output:

['classroom', 'november', 'classes', 'zoom', 'platform'] Code Explanation extract_keywords()

Finds words that start with a letter (so pure numbers are skipped) and lowercases them. Removes common stopwords and very short words. Returns the most frequent remaining words. What the output shows The keywords capture the main subject (classroom, platform, Zoom, classes) and that something happens in November. But frequency-based extraction misses specific values, such as the actual dates, because numbers are excluded and each date appears only once or twice. This is the main weakness of simple rule-based stimuli.

keyword_coverage() Checks how many keywords appear in an output, which you can use to verify that the stimulus was followed.

Better Stimuli From a Model A model can extract specific key facts, including dates and actions:

Requirements: pip install openai and an OPENAI_API_KEY environment variable.

import json

from openai import OpenAI

client = OpenAI() MODEL = "gpt-5.4" # main model, replace with a model available in your account HINT_MODEL = "gpt-5.4" # may be a smaller, cheaper model

HINT_INSTRUCTIONS = """List 4 to 6 short keywords or phrases from the text in that a student must know in order to act on it: dates, deadlines, actions, and changes. Return only a JSON array of strings."""

SUMMARY_INSTRUCTIONS = """Summarize the text in in 2 sentences for students. Include all of the keywords listed in ."""

def call(model: str, instructions: str, text: str) -> str: response = client.responses.create(model=model, instructions=instructions, input=text) return response.output_text.strip()

def summarize_with_stimulus(text: str) -> tuple[list[str], str, float]: text_block = f"\n{text}\n" hints = json.loads(call(HINT_MODEL, HINT_INSTRUCTIONS, text_block)) hint_block = f"\n{', '.join(hints)}\n" summary = call(MODEL, SUMMARY_INSTRUCTIONS, f"{hint_block}\n\n{text_block}") return hints, summary, keyword_coverage(summary, hints)

hints, summary, coverage = summarize_with_stimulus(article) print("Hints:", hints) print("Summary:", summary) print(f"Coverage: {coverage:.0%}") Code Explanation Two models HINT_MODEL generates the stimulus, and MODEL writes the summary. They can be the same model, but using a smaller model for hints follows the original idea of a cheap guide for an expensive model.

HINT_INSTRUCTIONS Defines what makes a good hint for this task: dates, deadlines, actions, and changes. The definition of "important" belongs in this prompt, and it determines the quality of the whole technique.

Hint placement The hint is placed in its own section, separate from the text being summarized, so the model does not confuse the hint with the article (Lesson 37).

Coverage check keyword_coverage() measures how many hints appear in the summary. Low coverage indicates that the model ignored the stimulus. Note that it checks for exact phrases, so a summary that paraphrases a hint ("emailed on 25 November" for "login email 25 November") may score lower even though the information is present.

Stimulus Types Beyond Keywords Task Possible Stimulus Example Summarization Key facts or keywords 1 December, login email, Zoom links stop Customer reply Reply type and key points Type: apology + solution; mention: refund in 5–7 days Dialogue Intended dialogue act Act: ask a clarifying question Code explanation Concepts to cover Focus: list comprehension, KeyError handling Product description Features to emphasize for this audience Emphasize: offline access, low data usage In each case, the stimulus states what the output should contain or do for this input, while the general instruction states how to write it.

Directional Stimulus Compared With Related Techniques Technique What Is Added to the Prompt Source Directional stimulus Short, input-specific hints A small model, code, your data, or a person Generated knowledge (Lesson 56) Facts about the topic The same model, in a separate step Few-shot examples (Lesson 26) Complete example inputs and outputs Prepared in advance, often the same for every input Context (Lesson 6) Background about the situation Your knowledge or data A directional stimulus is smaller and more targeted than any of these. It does not teach the task or provide background; it steers a specific output.

Common Mistakes Mistake 1: Hints That Contain the Whole Answer What it is: The "hint" is a complete draft of the desired output.

Why it happens: It is tempting to provide as much guidance as possible.

What it causes: The model mostly copies the hint, and the hint generator is now doing the real work, with its own errors.

How to fix it: Keep stimuli short: keywords, key facts, or a type of response.

Mistake 2: Low-Quality Automatic Hints What it is: Using frequency-based keywords that miss the important specifics.

Why it happens: Simple extraction is easy to implement.

What it causes: The output focuses on frequent but unimportant words, such as "classes", and misses dates and actions.

How to fix it: Define what makes a good hint for the task, and use a model or your own data to produce it.

Mistake 3: Mixing Hints With the Input Text What it is: Appending keywords directly to the article without a label.

Why it happens: Building the prompt by concatenation.

What it causes: The model may treat the hint as part of the article.

How to fix it: Place the hint in its own labeled section.

Mistake 4: Not Checking Whether Hints Were Used What it is: Assuming the model followed the stimulus.

Why it happens: The output looks reasonable.

What it causes: Important facts are silently omitted.

How to fix it: Measure keyword coverage and retry or flag outputs with low coverage.

Best Practices Use stimuli for input-specific guidance. General rules go in the instruction; per-input focus goes in the hint.

Keep hints short and directional. Keywords, key facts, or a response type, not a draft.

Prefer reliable hint sources. Your own data first, then models or people, then simple code.

Define what a good hint is for the task. Dates and actions for notices; features for product copy.

Label and separate the hint. It must not be confused with the input data.

Verify that hints were followed. Use coverage checks in code.

Try It Yourself Exercise 1: Code vs Model Hints Take three announcements or articles from your work. For each, compare the keywords from extract_keywords() with hints generated by a model using HINT_INSTRUCTIONS. Generate a summary with each set of hints and check which summaries include the dates and actions a reader needs.

Exercise 2: Hints From Your Own Data Write a prompt that drafts replies to support tickets. Create the stimulus from structured data you would have in a real system, such as category, customer plan, and order status. Compare replies with and without the stimulus for five tickets.

Exercise 3: Improve Coverage Measurement Modify keyword_coverage() so that a hint counts as covered if at least half of its words appear in the output. Test it with a summary that paraphrases some hints, and compare the results with the original exact-match version.

0 Comments

Reviewed before they appear

No comments yet.

Prompt Engineering
Prompt Engineering Introduction How Large Language Models Respond to Prompts Prompting Basics Elements of an Effective Prompt Writing Clear Instructions for AI Models Adding Context to a Prompt Providing Input Data in Prompts Using Output Indicators and Response Formats Prompt Formatting: Questions, Instructions, and Templates General Tips for Designing Better Prompts Common Prompt Engineering Mistakes Iterative Prompt Design and Refinement Understanding Instruction, Context, Input, and Output How Specificity and Conciseness Affect Prompt Quality Breaking Large Tasks into Smaller Prompting Tasks Zero-Shot Prompting Zero-Shot Prompting Examples for Everyday Tasks Zero-Shot Text Classification Zero-Shot Question Answering Zero-Shot Summarization Zero-Shot Translation Zero-Shot Prompting for Information Extraction When to Use Zero-Shot Prompting Limitations of Zero-Shot Prompting Improving Weak Zero-Shot Prompts Few-Shot Prompting One-Shot Prompting vs Few-Shot Prompting Choosing Good Examples for Few-Shot Prompts Formatting Examples in Few-Shot Prompts Few-Shot Classification with Examples Few-Shot Prompting for Structured Output Few-Shot Prompting Zero-Shot vs Few-Shot Prompting Role Prompting and Persona Instructions Instruction-Based Prompting Task-Oriented Prompt Templates Using Delimiters to Separate Prompt Sections Prompt Templates with Variables Chain-of-Thought Prompting Zero-Shot Chain-of-Thought Prompting Few-Shot Chain-of-Thought Prompting Automatic Chain-of-Thought (Auto-CoT) When Chain-of-Thought Prompting Helps Limitations of Chain-of-Thought Prompting Self-Consistency Prompting Comparing Chain-of-Thought and Self-Consistency Tree of Thoughts (ToT) Prompting Exploring Multiple Solutions with Tree of Thoughts Least-to-Most Prompting Complexity-Based Prompting Maieutic Prompting Self-Consistency: Sampling Multiple Reasoning Paths Self-Consistency for Arithmetic and Logic Tasks Tree of Thoughts: Search, Evaluation, and Backtracking Meta Prompting Generate Knowledge Prompting Directional Stimulus Prompting Program-Aided Language Models (PAL) React: Reasoning and Acting with Language Models Reflexion: Improving Agents Through Feedback Prompt Chaining Designing Multi-Step Prompt Chains Decomposing Complex Tasks into Prompt Chains Automatic Prompt Engineer (APE) Active-Prompt: Selecting Useful Reasoning Examples Optimizing Prompts Systematically Prompt Iteration and Versioning Building Reusable Prompt Libraries Testing Prompt Variants Prompt Chaining Fundamentals Passing Outputs Between Prompt Steps Prompt Chains for Summarization and Extraction Validating Intermediate Results in a Prompt Chain Debugging a Multi-Step Prompt Workflow Graph Prompting Multimodal Chain-of-Thought Prompting Automatic Reasoning and Tool-Use (ART) Prompting for Tool Selection and Use Combining Prompting Techniques for Complex Tasks Prompts for Text Summarization
Ask about this post
AI Ask about this post

Ask questions about Directional Stimulus Prompting and get answers drawn from it.

Signed-in readers only.