How To Control Length of AI-Generated Text

This is how you do it...

Do you remember your high school days?

You had to write 800-word long essay…

And your essay only had 600 words, you’d fail. If it had 799 words, you’d fail.

The only way to pass was to submit an essay with at least 800 words.

I wish AI would work like this, but it doesn’t. For some reason, it doesn’t care about our length requirement.

You can try saying how many words it should have. How many characters it should include. But the result is still a couple words short.

Many people get frustrated about this problem, so I’m trying to crack it.

Here it goes…

Controlling the length of AI-generated text

We already know that tools like ChatGPT, Claude, or Gemini can’t understand the numbers very well.

I hope this is going to change in the future. But for now, we need to try something hacky.

And the hacky way I’m trying is to control the length of AI-generated text by using different adjectives.

These adjectives will represent different kinds of length.

1/ Getting length modifiers

So I need 10 different adjectives because in my vocabulary there are only “short“ and “long”.

I could dig into books, but the better way is to ask ChatGPT. And that’s exactly what I did.

Getting a list of adjectives

After some conversation, I had 10 adjectives I could try.

Length modifying adjectives:

  1. Brief

  2. Concise

  3. Short

  4. Compact

  5. Moderate

  6. Medium-length

  7. Extended

  8. Long

  9. Lengthy

  10. Voluminous

It’s worth noting that they’re sorted from the shortest to the longest.

2/ Doing an experiment

Now that I have the data, I want to use it to collect some results. Here’s the experiment I’m doing.

I’ll use the following prompt template.

Prompt template

I’ll use the same template, replacing the “length modifier“ with the length adjectives.

I’ll run the prompt with each adjective 100 times and calculate an average response length.

Seems like a lot of work? It’s not! I wrote a script that automates all of that.

3/ The results

And now for the thing you’ve been waiting for. Here are the results.

Length modifiers sorted by response length

As you can see, “concise” will give you the shortest results possible.

And if you’re looking for a long response, “lengthy” will do the trick.

4/ My thoughts

It’s fascinating how a slight change in 1 word can change the response length.

But it’s AI, a black box we don’t understand. And the best way to learn is by doing experiments like this.

If you’d like to see me doing more stuff like this, reply with “Hell yeah!“

ChatGPT Prompts of the Week

All of them are available in our FREE prompt directory.

Psst: Do you want me to cover a specific use case? Hit “reply“ and let me know. If not, let’s have some laughs together.

Memes of the Week

If The Rock and Emma Stone had a baby

Prompt engineering still going strong

Keeping up with AI news is tough

And Now, Let’s Hear It!

What do you think of today's edition?

Login or Subscribe to participate in polls.

Reply

or to participate.