Introduction

In this lesson, we will explore how to communicate effectively with Large Language Models (LLMs) to achieve specific stylistic outcomes in our prompts. Mastering this skill is crucial for crafting prompts that generate more tailored, precise, and consistent results. Whether your goal is to create professional documents, imaginative stories, or anything in between, understanding style specifications will enhance your prompt engineering capabilities.

Understanding Style Specification

Imagine style specification as the process of giving instructions to a highly skilled chef. Just as you would specify your wish for your steak's doneness, you can guide LLMs in producing the "flavor" of text you desire. The style can encompass various elements, including tone (formal, informal), language (simple, technical), and length (brief, detailed), among others.

For example:

Markdown
__ASK__
Generate a motivational quote for a team newsletter. 

__STYLE__
- Tone: uplifting and visionary. 
- Language: simple and accessible. 
- Length: short.

Returns:

"In every challenge lies an opportunity to grow stronger together. Let's embrace our journey with courage and unite our efforts toward a future filled with success. Remember, the strength of the team is each individual member, and the strength of each member is the team."

If you simply remove the Length: short part from the prompt, you get a noticeably different output:

"Alone we can do so little; together we can do so much. Let's harness our collective strengths, dreams, and ambitions. Every challenge we face is an opportunity to grow stronger, together. Remember, it's not just about reaching the top; it's about the journey we share and the bonds we build. Let's move forward, hand in hand, towards our shared vision. Because when we unite, there's nothing we can't achieve."

The Role of Tone in Prompts

Tone plays a significant role in determining the perception of your prompts and the type of responses you receive. Setting an explicit tone helps guide the LLM towards generating responses that align with the emotional or professional context you aim for.

Example:

Markdown
__ASK__
Write a brief overview of renewable energy sources. 

__STYLE__
Tone: Informative but easy to understand.

The tone instruction in this example prompts the LLM to balance professional information delivery with accessibility, ensuring that the content is not too technical for the audience.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal