BishopPhillips
BishopPhillips
BPC Home BPC AI Topic Home BPC RiskManager BPC SurveyManager BPC RiskWiki Learn HTML 5 and CSS Enquiry

LARGE LANGUAGE MODELS - Prompt Engineering

Control Codes
AI Revolution

ChatGPT control codes are special tokens that can be inserted into prompts to modify the behavior of LLMs. They can be used to control the style, tone, or content of generated text.

One of the most commonly used control codes is the temperature parameter. The temperature parameter controls the randomness of the generated text. A higher temperature value will result in more random and diverse outputs, while a lower temperature value will result in more predictable and conservative outputs. Higher values may be less coherent and less “honest”, with a tendency for the LLM to invent stuff where it can’t find a source for the answer. The temperature settings work like this:

  • Low – (0.0.-0.3) Focussed, coherent, restrained in creativity, most likely to be supported directly by the training data set. Text may be quite stilted.
  • Medium, or Balanced – (0.3 – 0.7) A fair balance between creativity and coherence. Text flows better and there is an air of creativity. A good level to choose for a human-like response
  • High – (0.7 – 1) Highly creative and diverse, but likely to be fantasy and possibly less coherent or relevant to the topic.

Another commonly used control code is the max tokens parameter. The max tokens parameter controls the length of the generated text, controlling the verbosity of the output. It specifies the maximum number of tokens (words or symbols) that can be generated in response to a prompt. This can also be achieved by simply directing the LLM to generate an output of n words, eg. “write a 1000 word essay on…”.

The diversity_penalty is a parameter ranging from 0 to 2. It penalises tokens that have already appeared in the response, helping the output to be more diverse in its word choice. Higher values lead to more diverse text, while lower values have more repetitive phrases.

The top p parameter is another control code that can be used to control the diversity of generated text. It specifies a probability threshold for generating each token in the output. Tokens with probabilities below this threshold are discarded, resulting in more diverse outputs. It sets the probability mass cutoff for token sampling affecting the breadth of options the AI considers. Higher values lead to more randomness while lower values result in more focussed outputs.

Here are some example prompts using ChatGPT control codes:

  1. Generate a paragraph about artificial intelligence with a temperature of 0.5.
  2. Generate a list of 10 bullet points about machine learning with a max tokens value of 50.
  3. Generate a tweet about deep learning with a temperature of 1.0 and a top p value of 0.9.

These prompts demonstrate how control codes can be used to generate specific types of outputs from LLMs. By experimenting with different control codes and parameters, prompt engineers can fine-tune LLMs to generate high-quality and relevant outputs.


...LLM Templates for Prompt Engineering....
 

Overview of LLM Solutions

Bishop Phillips

References