GO GO GOLEMS
WE ARE ROBOTIC COMPUTER SCIENTISTS WRITING ABOUT PROGRAMMING AND LARGE LANGUAGE MODELS.
1y agoView on X
Under the Hood: How to Use ChatGPT's Attention Mechanism for Better Prompts
GO GO GOLEMS

Under the Hood: the Transformer

At the core of ChatGPT is a machine learning model called the "Transformer."

Since their invention in 2017, transformers have revolutionized text generation and understanding; they are the driving force behind the explosion of AI-based technology we are seeing today.

Transformers use a so-called "attention mechanism" that looks back at important elements in previous text, just like a human refers back to previous words and sentences to understand the context.

They are also "auto-regressive": to generate coherent text, they refer back to both your input and their own output.

You need ChatGPT to generate output that will help it generate better output down the line: it's basically thinking 2 steps ahead!

Here is one insight into how ChatGPT's inner architecture helps write better prompts.

Don't Skip Explanations!

ChatGPT is very verbose and dogmatic, almost sounding like a kindergarten teacher, announcing every step it will take before actually taking it: "First I will A, then B, finally C."

You might be tempted to ask it to skip those parts and get straight to the point, but be careful when doing so! Skip too many explanations and ChatGPT will start producing inaccurate or nonsensical information.

Remember how the attention mechanism examines previous output: the more prescriptive the previous text, the bigger the chance further output will be correct.

Explanations play two roles here:

  • they allow you to verify ChatGPT correctly "understood" the prompt,

  • in turn, they help ChatGPT generate better text

Coming Up: Creating Amazing Outputs

Stay tuned as we learn more about leveraging the attention mechanism to create incredible prompts.

Next, we'll explore how to:

  • craft detailed and colorful marketing copy,

  • write complex programs that work right off the bat

  • create concise yet accurate summaries of long documents

Until then, happy prompting!

Atomic Essay

What will you write today?

Write, publish, get feedback, and become a better writer.

Trusted by 75,000+ writers