Categories Blog Promt basics

How to Write Prompts so that Neural Network Produces the Desired Result

Communication between the user and the generative model resembles a dialog between people. The more precisely the interlocutors express their thoughts, the easier it is for them to understand each other. Let’s learn together how to correctly compose queries to a neural network in order to get the desired results.

What is promt

A promt is a user’s textual request to a neural network. It can include different elements, but not necessarily all at once:

  • Instruction – this is a condition or task that the model must fulfill.
  • Context – additional information from the user, it will help the model to hallucinate less.
  • Input – the question the person is looking for an answer to.
  • Output Indicator – the format in which the model should produce the output.

There is no one-size-fits-all promt that will fit every situation. Depending on the task, you can add information to the query, set response style or constraints.

What are the different types of promts

Cornell University has developed a generally accepted scale for categorizing promts, and it includes six items:

  1. Input semantics. The user gives the model rules that it memorizes and considers when answering. This simplifies syntax and saves time. Example request: “Remember, when I ask you to build a route from point A to B, I will only enter the names of cities, and you will substitute them for A and B”.
  2. Customize information output. You can ask the model to output information according to a template. First you need to load rules into the neural network, and then specify in the query when to use them. For example: “Divide the answer into three columns and fill the table using the following indicators and the template”.
  3. error identification. It is dangerous to copy the model’s answers without further verification. You can ask the neural network to cite sources and facts on the basis of which it compiled the answer. And it is also able to ask clarifying questions, they will help the user to correct the promt and get a more accurate result.
  4. Improving hints. Sometimes the model refuses to answer. Then you can use different techniques to bypass its limitations. For example, for the query “specify motives in education of teenagers” it gives five main points. And when the user asks to specify them, it says that there is no information. To break through this barrier, you should talk to the neural network and let it ask clarifying questions.
  5. Interaction. This category may include tasks where you need to generate an infinite number of marketing slogans or creatives according to a certain rule. To avoid inserting a template every time, you can say to the model, “Generate answers for me non-stop according to the given rule.”
  6. Context management. This comes in handy when you need to exclude certain sources from your answer. For example, you are researching the Russian audience and don’t want to see information about people from other countries. Then you can set a condition to the neural network: “Prepare me an answer without including foreign sources”. This cuts out unnecessary context, and the model produces a result that takes into account the data that is important to the user.

What is important to remember when compiling promts

The main mistake of a beginner is to completely rely on the neural network’s response and not to include critical thinking. It is important to always evaluate the model’s answers and properly filter the content.

For example, ask it to provide the facts it relies on. If you are not an expert in the researched area and don’t understand if a fact is good or not, then you need to additionally check the information in other sources.

Sometimes you can find logical inconsistencies within an answer without additional factchecking. If you ask the model to show the algorithm of solving the problem step by step and describe the result at each step, it will become clear at what point the neural network makes a mistake.