Background Information & System Prompts
What Goes in Background Information?
Background information is static context that doesn't change between requests. This includes:
- Document structures and schemas
- Domain rules and definitions
- Reference data and lookup tables
- Process descriptions
- Constraints and limitations
Why Use System Prompts?
System prompts are ideal for background information because:
- Persistence - Stays constant across the conversation
- Caching - Can be cached to reduce latency and costs
- Separation - Keeps dynamic content clean
- Efficiency - Model learns the context once
The Car Accident Form Example
In Anthropic's demo, they provided complete form structure:
<form_structure>
The Swedish car accident form ("Skadeanmรคlan") has:
- Title: "Skadeanmรคlan vid trafikolycka"
- Two columns: Vehicle A (left) and Vehicle B (right)
- 17 numbered rows with checkboxes
<row_definitions>
<row number="1">Was parked/standing still</row>
<row number="2">Was starting to move/leaving parking</row>
<row number="3">Was parking</row>
<row number="4">Was exiting a parking lot/private road</row>
<row number="5">Was entering a parking lot/private road</row>
<row number="6">Was entering a roundabout</row>
<row number="7">Was driving in a roundabout</row>
<row number="8">Was striking the rear of another vehicle</row>
<row number="9">Was driving in the same direction in a different lane</row>
<row number="10">Was changing lanes</row>
<row number="11">Was overtaking</row>
<row number="12">Was turning right</row>
<row number="13">Was turning left</row>
<row number="14">Was reversing</row>
<row number="15">Was driving on the wrong side of the road</row>
<row number="16">Was coming from the right (at intersection)</row>
<row number="17">Did not observe traffic sign/signal</row>
</row_definitions>
<form_conventions>
- Checkboxes may be marked with X, checkmark, or circle
- Markings may be imprecise (human handwriting)
- Both vehicles should have at least one box checked
- The sketch section shows a hand-drawn diagram
</form_conventions>
</form_structure>
What This Achieves
| Without Background | With Background |
|---|---|
| Model guesses form structure | Model knows exactly what to expect |
| Wastes tokens describing form | Focuses on analysis |
| May misinterpret checkboxes | Understands checkbox meanings |
| Inconsistent analysis | Consistent, reliable analysis |
Prompt Caching Benefits
When using the API with prompt caching:
Static Background (Cached)
โโโ Form structure definition
โโโ Row meanings
โโโ Interpretation guidelines
โโโ ~2000 tokens (cached, fast)
Dynamic Content (Per Request)
โโโ Actual form image
โโโ Specific task instructions
โโโ ~500 tokens (new each time)
Benefits:
- Reduced latency (cached portion instant)
- Lower costs (cached tokens discounted)
- Consistent behavior (same background always)
Structuring Background Information
Use XML Tags for Organization
<background>
<domain>
Insurance claims processing for car accidents
</domain>
<document_types>
<type name="accident_form">
Standardized form with checkboxes...
</type>
<type name="sketch">
Hand-drawn diagram showing...
</type>
</document_types>
<terminology>
<term name="Vehicle A">The reporting party's vehicle</term>
<term name="Vehicle B">The other party's vehicle</term>
<term name="fault">Legal responsibility for the accident</term>
</terminology>
<rules>
<rule>Both vehicles must have actions checked</rule>
<rule>Fault is determined by traffic laws</rule>
<rule>Rear-ender is typically at fault</rule>
</rules>
</background>
Progressive Detail
Start general, then get specific:
1. Domain overview (what business/field)
2. Document description (what you'll see)
3. Field definitions (what things mean)
4. Processing rules (how to interpret)
5. Edge cases (special situations)
What NOT to Put in Background
Avoid including:
- Information that changes per request
- The actual content to analyze
- Specific task instructions (those go in user prompt)
- Output examples (those are few-shot, separate section)
Real-World System Prompt Structure
You are an AI assistant for [COMPANY] that [ROLE DESCRIPTION].
<background_knowledge>
[Static domain information]
[Document structures]
[Terminology definitions]
[Business rules]
</background_knowledge>
<behavior_guidelines>
[How to handle uncertainty]
[Quality standards]
[Ethical constraints]
</behavior_guidelines>
When given [INPUT TYPE], you will [TASK DESCRIPTION].
Example: E-Commerce Product Analyzer
<system_prompt>
You are a product data analyst for an e-commerce platform.
<product_categories>
<category id="electronics">
Includes: phones, laptops, tablets, accessories
Key attributes: brand, specs, warranty, compatibility
</category>
<category id="clothing">
Includes: shirts, pants, shoes, accessories
Key attributes: size, color, material, care instructions
</category>
</product_categories>
<quality_rules>
- Titles must be under 200 characters
- Descriptions must mention key features
- Prices must be in USD
- Images must show actual product
</quality_rules>
<common_issues>
- Keyword stuffing in titles
- Missing size information
- Stock photos instead of actual product
- Inconsistent pricing
</common_issues>
Analyze product listings for quality issues and compliance.
</system_prompt>
Key Takeaways
- Background info is static - Doesn't change between requests
- System prompts are ideal - Persistent and cacheable
- Structure with XML - Clear organization helps the model
- Be comprehensive - Include everything the model needs to know
- Cache when possible - Reduces cost and latency
Next Lesson
Next, we'll explore Structuring with XML Tags - how to organize information within prompts for maximum clarity.