Prompt Engineering: How to Get better results

For engineering teams, prompt engineering is less a writing trick than an application layer contract. The prompt becomes part of the system design: it shapes model behavior, affects output consistency, and introduces dependencies that are easy to overlook until a workflow reaches production. That means prompts should be treated like code artifacts, with versioning, review, and rollback discipline.

The main technical trade-off is between flexibility and determinism. Looser prompts can adapt to varied inputs, but they also widen the range of possible outputs, which complicates testing and support. More constrained prompts may improve repeatability, yet they can reduce coverage for edge cases. For enterprise use, that tension matters because downstream systems often assume structured, reliable responses rather than open-ended language.

Operationalizing prompt work also requires evaluation infrastructure. Teams need a way to compare prompt variants against representative inputs, measure failure modes, and detect regressions when models, tools, or surrounding data change. Without that discipline, prompt changes can quietly alter product behavior, create brittle automations, or increase the manual review burden on operations and support teams.

Finally, prompt engineering sits inside a larger AI delivery pipeline. It interacts with retrieval, external tools, and human-in-the-loop review, so success depends on integration quality as much as wording quality. The practical lesson for developers and architects is to design prompts as maintainable components, not one-off instructions, and to align them with governance, observability, and change management.


In the world of natural language processing and artificial intelligence, prompt engineering has become an essential tool for enhancing and refining language model outputs. The ability to formulate questions or commands effectively can make the difference between obtaining accurate answers and confusing results. In this article, we will explore best practices in prompt engineering to optimize your interactions with language models, focusing particularly on the context of GPT (Generative Pre-trained Transformer) and techniques applicable to similar architectures. Photo by Mojahid Mottakin on Unsplash

Improve Your Instructions

Clear and specific instructions form the foundation of a good interaction with language models. Here are some ways to improve your instructions:
  • Be Specific: Instead of vague instructions, provide specific details about what you expect in the response.
Example:
Instead of: "Generate a response about artificial intelligence."
Use:
"Provide a detailed summary of how artificial intelligence is impacting healthcare."
  • Add Context: Provide background information to contextualize the task. This helps the model better understand the context of your request.
Example:
Instead of: "Write about sustainability."
Use:
"Imagine you're writing a blog entry on sustainability."
Provide specific data on how renewable energies are positively impacting the environment. Other things you can do to improve your instructions include:
  • Instruct the model to act like a person.
  • Use delimiters to distinguish parts of your input.
  • Specify steps if your task is complex.

Add Reference Texts

Providing specific examples or reference texts can significantly enhance the quality of responses. This helps the model better understand the tone, style, and content you are seeking. Example:
Write a persuasive paragraph about the importance of space exploration. Include information from the following two reference texts: 
Text 1: first paragraph...
Text 2: second paragraph...
You can also instruct the model to respond using quotes from a reference text, such as a website or a book.

Break Complex Tasks into Smaller Tasks

When facing a complex task, consider breaking it into smaller, more manageable tasks. This allows the model to focus on specific aspects and produce more accurate responses. Example:
Instead of: "Describe all features of an operating system."
Use:
"List and explain three key features of a modern operating system: security, multitasking, and file management."
Other techniques you can use include creating document summaries by providing excerpts rather than asking for the entire document and classifying the query type first, using that classification to determine which instructions are needed.

Give the Model Time to Think and Analyze Responses

Language models like GPT-3.5 can benefit from additional time to process and generate more elaborate responses. Donโ€™t hesitate to adjust time parameters according to your needs. Example:
Instead of: "Find the solution to the following differential equation: โ€ฆ"
Use:
"Find the solution to the following differential equation: โ€ฆ, use a calculator, perform checks, and provide the result once you've verified that the solution is correct."

Use External Tools

Integrating external tools can improve the quality and diversity of responses. You can use APIs from other platforms to obtain additional information or perform specific tasks. Example: You can write and execute Python code by enclosing it in triple quotes.
```python
import message
message.write(to="John Doe", message="Hey, want to meetup after work?")
```

Systematically Test Your Changes

Systematically test your instructions and parameters. Observe how responses change when modifying certain aspects and adjust accordingly. Make several requests with different configurations and compare the responses.

Final Summary and Recommendations

Prompt engineering is a skill that improves with practice. Experiment with various strategies, adjust based on results, and continually refine your approach. By consistently improving your instructions and techniques, you will maximize the effectiveness of language models like GPT-3.5 in your applications. Remember to consult OpenAIโ€™s documentation for in-depth strategies. Keep in mind that each task may require a unique approach, so maintain flexibility and creativity in your prompt engineering process. Get the most out of your interactions with GPT through effective prompt engineering!
View at Medium.com

Enjoyed this article? Sign up for our newsletter to receive regular insights and stay connected.