Team-GPT secures $4.5M led by True Ventures.

Constraints: Length, Tone, and Other Adjustments

LECTURE RESOURCES: Read this lecture in Team-GPT, it is interactive and contains notes and comments from the author.

Constraints are any instructions that cause the model to follow some rules.

Some call these adjustments, others: rules. Phrasing is not too important.

Introduction to Prompting with Constraints

To get a better idea, two of the most common constraints are:

  • Adjusting the length and
  • Changing tone of voice

Iโ€™ll start by providing an article as context. You can see the whole conversation with ChatGPT here.

Using Constraints for Summarization

The goal would be to summarize this article.

Note that summarization is one of the key use cases of ChatGPT.

But the summary is almost as long as the article!

Letโ€™s add a constraint: make it less than 100 words!

We are constraining it to make the text shorter. We are forcing ChatGPT to do so.

And voila! ChatGPT provides!

Adjusting Tone of Voice with Constraints

Another popular constraint (or adjustment) is the tone of voice.

If this is too serious for your purposes, you can always ask ChatGPT to rephrase in a friendly tone of voice.

You now know how to use two types of constraints: length and tone of voice.

Congrats!

Exploring Other Types of Constraints

In reality, you can pose other constraints, too.

Iโ€™ll use one of my favorite ones.

Start each word with the same letter: O.

OpenAI officially opens operations in optimal Dublin, Ireland! Obligations include operations, oversight and so on.

Kind of cool, right?

Note that GPT-3.5 fails miserably at this task, while GPT-4 is almost perfect.

This constraint was first shown by Greg Brockman, co-founder of OpenAI, during the official announcement of GPT-4.

Letโ€™s try the letter G. I think Greg did G as well.

Great news! OpenAI is going global, gearing up to grow in Dublin, Ireland!

This one is much harder and you can see that many of the words start with G but not all of them.

In such cases, it could be worth trying to prompt again.

Letโ€™s be super serious:

Every word should start with G.

This is extremely important.

Rephrase the text so that every word start with G! No words should start with anything other than the letter ‘G’.

Goodness gracious, OpenAI’s going global, galvanizing growth in grand Dublin, Ireland. Group’s goals? Guiding operations, governance,

Not bad.

๐Ÿ’ก This lesson is a part of the ChatGPT for Work course

The course is interactive, if you take it inside the Team-GPT platform.

ChatGPT for Work: The Interactive Course contains:

โ€ข 100+ tried and tested prompts
โ€ข 100+ exercises
โ€ข 100+ extra notes and comments
โ€ข 1000s of use cases
โ€ข PDFs files for later reference

It is also completely FREE.

Start today and become a ChatGPT expert in less than 7 days!

Now โ€˜write a limerickโ€™. A limerick is a humorous five-line poem with a rhyme scheme. This is a perfect example of a constraint.

In Dublin, OpenAI took its stand, In Ireland’s tech scene so grand. With AI advancement’s lure, Innovation will endure, As OpenAI and Ireland’s growth go hand in hand.

How about a haiku? A haiku is a Japanese poem of seventeen syllables.

OpenAI takes flight, In Dublin’s tech sphere, shines bright, AI’s future ignites.

Beautiful!

Now do a haiku where every word starts with O.

Imperfect because it is becoming extremely hard. If the constraint is too difficult, donโ€™t blame GPT.

At the end of the day, GPT is not only following your rules, but ALSO ensuring it is still making sense!

Wanna have some fun? You can try the same but with emojis only.

Fun but rather pointless, right?

What other constraints are there?

If you have 5 examples of constraints, can you think of a way to find more constraints?

Youโ€™ve seen this already: prompting by example.

Try to do this on your own, or check out reading 6.9. Other Constraints.

Over there I have defined the following context:

  1. Iโ€™m creating an online course about LLMs
  2. This video script as context
  3. The whole constraints chat as context, simply copy-pasted. No formatting is needed.

Iโ€™m pretty sure Iโ€™ve provided most of the meaningful context there is.

The Goal? What other constraints are there similar to those in the lecture?

There you have them.

There are numerous other constraints or rules that can be applied to guide the generation of responses by ChatGPT. Here are some examples:

Constraint TypeExamples
Formality LevelGenerate the sentence in a formal tone.
Temporal ConstraintsWrite a paragraph about technology in the 1980s.
Lexical ConstraintsWrite a joke without using the word ‘chicken’.
Genre or Style ConstraintsWrite a paragraph in the style of Edgar Allan Poe.
Vocabulary ConstraintsExplain quantum physics using only simple words.
Audience ConstraintsExplain the theory of relativity to a 10-year-old.
Structural ConstraintsWrite a six-word memoir.
Language ConstraintsTranslate the following sentence to French…

As usual, you can ask for 20 more and so on.

Please do the reading. You donโ€™t have to remember the constraints but it makes sense to know about them.

Thank you

Take ChatGPT for Work: The Interactive Course for FREE.

Updated on October 26, 2023