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.


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.


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