AI Content Hub
Your ultimate resource for AI wisdom: expert tips, thought-provoking quotes, practical tutorials, and mind-expanding challenges
Know a useful AI tip or trick? Submit it to the hub →
Popular Tags
Use Output Priming
Start the desired output for the LLM. For instance, if you want a list, start your prompt with the beginning of the list: 'Here are the steps:
1.' This can guide the model effectively.
Grounding with Facts
If accuracy on specific facts is crucial, provide those facts within the prompt. This helps to ground the LLM and reduce the chance of hallucinations on those specific points.
Embrace Constraints
Adding constraints to your prompt (e.g., word count, specific keywords to include/exclude, format requirements) can often lead to more focused and useful outputs from the LLM.
Use Analogies for Complex Explanations
If you need an LLM to explain a complex topic simply, ask it to use an analogy. For example, 'Explain quantum entanglement using an analogy involving a pair of gloves.'
Structured Prompts for Complex Tasks
For intricate tasks, consider a structured prompt with sections like: ROLE, CONTEXT, TASK, OUTPUT_FORMAT, EXAMPLES. This organization helps the LLM understand requirements better.
Implement Exponential Backoff for Retries
When making API calls to LLMs, implement exponential backoff for retries. This helps manage rate limits and temporary server issues gracefully without overwhelming the API.
Validate and Sanitize LLM Outputs
If LLM outputs are displayed to users or used in other systems, always validate and sanitize them to prevent injection attacks or the display of inappropriate content.
Reflection or Self-Critique Prompts
Ask the LLM to critique its own previous answer and then improve it. For example: 'Here is your previous response: [response]. Please identify any flaws and provide an improved version.'
High-Quality Data for Fine-tuning
If you plan to fine-tune an LLM, the quality of your training data is paramount. Even a small dataset of high-quality, relevant examples can be more effective than a large, noisy one.
Specify 'Don't Know' Option
To reduce hallucinations, explicitly instruct the LLM to say 'I don't know' or a similar phrase if it cannot answer a question confidently or accurately based on the provided context.
Use 'Let's think step by step' for Math Problems
For mathematical or logical reasoning problems, adding the phrase 'Let's think step by step' before the LLM generates its solution significantly improves accuracy.
Batch Small Requests
If you have many small, independent tasks for an LLM, batch them into a single API call if the model and API support it, rather than many separate calls. This can reduce overhead.
Ask for Different Perspectives
When trying to understand a topic, ask the LLM to explain it from different perspectives or viewpoints. This can deepen your comprehension.
Iterative Summarization
For long texts, ask the LLM to summarize section by section, then summarize the summaries. This can be more effective than a single-shot summary of a very long document.
Impose Constraints for Creativity
Sometimes, imposing unusual constraints can spark more creative LLM outputs. E.g., 'Write a story without using the letter E,' or 'Describe a color to someone who is blind.'
Request Error Handling
When asking an LLM to write code, specifically request that it include error handling (e.g., try-catch blocks, input validation).
Chain of Density Prompting
To generate more detailed and nuanced content, first ask for a brief outline, then ask the LLM to expand on each point, and then ask it to add specific examples or data. This is a form of 'Chain of Density'.
Request Unit Tests
When an LLM generates code, ask it to also generate unit tests for that code. This helps ensure correctness and makes future refactoring safer.
Simulate Dialogues
Use an LLM to simulate dialogues for practicing conversations, interviews, or customer service interactions. Define the roles and scenario.
Generate Multiple Drafts
Ask the LLM to generate several different versions or drafts of a creative piece. You can then pick the best one or combine elements from different drafts.
Structured Input for Complex Tasks
For complex tasks involving multiple pieces of information, provide the input in a structured format (e.g., using JSON within the prompt, or clear headings) to help the LLM parse it correctly.
Iteratively Debug Code
If LLM-generated code has errors, provide the error message back to the LLM and ask it to debug and fix the code. Iterate until it works.
Translate Code Between Languages
LLMs can be surprisingly good at translating code snippets from one programming language to another. Useful for learning new languages or migrating projects.
Request Data Visualisation Ideas
After an LLM analyzes data, ask it to suggest appropriate ways to visualize that data (e.g., 'What type of chart would best represent these trends?').
Self-Correction Prompts
Ask the LLM to review its own previous output for errors or areas of improvement. 'Review your previous response. Are there any inaccuracies or ways to make it clearer?'
World-Building Assistance
Use LLMs to help build fictional worlds by generating names, cultures, histories, or even maps based on your descriptions and requirements.
Ask for Code Optimization Suggestions
Provide a working piece of code to an LLM and ask for suggestions on how to optimize it for performance or readability.
Provide a 'Glossary' for Specific Terms
If your prompt uses domain-specific jargon or acronyms the LLM might not know, provide a small glossary or definitions within the prompt.
Generate FAQs from Content
Provide a piece of content (like a blog post or documentation) to an LLM and ask it to generate a list of Frequently Asked Questions (FAQs) based on it.
Chain Prompts for Multi-Step Tasks
For complex tasks, chain multiple prompts together. The output of one LLM call becomes the input (or part of the input) for the next. This allows for sophisticated workflows.
Use for Boilerplate Code
LLMs are excellent at generating boilerplate code for common patterns (e.g., setting up a new class, a basic API endpoint, HTML structure).
Debate with an LLM
To explore different sides of an argument, ask an LLM to take a specific stance on a topic and then debate it. Instruct it to provide evidence or reasoning for its points.
Golden Rule: Garbage In, Garbage Out
The quality of your LLM's output is highly dependent on the quality of your input prompt. Clear, well-structured, and relevant prompts lead to better results.
Personalized Content Generation
Use LLMs to generate personalized content for users, such as tailored recommendations, custom learning plans, or individualized messages.
Overcome Writer's Block
If you have writer's block, describe your general idea or last sentence to an LLM and ask for suggestions on what could happen next or different ways to phrase something.
Refactor Legacy Code
LLMs can assist in refactoring legacy code by suggesting modernizations, improving readability, or even translating to a new language (with careful review).
Comparative Summarization
Provide two or more texts to an LLM and ask it to generate a summary that highlights the key differences and similarities between them.
The 'Assume Role' Technique
Start your prompt with 'Assume the role of a [expert/character].' This helps the LLM adopt the desired persona and knowledge base more effectively.
Generate Practice Problems
Ask an LLM to generate practice problems or quiz questions for a topic you're learning, along with answers and explanations.
Fallback Strategies for LLM Failure
Implement fallback strategies in your application for when the LLM fails, returns an error, or provides an unsatisfactory response. Don't let it be a single point of failure.
Sentiment Analysis with Nuance
When performing sentiment analysis, ask the LLM to not just classify as positive/negative/neutral, but also to identify specific emotions or nuances in the text.
Paraphrasing and Rephrasing
Use LLMs to paraphrase text to avoid plagiarism, simplify complex language, or adapt content for different audiences. Always review for accuracy.
Generate Documentation from Code
Provide code to an LLM and ask it to generate documentation (e.g., docstrings, comments, or a README section) for that code.
No Matching Content Found
Try adjusting your filters or search query.
Join the AI Revolution
Subscribe to our newsletter for weekly AI insights, expert tips, and early access to new tools and features.