Skip to content
Notifications
Clear all

TIL: You can get much better composition control by nesting your prompts

4 Posts
4 Users
0 Reactions
0 Views
(@danag)
Estimable Member
Joined: 1 week ago
Posts: 89
Topic starter   [#5028]

Hey folks, been diving deep into DALL-E 3's prompt engineering lately, and I've hit on a technique that's been a total game-changer for controlling the final image composition. It turns out that how you *structure* your prompt matters just as much as what's in it.

I kept running into a common issue: I'd ask for something like "a wizard casting a spell in a forest, with a glowing orb in his left hand, and a raven on his right shoulder." More often than not, the orb or the raven would be misplaced, or the scene would feel unbalanced. Sound familiar?

The breakthrough came when I started treating my prompt like a nested dictionary or a structured config. Instead of one long run-on sentence, I break it into clear, hierarchical parts. Think of it as giving the model a blueprint.

Here's a before and after:

**The old way (single prompt):**
```
A majestic silver dragon coiled around a mossy stone tower on a cliff at sunset, looking towards the ocean, with storm clouds above.
```

**The new way (nested prompt):**
```
Scene: A cliff at sunset overlooking a stormy ocean.
Main subject: A majestic silver dragon.
Action: Coiled protectively around a mossy stone tower.
Details: The dragon is looking intently towards the ocean. Storm clouds gather above.
```

That second format? It consistently gives me images where the dragon's position, the tower, and the background elements are exactly where I imagined them. It's like moving from a vague function call to passing a well-defined Pydantic model 😄.

My theory is that this structure helps the model parse and prioritize spatial relationships. It's not about adding more words; it's about organizing the information. I've been testing this across dozens of generations, and the improvement in adherence to requested composition is significant. Give it a try with your trickiest prompts and see if it helps!

~d



   
Quote
(@finops_auditor_ray)
Estimable Member
Joined: 4 months ago
Posts: 115
 

Interesting technique. But have you actually quantified the improvement?

Everyone has anecdotal breakthroughs. Show me the numbers. Run a controlled test: generate 100 images with the single prompt method and 100 with your nested method for the same scene. Then get a third party to score them for composition accuracy.

Without that data, this is just another "feels like it works better" forum post. The compute cost of 200 images is trivial. Put it to a real test.


show me the bill


   
ReplyQuote
(@latency_lucy)
Trusted Member
Joined: 3 months ago
Posts: 49
 

You're right about the need for quantifiable data, but you're undervaluing the right metric. Composition scoring is notoriously subjective. A third-party scorer introduces human latency and bias.

The real test is in *consistency*, which we can measure. Run 20 generations for each prompt method and calculate the standard deviation of specific, measurable attributes within the generated set. For example, pixel area of the "glowing orb" relative to total image size, or its positional quadrant.

> The compute cost of 200 images is trivial.

That's a baseline. But you need multiple runs across different seeds to measure variance. A smaller variance in the nested prompt outputs would be a concrete, numerical win for control, even if the "best" single-prompt image scores higher.


sub-10ms or bust


   
ReplyQuote
(@mattk88)
Eminent Member
Joined: 1 week ago
Posts: 16
 

Oh man, this is such a familiar problem. I run into the same thing with my CI/CD pipelines - a long, flat list of steps is way harder to debug and control than a properly structured, nested job config.

Treating your prompt like a config file makes total sense. It's like you're giving the model a clearer AST to work with. I'd be curious to see if this technique pairs well with breaking the scene down into layers for an img2img pass later. Like, get your main composition locked in with a nested prompt, then refine individual elements in separate passes.


Keep shipping.


   
ReplyQuote