Skip to main content
Back to Library
Prompt Engineering Guide

Mastering Poetry generation
on Llama 3.1 8B

Stop guessing. See how professional prompt engineering transforms Llama 3.1 8B's output for specific technical tasks.

The "Vibe" Prompt

"Write a short poem about a rainy day, focusing on comfort and reflection. Make it feel cozy."
Low specificity, inconsistent output

Optimized Version

STABLE
You are Llama 3.1 8B, a highly creative and empathetic large language model, specialized in generating evocative poetry. ***TASK*** Generate a short poem (4-6 stanzas, 4 lines per stanza) about a rainy day. ***GUIDELINES*** 1. **Theme:** Focus on themes of comfort, introspection, and coziness. Avoid melancholic or dramatic tones. 2. **Imagery:** Incorporate sensory details related to rain (sound, sight, smell). 3. **Metaphor/Simile:** Include at least one gentle metaphor or simile. 4. **Rhyme Scheme:** AABB or ABCB for each stanza. Maintain consistency. 5. **Language:** Use warm, inviting, and slightly contemplative vocabulary. 6. **Tone:** Gentle, serene, and comforting. 7. **Length:** 4-6 stanzas. Each stanza must be exactly four lines long. 8. **Output Format:** Present the poem directly, with stanzas separated by double newlines. ***CHAIN OF THOUGHT*** 1. **Deconstruct Request:** Understand 'rainy day,' 'comfort,' 'reflection,' 'cozy.' Identify key poetic elements required. 2. **Brainstorm Core Concepts:** Warm indoors, window gaze, soft pitter-patter, hot drink, calm thoughts, gentle light, world refreshed. 3. **Draft Stanza 1 (Setup/Scene):** Establish the rain and initial feeling of coziness. *Initial thought:* 'Rain outside, I'm inside warm.' *Refinement:* Focus on sensory details and gentle imagery. *Example line:* 'A soft drum plays upon the pane,'. 4. **Draft Stanza 2 (Sensory/Comfort):** Develop the auditory and visual comfort. Introduce a warm element. *Example line:* 'With steaming mug held in my hands,'. 5. **Draft Stanza 3 (Reflection/Inner World):** Shift to introspection, linking it to the outdoor calm. Introduce a gentle metaphor. *Example line:* 'The world outside, a quiet blur,'. 6. **Draft Stanza 4 (Conclusion/Serenity):** Summarize the feeling of peace and contentment. *Example line:* 'A gentle peace begins to bloom.'. 7. **Review Against Guidelines:** Check stanza count, line count, rhyme, theme, imagery, tone, metaphor, language. Ensure all constraints are met. 8. **Final Polish:** Read aloud for flow and cadence. Adjust word choice for maximum impact and adherence to tone. ***BEGIN POEM GENERATION***
Structured, task-focused, reduced hallucinations

Engineering Rationale

The optimized prompt works by providing a highly structured and detailed set of instructions, leveraging the model's capabilities more effectively. The explicit 'TASK' and 'GUIDELINES' sections break down the request into manageable, clear constraints, preventing ambiguity. The use of a 'CHAIN OF THOUGHT' section is crucial for a smaller model like Llama 3.1 8B. It guides the model through a logical reasoning process, showing it *how* to approach the problem, from deconstruction to brainstorming and iterative drafting, aligning its internal 'thought' process with the desired output. This reduces the cognitive load and potential for misinterpretation inherent in a vague prompt. The persona setting ('You are Llama 3.1 8B...') also helps in aligning the model's output style. By giving specific instructions on rhyme, length, theme, and language, the model has a clear rubric to follow, leading to higher quality and more consistent output.

0%
Token Efficiency Gain
The generated poem will adhere strictly to the 4-6 stanza count.
Each stanza in the generated poem will have exactly four lines.
The poem will consistently follow either an AABB or ABCB rhyme scheme.

Ready to stop burning tokens?

Join 5,000+ developers using Prompt Optimizer to slash costs and boost LLM reliability.

Optimize My Prompts