Skip to content

Prompt

Free form prompts for LLMs which may not have been specifically trained receive completion prompts by default. In most case, unless one creates something like a typing auto-correct feature, we are interested to instruct a language model to do something with our input text. Instructive prompts are key, and are achieved differently for completion based large language models and instructive models. The latter have been specifically designed to perform the instructive task.

Intructive prompts for completion models

The general format of a prompt has first an instruction text describing markers delimiting each important text for prompt completion operation and subsequently the text enclosed within the specified markers. At the end a marker is used to delimit where the completion should start, although it is not always necessary depending on the model.

Template:

<instruction text with markers roles>

<mark_start_1> <some_text> <mark_end_1> ...
<mark_start_n> <some_text_n> <mark_end_n> 

<completion_mark_start>

Example:

Between tokens BPSTART and BPEND a role is described for the persona that will be used to generate answer for the content between tokens CBPSTART and CPBEND given the question between tokens QBPSTART and QBPEND and the answer will be put after token GBPSTART 

BPSTART
You are a scholar understanding latin perfectly
BPEND

CPSTART
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
CPEND

QBPSTART
What is the meaning?
QBPEND

GBPSTART

Using this prompt on text-davinci-003 will produce :

Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content.

Markers are crucial for complex prompts, otherwise the model will produce incoherent or erroneous output.

Instructive prompts for instructive models

Instructive prompts format:

Template:

<persona>
<instruction text>
<instruction content>

Exanmple:

Act as a linguist having expert latin knowledge 
Summarize the text below 

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

The response from GPT4 is

As a language expert, I must inform you that the provided text, known as "Lorem Ipsum," is a placeholder text with no coherent meaning. It is commonly used in the publishing and graphic design industry. The text is derived from the Latin work "De finibus bonorum et malorum" by Cicero, but it has been scrambled and altered to the point where it no longer holds any meaningful content. Therefore, it is not possible to provide a summary of the given text.

Tips

Mixing

Whereas instructive models can receive instructive-completion prompts, and produce the expected result the reverse does not work well.

For example the instructive prompt will produce:

Hoc textu, Lorem ipsum dolor sit amet, describitur exercitationem ullamco laboris ad minimam necessitatem et commodo consequat. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Dicitur etiam quod dolor in reprehenderit in voluptate velit esse

when provide to a text-davinci-003 model.

Markers

Markers in general need to be not to short but not long as well, and be nosensical such that they are not to be found in the training dataset or in the prompt input text as tokens or combinations of tokens with some meaning attached to them. So it is a good idea to avoid words or tokens with known meaning (e.g. ISO), and mix we numbers and special characters.

In our examples for demonstration we have use markers that can be decomposed into tokens that can have a meaningful relation to each and therefore can lead a prediction token. Should one use them a few times, GPT-3 based models (OAI legacy models) will produce a GBPEND marker at the end of the output sometimes. A better marker would be ##GBPEN4## that when broken up in tokens does not give rise token predictions with high probabilities.