6 tips for optimizing your prompts on chatGPT (generative AI)

Simon Zeru Image

Simon Zeru

January 16, 2025 (2mo ago)

As a developer, I use AI on a daily basis to optimize my workflow, automate certain tasks and get quick answers to my questions.

In this article, I'm going to share with you 6 tips for optimizing your prompts on chatGPT (generative AI) to get quality results.

Image of OpenAI Logo

Prompt Engineering is considered a science because it requires a thorough and methodical understanding of how language patterns respond to different prompts.

Like any science, it evolves with research and experience, making mastery of its fundamentals easier and easier to grasp as LLMs become more complete.

But first, what is a prompt?

A prompt is an instruction given to an artificial intelligence model to generate a response or perform a specific task.

It can be a sentence, a question, a paragraph or even a document that serves as a starting point.

The prompt establishes the context in which the AI must reason, clarifies what is expected in terms of content and format, and directs the response towards a specific domain or expertise.

A well-designed prompt optimizes relevance by minimizing ambiguities and errors.

Here are the key principles to keep in mind when designing effective prompts

  1. Clarity and precision: A prompt must be clear and precise to obtain accurate responses.

  2. Accurate context: Providing sufficient context allows the AI to better understand and respond appropriately.

  3. Simplicity: A simple, straightforward prompt limits the risk of confusion and improves the quality of the answers generated.

1. Use AI itself to generate prompts

Yes, it sounds obvious, but it's often overlooked. AI is the best source for generating prompts, because it knows what works best for it.

Why is this? Generative AI works largely on the basis of examples it has seen. By giving her prompts that resemble what she's already seen, you increase your chances of getting quality responses.

She trains on billions of pieces of data, so why not ask her for a hand?

To do this, you can use prompts like:

Example of use:

Human-generated prompt:
- I need you to make me an optimized prompt so that I can effectively learn the key principles of machine learning.
 
AI-generated prompt result: 
- Context: I'm a beginner in machine learning and I'd like to understand the basics so I can progress quickly. My goal is to master essential concepts such as classification, regression, overlearning, and evaluation metrics. I'm also interested in simple practical examples and clear explanations. Request: Explain to me the key principles of machine learning (classification, regression, overlearning, evaluation metrics) in simple terms. Use analogies if possible to facilitate my understanding. Also provide a concrete example of each concept with pseudocode or practical explanations. "*

Tools for generating prompts

Tools exist to help you generate quality prompts.

Anthropic AI offers a tool that lets you generate customized prompts for chatGPT in just a few clicks.

2. Focus on specific and targeted prompts

Specific, targeted prompts help the AI to better understand what you want it to do.

Open-ended questions without a clear context can lead to imprecise or off-topic responses.

Specific, targeted prompts, on the other hand, guide the AI towards the expected response.

AI works word by word: the more information you give it, the more likely it is to produce an accurate answer.

Ineffective phrases:

Effective phrases:

3. Memory usage

Positive points

If you want to have AI generate consistent responses, it's important to manage its conversational context.

For example, you need to write several Linkedin posts on different topics.

You want each post to have the same style, tone and structure.

Bingo, that's where short-term memory comes in.

How it works

Based on the same example:

You need to make your intentions clear to the AI.

All that's left is to ask it to write you a post on a specific topic, and it will remember the context you've given it.

Negative points

The AI has a limited memory (for now at least), and can be influenced by previous prompts.

Although short-term memory is interesting and practical, it can sometimes be an obstacle to generating accurate answers.

To avoid this, we recommend clearing the AI's memory when you change topic or context.

What's more, chatGPT has recently added a long-term memory option that allows you to store information on each and every prompt.

This feature is very useful for long and complex conversations, but it can also be a source of errors if not used correctly.

I recommend disabling it if you don't need it, or limiting it to essential information to avoid errors.

4. Use the internet search option

Image of the web search option

Generative AI is very effective, but it is trained on past data.

The world is changing fast, and it's important to keep in mind that AI doesn't have access to real-time news.

For this reason, OpenAI (and other generative AIs) offers an internet search option that allows the AI to consult information in real time to generate more accurate answers.

This provides it with up-to-date data and guarantees the relevance of the answers.

5. Analysis, feedback and iteration

Analysis of AI-generated responses is essential to assess the quality of prompts and replies.

You may think that the AI will give you the best possible answer on the first try, but this is rarely the case.

It's for this very reason that it's important to question the answers generated.

For example, you can say after an answer:

Don't hesitate to iterate these requests for clarification to obtain a satisfactory answer.

Request for correction

Another very frequent use case is to ask the AI to analyze or correct content (e-mail, assignment, code...).

When writing your prompt, the advice I like to give is to end your request with an open-ended question.

Example:

To give you the most rational and authentic answer, you can also add details like:

6. Curb chatGPT

Finally, my last piece of advice is to throttle chatGPT.

ChatGPT is a very powerful AI, but it can sometimes be too creative or too talkative.

To ensure optimal rendering quality, you can restrict the AI's responses by putting constraints on it.

For example, you can ask it not to exceed a certain number of words, not to use technical terms, and so on.

In the context of code generation, you can ask it not to use methods that are too advanced, or set constraints on the complexity of the generated code.

Conclusion

So, optimizing prompts is an iterative process that requires practice and patience. Prompt engineering is an essential skill, especially in the years to come when generative AI will play an increasingly important role in our daily lives.

For the first time in human history, we have access to so much knowledge and resources so easily. The problem-feedback cycle has been accelerated to such an extent that progress can be made at lightning speed. The opportunity is there, it's up to you to seize it.

Bibliography :

OpenAI
Date : Not specified Titre : "Prompt Engineering Guide"
Source : https://platform.openai.com/docs/guides/prompt-engineering

Elliott Pierret
Date : Nov 13, 2024 Titre : "Generate PERFECT prompts with the AI Prompt Generator!"
Source : https://www.youtube.com/watch?v=vaG_lMfXBwE&t=110s