What You Need to Know re LLMs to Use Them More Productively

Understand the tech behind ChatGPT – also as a non-technical person
February 1, 2024
Steffen Huß

Over 100 million people use ChatGPT. However, only few understand how such AI actually works. And that's perfectly fine to start with: you don't need to know the details of how a car works to drive it from start to finish.

Nevertheless, it's helpful to grasp the basics of a technology to achieve better results – and this is no different with Large Language Models like ChatGPT. So, let's briefly explain how Large Language Models (LLMs) generate text and how this knowledge can help us write better prompts.

Step 1: Next-Word Prediction

At its core, an LLM today has a very simple task: to predict the next word in a text as accurately as possible. In a text like:

The catcher in the

a good LLM should predict the word:

rye

This is fundamentally no different from, say, the predictive text function on a smartphone’s keyboard, which also guesses how a text might continue. The difference lies in the scale: An LLM contains enormous amounts of data and immense computational power – even for an older model like GPT-3, a suitable, quite powerful PC would have to compute for about 350 years (OpenAI no longer publishes figures for newer models).

To optimally predict the next word, an LLM looks at large amounts of text and learns patterns from it. Thus, it will realise that the words “The catcher in the” are very often followed by the word “rye” and therefore consider “rye” a good prediction.

With a bit more text, it will also learn grammatical rules. Only when a model has learned the concept of grammatical gender can it correctly predict that after:

I read the book and liked

an

it

is more likely to follow, and not a “she”, “her”, or “him”.

And with even more text, the model will eventually learn more abstract concepts such as language style. In this way, it can then predict that after:

Reading that book, I found great

the contemporary "fun" is unlikely to follow, but rather the more archaic:

pleasure.

Summary so far: LLMs learn to predict the next word of a text. For this prediction, they acquire factual knowledge, grammatical rules, and abstract concepts.

Step 2: Reinforcement Learning from Human Feedback

It may sound surprising that an LLM essentially tries to predict the next word. After all, ChatGPT doesn't complete texts, it conducts dialogues. This is due to a second step: After an LLM has learned factual knowledge and concepts from large amounts of text, it is then trained to respond as helpfully as possible.

For this, the LLM creates several response texts for a specific text. A response text is generated, simply put, by predicting the next word, then the next one after that, and so on, until the response text is complete. These response texts are then presented to real people who evaluate the quality of the responses.

An early-stage response text for the prompt:

Name the six characteristics of careful bookkeeping.

might read:

Name the 4 basic principles of effective teamwork and briefly explain their significance.

What happened here? Obviously, the LLM saw many exams during training. And in an exam, the next task typically follows one task, not the solution. Since this text continuation is not helpful, it will likely be poorly rated by a human.

However, the LLM can also create additional response texts. For example, by continuing not with the most likely next word, but with the second most likely. Then a response text might look like this:

The essential characteristics of careful bookkeeping are completeness, accuracy, timeliness, clarity and overview, as well as consistency.

A continuation in this style could have been learned by the LLM from a solution book for exams. A human would probably rate this response text higher. And from these ratings, the LLM can learn which response texts are preferred by humans. With this knowledge, it will continue the question text more with higher-rated response texts – in this case, it will learn to respond to questions with a solution, not with another question.

Only in this second step important functions, such as answering truthfully, responding politely, and various safety measures (i.e., not revealing the plan to build a bomb even on pleading request) are learned, and this as some interesting consequences for writing better prompts. We will explore them in one of the next articles of this series.

Keen to learn more about LLMs? Start your organisation's AI journey via our AI Literacy Program >

The image depicts the sculpture "The ChatGPT user of Melos" and was created with the assistance of AI.

Weitere Informationen

Alle anzeigen
Three NodeMasters co-founders (Thom, Steffen & Wolfgang) stood in a line in front of an exposed concrete background, dressed in sweaters and white shirts, smiling at the camera.

So können wir helfen

Ob erstes Digitalisierungsprojekt oder kompetente Unterstützung mit bestehenden Technologien – wir helfen gerne!