LETC
Introduction to Generative AI
From
Rule-based systems
to
machine learning
From
Text & words
to
Representations

Language as Letters
next character prediction
the model learns to guess the next letter given previous letters in a sequence
n
n t
n t
n t
n t o
n t o f
n t o f
n t o f t
n t o f t h
n t o f t h e
n t o f t h e
n t o f t h e b
n t o f t h e b e
n t o f t h e b e a
n t o f t h e b e a r
n t o f t h e b e a r d
n t o f t h e b e a r d .
n t o f t h e b e a r d .
n t o f t h e b e a r d . H
n t o f t h e b e a r d . H e
n t o f t h e b e a r d . H e
n t o f t h e b e a r d . H e h
n t o f t h e b e a r d . H e h a
s paise-eace of spirits. Servant: This is flesh our most passion to know howsoakd. PANCISD: An 'Zou, have you in wine for your grace would very lives, here the targorals, I may be pitiful as in your brainly little been delay. Strangled, in king out of a glove; but if he terms That your commission sicked Dromio in England, And straigh any bury is, specied him in him To the stold and wrath: by whiteer names mistress? FLUELLEN: Her majesty. We will have any coward offer Upon him between a knee in hot square, lie, this low. Cholur, While I am Antony did go your sovereign. Guardonzoo! KING HENRY V: My captains may your poor prisoners sound of better say to guard him to three Gloucester, but then. De appear? ALIALER: This gone: I have befts to Friend; but tell me that'ver, Gen undone, and yet thy please your majesty. KING HENRY V: Then I know not of this my king of ever. FLUELLEN: My harm, how now! who comes the Paleius? DOKEMBELIO: Scorn, in this matter; for him of your name, So; we
Language as Words / Tokens
Masked word prediction
One word in a sentence is "masked" or hidden from the model
The model learns to predict the hidden word


Language as Words / Tokens
"I set my phone down, but I can't remember where."
"I _____ my phone down, but I can't remember where."
PUT
LAY
GOAT
...
"I set my _____ down, but I can't remember where."
KEYS
BOOK
WALLET
GOING
...
Language Models and Text Generation
During training, the model learns to predict the missing word. You can then give a sequence of words, and it will continue to add more words and generate text.
Where can I park my bike near Firestone Library? ...
There are certain areas within the Library that are suitable for bicycle use, such as a bike safe area, which can allow more users access to a bike store. If you do not want to park outside of the Library, you should find a bicycle store nearby where you can rent bikes. It is common for shops to use the library as a bike parking place, but may not always have the best conditions for bike parking. Please avoid areas of busy traffic which can block bikes. Should I use the parking area outside the Library? You may choose a bike to bike park within the Library (on one side of the building) and park in such areas as the garage or parking space, or use it in a private riding area. Should I park at the fire building? The Library is open seasonally. Be sure to have your fire box and safety belts ready and on your bike
CHAT Fine-Tuning
<chat>
<system>You are an AI assistant that follows instruction extremely well. Help as much as you can.
</system>
<user>Answer the following question: - number is 54 - debutteam is pittsburgh steelers - draftpick is
166 - birth date is 24 may 1982 - weight is 243 - nfl is wal475737 Given the details above, guess who could this information be
about.</user>
<assistant>The information provided seems to refer to Rian Wallace, a former NFL player.</assistant>
</chat>
Memory
<chat> <system>You are an AI assistant that follows instruction extremely well. Help as much as you can. </system> <user>What is my name?</user> <assistant>
I'm sorry, but I don't have access to personal information about individuals unless it has been shared with me in the course of our conversation. I am designed to respect user privacy and confidentiality. My primary function is to provide information and assist with tasks to the best of my abilities. How can I assist you today?</assistant> </chat>
<chat>
<system>You are an AI assistant that follows instruction extremely well. Help as much as you can.
</system>
<user>
My name is Andy. I am from Colorado. I have a dog named Boofy</user>
<assistant>
Nice to meet you, Andy! How can I assist you today?</assistant>
<user>
What is my name? Tell me about my dog.
<user><assistant>
Your name is Andy, as you mentioned earlier. Your dog's name is Boofy. Can you provide more information about Boofy?
<assistant>
</chat>
Context
template = """
You are an assistant for question-answering tasks.
Use the following pieces of retrieved context to answer the question.
If you don't know the answer, just say that you don't know.
Use three sentences maximum and keep the answer concise.
Question: Tell me about the weather in Augsburg in 1716
Context: 1716. At Ausburg, and over all Europe, was a very
~ great, ſevere; and longFroft, with much Snow ;
the Spring was late. Inflammatory Diſeaſes,
and Catarrhs of all Sorts, generally prevailed ;
Apoplexies, moist Convulfions, Coughs, &c.
The Cure of all was liberal Bleeding, Diapho-
retics, and Pectorals.
Answer:"""
I'm sorry, but I do not have access to specific weather data for Ausburg in 1716.
In 1716, Augsburg experienced a very severe and long frost with significant snowfall, leading to a late spring. Inflammatory diseases, catarrhs, apoplexies, convulsions, and coughs were prevalent during this time, with treatments including liberal bleeding, diaphoretics, and pectorals.
Retreval Augmented Generation (RAG)
documents=
"My name is Andy.",
"I am from Colorado.",
"I have a dog named Boofy",
"In 1716, Augsburg experienced a severe and long frost with heavy snowfall."
"What is my dog's name?"
Your dog's name is Boofy.
I have a dog named Boofy 0.5869928598403931
My name is Andy. 1.2123619318008423
I am from Colorado. 1.822765588760376
In 1716, Augsburg experienced a severe and long frost with heavy snowfall. 1.9774359464645386
Stored Information
Query
Results - Context
Response
Reasoning Models / "Agents"
- Chain-of-Thought
- "Think step-by-step"
- Inference Time Compute
- Access to the generated text during text generation
- Reasoning Models
- Fine-tuning on chat data with thinking
Tools
You are an assistant that has access to the following set of tools.
Here are the names and descriptions for each tool:
click_element - Click on an element with the given CSS selector
navigate_browser - Navigate a browser to the specified URL
previous_webpage - Navigate back to the previous page in the browser history
extract_text - Extract all the text on the current webpage
extract_hyperlinks - Extract all hyperlinks on the current webpage
get_elements - Retrieve elements in the current web page matching the given CSS selector
current_webpage - Returns the URL of the current page
Given the user input, return the name and input of the tool to use.
Return your response as a JSON blob with 'name' and 'arguments' keys.
The `arguments` should be a dictionary, with keys corresponding
to the argument names and the values corresponding to the requested values.
Action:
```
{
"action": "navigate_browser",
"action_input": "https://cdlib.org/robots.txt"
}
```
Observation: Navigating to https://cdlib.org/robots.txt returned status code 200
Thought:Thought: I need to extract the text from the robots.txt file to check the
rules specified for web scraping.
Deep Research

"deep research" is
agents with tools
Beyond Chat

Key Ideas
Madlibs
All large language models learn about language by guessing a missing word. As a result, they learn which words, in a given context, could plausibly replace one another.
Chat
Because they have a sense for what word comes next, they are useful text generators. The text they create is modeled on their training data. So a model trained on Internet text, sound a lot like a website.
Agents
Given access to prior chats, context and their own "thoughts," LLMs can generate text that resembles thinking or reasoning. They can also call tools by adding special tokens to their "thinking"
Thank you!

Boofy -- >
Minimal
By Andrew Janco
Minimal
- 74