How I use underscores to get more out of my Midjourney_prompts

And how I peek into the AI’s brain with /shorten

Alex Tully
5 min readOct 3, 2023

Whatever the genre of images you create in Midjourney, one headache is always going to plague you: The AI can only digest a certain amount of information in a prompt. It’s not that there’s a hard limit on how many characters you can enter. But the longer you make your prompt, the more likely the bot is to start to ignore parts of it. The light might come in from a different angle to what you specified. Or even worse, the scene might be missing a key element you wanted.

One way to ameliorate this issue is to begin by generating the bare bones of the image that you want, then inpainting in all the features you want. I’ve demonstrated this for Tropical Zen Cave, Aurora Rice Cavates, Lava Lake from the South, and Apocalypse Catches Up.

But there’s another hack that you can use in conjunction with that: Use_underscores_between_words_in_prompts. To explain why this works, I need to explain what “tokens” are. If you already know this and what the /shorten function, then please scroll down to the line of asterisks. Otherwise please read on:

Anyway, Midjourney breaks your prompts down not into words but into “tokens”. It is the number of tokens that determines when Midjourney might start omitting details from your prompt. Sometimes a token correponds to one word, but sometimes it corresponds to a fragment of a word, and other times it can correspond to several. Fortunately you can see how the AI will parse your prompt by using the /shorten command, then clicking “Show Details”. As an example:

Screenshot from Midjourney
Screenshot from Midjourney
Screenshot from Midjourney

Each coloured line corresponds to one token. So in the above, the bot broke “Trump’s” down into two tokens, Trump and ‘s. But “in New York” is a single token. After each token there is a number between (0.00) and (1.00), known as the “weight”. This corresponds to how much importance the bot will give to that token when creating the image. As you can see in New York has a weight of 0.00, presumably because it’s redundant information (Trump’s tower is in New York and nowhere else). The longer your prompt is, the more likely Midjourney is to assign a weight of 0.00 to important keywords, especially later on in the prompt, which it will then ignore when making your image.

Now that we know this, please look at the below screenshot:

***************************************************************************

Screenshot from Midjourney

And compare it with its equivalent without underscores:

Screenshot from Midjourney

Joining the words together with underscores “fuses” them into one token. So if you do this enough, you can reduce the length of the prompt in the eyes of Midjourney, meaning that each token will tend to get a higher weight and be more likely to come out in your image.

We can see an example of that in the above two screenshots. In the prompt with underscores, desaturated_cold_tones has a weight of 0.06, while without underscores, desaturated has a weight of 0.01, cold has a weight of 0.04 and tones has a weight of 0.00.

And the results are evident when we runthe two prompts (with an aspect ratio of 16:9, — s 50 and — style raw). First with underscores:

Made in Midjourney (with underscores)

And below without underscores:

Made in Midjourney (without underscores)

Without the underscores, the images don’t really have the desaturation or the cool tones I was hoping for.

So_why_not_just_put_underscores_between_every_word_in_the_prompt? The thing to keep in mind is that, once you join two or more words with an underscore, Midjourney’s got to have an example of that exact combination in its training data. If it doesn’t, then it won’t give you that in the output.

So how do you know when you can get away with it? I use Google as a good proxy for what Midjourney will have in its training data. If I’m thinking of joining two words together with an underscore, I put those words together inside quotes (to limit Google to an exact match), together with one or more other words describing the type of image I want to make.

So when I was thinking about the underscore in high_horizon, I did this Google search:

Screenshot of Google search results

75,300 results came back, including many images. So I figured I was good with the underscore in high_horizon.

I did the same for desaturated_cold_tones

Screenshot of Google Search results

Only 9 results, but they included some images, so I guessed that I could link these three words with underscores.

But what about high_horizon_and_desaturated_cold_tones?

No results were found for that chunk of text inside quotes. This strongly suggested that high_horizon_and_desaturated_cold_tones would be no good in my Midjourney prompts. Running that in the prompt (with the other underscores) yielded:

Made in Midjourney

Now there are absolutely no desaturated cold tones at all. The photos have still got the high horizons, but I found that Midjourney gives me those even if I don’t specify it in the prompt e.g. if I run cavates in a cliff_face like Uplistsikhe or the Anasazi cliff_dwellings, sidelit by low_angle_sunlight, wide_angle aerial_photograph by Sony A7R II — ar 16:9 — s 50 — style raw — no railings
Then I get:

Made in Midjourney

I strongly recommend trying this out (as well as the /shorten function) if you haven’t already!

--

--

Alex Tully

Into Generative AI, but 100% Human-Written Blog (every word)・Bachelor’s in Maths・Master’s in Linguistics (@ANU 🇦🇺 )・Taught myself 🇯🇵 and 🇹🇭・Digital Nomad