10 Prompts for Working with LLMs: Fine-Tuning, RAG, and Prompt Engineering

Introduction

Large Language Models (LLMs) are transforming how we build AI applications, but getting them to perform reliably requires more than just typing a question. Whether you're fine-tuning a model on domain-specific data, integrating a Retrieval-Augmented Generation (RAG) pipeline, or crafting precise prompts, the quality of your prompts determines the quality of your outputs. This article provides 10 practical prompts across three categories: fine-tuning, RAG, and prompt engineering. Each prompt includes a clear task, the exact prompt text, and a realistic example result. You can use these as templates or inspiration for your own projects. No fluff—just actionable, field-tested prompts.

Fine-Tuning Prompts

Fine-tuning adapts a pre-trained LLM to a specific domain or task using labeled data. These prompts help you prepare data, evaluate performance, and avoid common pitfalls.

1. Generate Training Examples for Domain Fine-Tuning

Task: Create synthetic question-answer pairs from a technical document to train a customer support model.
Prompt: "You are a data generator for fine-tuning a customer support LLM. Given the following excerpt from our product manual about 'API rate limits,' generate 5 distinct question-answer pairs. Each question should reflect a real user pain point (e.g., 'Why am I getting a 429 error?'). Each answer must be factually correct and no longer than 3 sentences. Excerpt: 'Rate limits are set at 100 requests per minute for free tier, 1000 for pro tier. Exceeding the limit returns a 429 status code. Limits reset every 60 seconds.'"
Example Result:
- Q: What HTTP status code indicates I've hit the rate limit? A: A 429 status code means you've exceeded the allowed number of requests. Wait 60 seconds for the limit to reset.
- Q: How many requests per minute can I make on the free tier? A: Free tier users can make up to 100 requests per minute. If you exceed that, you'll receive a 429 error.
- Q: Does the rate limit reset after an hour? A: No, it resets every 60 seconds. After that window, your request count starts fresh.
- Q: I'm a pro user—what's my limit? A: Pro tier allows 1000 requests per minute. If you need more, contact support for custom limits.
- Q: Can I increase my rate limit permanently? A: You can upgrade to a higher tier or contact sales for custom arrangements. Limits are enforced per API key.

2. Evaluate Fine-Tuned Model Outputs

Task: Compare the responses of a base model and a fine-tuned model on a specific query to assess improvement.
Prompt: "You are an evaluation assistant. Compare these two responses to the question 'How do I reset my password?' from a base model and a fine-tuned model. Score each on accuracy (1-5), relevance (1-5), and tone (formal vs. casual). Provide a brief explanation. Base model response: 'You can reset your password by clicking forgot password.' Fine-tuned model response: 'To reset your password, go to Settings > Account > Security. Click "Forgot Password" and follow the email link. If you don't receive an email within 5 minutes, check your spam folder or contact support.'"
Example Result:

Aspect Base Model Fine-Tuned Model
Accuracy (1-5) 2 5
Relevance (1-5) 3 5
Tone Formal but vague Helpful and precise
Explanation: The base model's answer is technically correct but too vague to be useful. The fine-tuned model provides step-by-step instructions, covers edge cases (spam folder), and offers a fallback. This fine-tuning clearly improved real-world utility.

3. Detect Data Leakage in Fine-Tuning Sets

Task: Check if a candidate fine-tuning example contains information that the model should not memorize (e.g., personal identifiable information).
Prompt: "You are a data auditor. Analyze this training example for potential data leakage. Flag any PII (emails, phone numbers, addresses), confidential business data (internal project names, unreleased features), or verbatim quotes from copyrighted sources. Example: 'User John Doe (john.doe@company.com) reported that invoice #12345 was incorrect. Our internal project Phoenix aims to fix this in Q3 2026.'"
Example Result:
- PII detected: john.doe@company.com (email).
- Confidential data: Internal project name 'Phoenix' and release timeline 'Q3 2026'.
- Recommendation: Anonymize the email (e.g., user@example.com) and replace 'Phoenix' with a generic placeholder like '[Project]'.

RAG Prompts

RAG combines retrieval from a knowledge base with LLM generation. These prompts help structure queries, synthesize retrieved chunks, and handle missing information.

4. Multi-Chunk Synthesis for RAG

Task: Combine information from multiple retrieved passages into a coherent answer.
Prompt: "You have retrieved these three passages from our knowledge base. Synthesize them into a single, concise answer to the user's question. Do not invent facts. If the passages conflict, state the conflict. User question: 'What are the supported file formats for export?' Passage 1: 'Export supports CSV, JSON, and XML formats.' Passage 2: 'For large datasets, we recommend using Parquet or Avro for performance. CSV is also supported.' Passage 3: 'The export tool currently supports CSV, JSON, and Parquet. XML support is deprecated.'"
Example Result: The supported file formats for export are CSV, JSON, and Parquet. XML support is deprecated and may not be available in future versions. For large datasets, Parquet is recommended for better performance. Note: Passage 1 mentions XML as supported, but Passage 3 clarifies it is deprecated—the most current information is that XML should not be relied upon.

5. Contextual Query Rewriting for RAG

Task: Rewrite a user's ambiguous question to improve retrieval accuracy.
Prompt: "Rewrite the following user query to make it more specific and likely to retrieve relevant documents from a technical support knowledge base. Add domain terms if needed. Original query: 'It's slow.' Context: The user is talking about a data processing pipeline that handles CSV files."
Example Result: 'What are common causes of slow performance in the CSV data processing pipeline, and how can I optimize it?'

6. Handling Missing Information Gracefully

Task: Instruct the LLM to respond when retrieved documents do not contain the answer.
Prompt: "Answer the user's question using only the provided context. If the context does not contain enough information to answer, say 'I don't have enough information to answer that question' and suggest what additional details would help. Context: 'Our refund policy allows returns within 30 days of purchase for unused items.' User question: 'Can I get a refund for a digital download?'"
Example Result: I don't have enough information to answer that question. The provided context only covers refunds for unused physical items. To help you, I would need to know if digital downloads are considered 'unused' and whether they fall under the same 30-day policy.

Prompt Engineering Prompts

These prompts focus on designing effective instructions, controlling output format, and reducing hallucinations.

7. Chain-of-Thought for Multi-Step Reasoning

Task: Force the model to reason step-by-step before giving a final answer.
Prompt: "Solve this problem step by step. For each step, write your reasoning, then provide the final answer. Problem: A customer bought 3 items at $12 each, a 10% discount applies to the total, and shipping is $5. What is the final total?"
Example Result:
1. Calculate total item cost: 3 items * $12 per item = $36.
2. Apply 10% discount: 10% of $36 = $3.60. Discounted total = $36 - $3.60 = $32.40.
3. Add shipping: $32.40 + $5 = $37.40.
Final answer: $37.40.

8. Output Format Control (JSON)

Task: Enforce a specific JSON structure for programmatic consumption.
Prompt: "Extract the following information from the text and return it as a JSON object with keys: 'name', 'date', 'amount', 'currency'. Text: 'Invoice from Acme Corp dated 2026-07-19 for $1,500 USD.'"
Example Result: {"name": "Acme Corp", "date": "2026-07-19", "amount": 1500, "currency": "USD"}

9. Reducing Hallucination with Source Citation

Task: Require the model to cite specific parts of the input.
Prompt: "Answer the question using only the provided text. For each fact in your answer, cite the exact sentence number (1-indexed) from the text. If you cannot find a fact, say 'Not in text.' Text: '1. The Eiffel Tower is in Paris. 2. It was built in 1889. 3. It is 330 meters tall.' Question: 'Where is the Eiffel Tower and how tall is it?'"
Example Result: The Eiffel Tower is in Paris (source: sentence 1). It is 330 meters tall (source: sentence 3).

10. Role Prompting for Domain-Specific Tone

Task: Adopt a specific persona to match the expected communication style.
Prompt: "You are a senior DevOps engineer explaining a complex incident to a non-technical manager. Use plain language, avoid jargon, and focus on impact and resolution. Incident: 'A memory leak in the Kubernetes cluster caused a 5-minute downtime for the payment service.'"
Example Result: We had a brief issue where the payment service was unavailable for about 5 minutes. The cause was a memory problem in our system that gradually built up over time. Our team identified it quickly and applied a fix to prevent it from happening again. The service is now stable, and we are monitoring closely.

Conclusion

These 10 prompts cover the three critical areas of working with LLMs: fine-tuning, RAG, and prompt engineering. By using structured prompts for data generation, evaluation, retrieval synthesis, and output control, you can dramatically improve the reliability and usefulness of your LLM applications. Start by adapting one of these prompts to your current project—fine-tune a domain-specific dataset, improve your RAG pipeline's answer quality, or enforce a consistent output format. The key is to iterate: test, measure, and refine. For deeper dives, explore resources like OpenAI's Prompt Engineering Guide or the LangChain documentation for RAG patterns.

← All posts

Comments