Visualizing the Effects of Prompt Reordering and Punctuation in AI Prompts using AI Art
Large Language Models (LLMs) inherently exhibit biases, but there are strategies to take advantages of these biases.
One effective approach is prompt reordering — a seemingly minor adjustment that has proven impactful, as demonstrated in our AI art experiment. Additionally, precise punctuation choices subtly influence how the model interprets input, leading to variations in response direction and emphasis.
A Quick Intro to Attention
Attention mechanisms are the core component that determines how AI models prioritize different parts of input prompts:
.Token Weighting: When processing a prompt, the model assigns "attention weights" to each token (word or word piece), determining its relative importance.
Context-Dependent Processing: Unlike earlier models that processed words in isolation, modern attention-based models evaluate relationships between all words in a prompt simultaneously.
Position Sensitivity: The position of words in a prompt affects how attention is distributed. Words at the beginning and end of prompts often receive different weights than those in the middle. This is called the ‘primacy’ effect.
The Role of Punctuation and Connecting Language
Punctuation and connecting words significantly influence how AI models interpret relationships between concepts, with commas acting as soft boundaries that segment prompts into distinct units, affecting hierarchical structure and prioritization. Phrases wrapped between commas are more likely to be treated as unified concepts instead separate concepts which require separate interpretation.
Variations in punctuation — such as commas versus semicolons — alter how ideas are grouped, while explicit relationship definitions using phrases like “X with Y” enhance clarity in AI-generated outputs. This is in stark contrast to X,Y which separates the phrases in the eyes of the LLM.
These are subtle nuances that you might underrate but they can lead to substantially varied responses.
Practical Demonstrations with Image Generation
To illustrate the impact of word placement, we generated several images using identical content with different word arrangements:
Original prompt:
"Gothic, Neo-Dada of sinister tendrils, unseen forces, labyrinthine virus influenced by Zdzisław Beksiński, Shusaku Arakawa, Spiral, Diagonal arrangement, and Deep purples, sickly greens, and inky blacks
Reordering 1 - Structure and Color First:
"Spiral, Diagonal arrangement with Deep purples, sickly greens, and inky blacks, sinister tendrils of unseen forces, labyrinthine virus, Gothic Neo-Dada influenced by Zdzisław Beksiński and Shusaku Arakawa"
Reordering 2 - Color and Subject First:
"Deep purples, sickly greens, and inky blacks, labyrinthine virus with sinister tendrils, unseen forces in Diagonal arrangement, Spiral patterns, influenced by Zdzisław Beksiński, Shusaku Arakawa, Gothic Neo-Dada style"
Why the Last Image Shows More Artistic and Detailed Spirals
1. Colour-First Approach
Starting with “Deep purples, sickly greens, and inky blacks” established a rich colour palette immediately. This prioritization caused the model to:
Apply these colours with greater emphasis throughout the entire composition
Create more pronounced colour contrast that enhances the visual definition of the spiral
Establish a mood and atmosphere that supports the artistic rendering of organic structures
2. Integrated Subject Description
In the third prompt, the elements “labyrinthine virus with sinister tendrils” are directly connected through the preposition “with” rather than separated by commas. This integration:
Creates a unified concept rather than separate elements
Encourages the model to render these features as interconnected parts of a whole instead of as separate image elements.
Results in more coherent structural complexity
3. Strategic Placement of “Spiral patterns”
In the third prompt, “Spiral patterns” appears after establishing colours, subject matter, and arrangement, but before artistic influences. This placement:
“Deep purples, sickly greens, and inky blacks, labyrinthine virus with sinister tendrils, unseen forces in Diagonal arrangement, Spiral patterns, influenced by Zdzisław Beksiński, Shusaku Arakawa, Gothic Neo-Dada style”
•Allows the spiral to be informed by the previously established elements
•Positions it as a central organizing principle rather than just one element among many
•Creates a natural focal point for the composition
4. Artist References as Stylistic Modifiers
Placing the artist references (Beksiński and Arakawa) toward the end of the prompt:
•Applies their distinctive artistic styles to an already well-defined structure
•Encourages the model to use their techniques for rendering detail rather than overall composition
•Results in more intricate texturing and atmospheric qualities
Conclusion
The effects of both prompt reordering can be immensely interesting to diagnose especially using ai art as a means to visualize the effects. Whether the hypothesis will hold for other prompt applications such as general productivity prompting is another area of research we will possibly explore in the future.
With LLMs becoming more attention-efficient, the need for the techniques discussed perhaps will not be required but models will always need to rank the contents of a prompt to provide the most impactful and relevant response.
With that said, its clear to see that the ordering of your prompt is just as important as the contents of your prompt.
About Asycd
Asycd is an innovative AI research start up specialized in prompt engineering and model development for content creation. Our work extends past of the barriers of technology as we explore societal problems that may arise from technology advancements. For instance, generative AI has the power to rid of us of our capacity to think independently and effectively. Such laziness is something we will explore in our next article potentially due to its recent relevance.