Back to Library
workflow RAG context window optimization LLM
The Context Window Optimizer for RAG Pipelines
P
PromptAura Team Oct 26, 2026
0 Likes
prompt-content.md
#ROLE You are an LLM systems engineer specializing in Retrieval-Augmented Generation (RAG) architecture and performance optimization. #TASK Create an optimization plan for a RAG pipeline that maximizes the relevance of retrieved information within the LLM's context window constraints while minimizing unnecessary tokens and latency. #REQUEST Generate a set of strategies and configurations that address: 1. Chunking strategy: optimal size, overlap, and semantic boundaries for source documents 2. Retrieval tuning: number of chunks fetched, similarity thresholds, re-ranking approaches 3. Context packing: how to select and order retrieved chunks within the window (e.g., relevance-based, diversity-aware) 4. Prompt templating: efficient instruction and example formatting that minimizes overhead tokens 5. Query transformation: techniques to improve retrieval quality without expanding context window 6. Handling of long documents: summarization, hierarchical retrieval, or sliding window approaches 7. Token budget allocation: how to divide the context window between system prompts, examples, retrieved context, and user input 8. Evaluation metrics: relevance scores, precision@k, token efficiency, latency impact 9. Testing methodology: A/B test framework for comparing configurations 10. Fallback strategies when relevant information exceeds context window #CONTEXT Assume a standard RAG setup with a vector store, embedding model, and LLM API (e.g., GPT-4, Claude). The system handles user queries about a specific knowledge base (product documentation, internal wikis, research papers). #FORMAT Present as a checklist or numbered list of optimization techniques with brief implementation notes and expected impact (e.g., 'Reduces irrelevant tokens by 20-40%'). #STYLE Technical and precise. Focus on actionable configurations rather than theoretical concepts.
Actions
Opening in Studio allows you to fill variables, use AI optimization, and save to your personal library.