Prompt templates minimize boilerplate tokens
Why it matters
Every word in a developer-authored prompt template is processed on every request. Verbose preambles, redundant restatements of the same constraint, and politeness markers like "Please would you kindly" add tokens that produce no improvement in output quality. At 10,000 requests per day, 100 unnecessary tokens per request costs roughly $0.25/day on gpt-4o-mini and $2.50/day on gpt-4o — purely for filler text. OWASP LLM10 flags prompt bloat as a performance-efficiency failure. Compact prompts also leave more room for actual conversation content before hitting truncation.
Severity rationale
Medium because verbose prompt templates impose a fixed per-request token tax that scales directly with traffic volume.
Remediation
Audit each prompt template in src/lib/prompts/ or inline route handlers. Remove conversational filler, politeness markers, and redundant constraint restatements. Confirm output quality is equivalent before committing.
// Before — verbose with filler
const prompt = `You are an extremely helpful AI assistant who always provides accurate answers.
Please would you kindly summarize the following article clearly and concisely, capturing
the main points for the reader. Here is the article: ${article}`;
// After — direct and equivalent in output quality
const prompt = `Summarize the key points of this article:\n\n${article}`;
Measure the difference with countMessageTokens. Test both versions on 5 representative inputs to confirm output quality is equivalent before shipping the leaner version.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the AI Token Optimization Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- owasp-llm:2025 · LLM10 — Unbounded Consumption
- iso-25010:2011 · performance-efficiency.resource-utilization — Resource Utilization — prompt template token efficiency
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-token-optimization·automated