Your First AI Lesson Starts With “Peanut Butter and…”
Peanut butter and…
Did you say jelly? Fair guess. Now try it with a little more to go on. “Dear Grandma, the banana slices you tucked into my lunch were just right. You know how much I love peanut butter and…” Same three words at the end. Did you reach for the same filling?
That little game is a way into the kind of artificial intelligence that writes back when you open a chatbot. At its heart is a language model, a program trained to predict what piece of text might come next. To see how far that idea can go, stay at the kitchen table for a minute.
A guessing game with its own answer key
Suppose the whole letter is already on the page. Cover the word after sliced with your thumb. Make your guess, then lift your thumb. Whatever the letter actually says gives you an answer to check. You can play again one word farther down the page.
Written language gives a computer the same opportunity on a much bigger scale. It can practice on passages where the next part has already been written. Each time, its training software checks the chance the model gave the piece that really came next. The software adjusts numbers inside the model so that, across many examples, its guesses improve. Nobody needs to sit beside it filling out an answer key for each sentence. TensorFlow walks through training a small text generator this way.
The machine’s pieces are called tokens. A token can be a whole word, part of a word or a mark on the page. Computers use numbers to keep track of the pieces. Different models can slice the same phrase in different places. For our sandwich game, whole words will do.
Grandma gets a vote
Imagine giving ten people just “peanut butter and.” Seven might say jelly, two might say honey, and one might say pickles. Those are made-up numbers, though somebody in that kitchen deserves a follow-up question.
A language model also puts different chances on different endings. It can sometimes pick an ending that ranked below the favorite. Once it picks, that choice joins the text it uses for the next guess. Choose banana and slices might follow. Choose jelly and the guesses head in a different direction. That’s one reason the same question can get two perfectly sensible answers. Hugging Face shows how choosing among likely pieces changes a reply.
The interesting part comes when the clue sits a whole sentence away. Keep the last few words exactly the same and change the start of the letter. “Grandma, the strawberry patch is ripe” gives the model different clues from “Grandma, we’ve got two bananas going brown.” A good guess draws on what came earlier, just as yours did.
From finishing a sentence to taking a request
Now ask for something different. “Write Grandma a thank-you note in two sentences.” To give a useful answer, a chatbot needs to recognize that this is a request and that two sentences is a limit.
Developers can give a language model extra practice with requests and examples of good replies. They can also have people compare two replies and use those preferences to guide training. Given your request, the model is then more likely to start a note with “Dear Grandma” and less likely to keep listing sandwich fillings. Researchers tested this approach with human feedback.
One last round. What kind of jelly did Grandma put in your sandwich yesterday? A model could give you a lovely sentence about strawberries. If nobody told it what was in the jar, that detail is a guess. Knowing how to finish a sentence gets the machine through an impressive range of jobs. For this one, Grandma still has the answer.
QUOTE:
"Amateurs hack systems, professionals hack people."