Analyse the Complexity of a Multi-Part Prompt
Complex prompts that pack multiple tasks, conditional logic, strict formatting requirements, and domain-specific constraints into a single instruction are prone to partial compliance — the model addresses some parts correctly while silently ignoring others. The prompt complexity analyser scores your prompt on five dimensions: task count (how many distinct jobs the model must perform), ambiguity (how many instructions could be interpreted multiple ways), constraint density (how many rules the model must track simultaneously), output format rigidity (how precisely the output structure is specified), and estimated token count. A high complexity score suggests the prompt should be decomposed into a chain of simpler prompts, each with a single clear task. Research from Anthropic, OpenAI, and academic labs consistently shows that smaller models handle complex multi-task prompts significantly worse than flagship models, while even smaller models perform well on clearly scoped single-task prompts. If you need to use a smaller model for cost reasons, decomposing your prompt is often more effective than any other optimisation. This example shows a real-world complex prompt used for automated code review: it asks the model to identify bugs, suggest performance improvements, check for security vulnerabilities, rate overall code quality on a scale, and produce a formatted JSON report — five distinct tasks with a strict output schema. The analyser breaks it down and suggests which parts to separate into individual steps.
Review the following Python function and do all of the following: 1. Identify any bugs or logic errors and explain each one 2. Suggest at least 3 specific performance improvements with code examples 3. Check for security vulnerabilities including SQL injection, path traversal, and insecure deserialization 4. Rate the overall code quality from 1-10 with justification 5. If the function handles user input, verify input validation and sanitization Output your entire response as a single JSON object with keys: bugs (array), performance (array), security (array), quality_score (integer), quality_justification (string), input_validation_notes (string or null). Do not include any text outside the JSON object. Do not wrap in markdown code blocks.
FAQ
- How many tasks can a single prompt handle reliably?
- Flagship models like GPT-4o and Claude 3.5 Sonnet handle 3–5 well-defined tasks reliably. Beyond that, compliance rates drop even for top models. Smaller models struggle with more than 2 concurrent tasks. Decompose anything with 4+ tasks into a chain.
- What is "constraint density" and why does it matter?
- Constraint density is the number of rules the model must simultaneously track: format rules, content restrictions, length limits, tone requirements, prohibited words, and conditional logic. High constraint density causes models to satisfy some constraints while violating others.
- Does prompt complexity affect cost?
- Indirectly. Complex prompts often need a larger, more expensive model to handle reliably. Decomposing into simpler steps lets you use cheaper models for straightforward sub-tasks while reserving the expensive model only for steps that need it.
Related Examples
A well-structured system prompt is the single biggest lever for improving LLM ou...
Optimize a Verbose PromptVerbose prompts are not just wasteful — they actively hurt performance. When a p...
Split a Long Document for AI ProcessingWhen a document is too long to fit in a single LLM context window, it must be sp...
Design an LLM Processing ChainLLM chains connect multiple model calls in sequence, where the output of one ste...