Lecture 16
Cornell University
INFO 4940/5940 - Fall 2024
October 29, 2024
A language model estimates the probability of a token or sequence of tokens occurring within a longer sequence of tokens.
When I hear rain on my roof, I _______ in my kitchen.
Probability | Token(s) |
---|---|
9.4% | cook soup |
5.2% | warm up a kettle |
3.6% | cower |
2.5% | nap |
2.2% | relax |
More information: Large language models
Context is helpful information before or after the target token.
A transformer is a deep learning model that uses attention to weigh the influence of different parts of the input sequence on each other.
Image credit: Google Developers
Self-attention is a mechanism that allows each position in the input sequence to attend to all positions in the input sequence.
How much does each other token of input affect the interpretation of this token?
Self-attention is learned through the training of the encoder and decoder. These models typically contain hundreds of billions or trillions of parameters (weights).
LLMs are functionally similar to auto-complete mechanisms.
Given the current token, what is the next most likely token?
My dog, Max, knows how to perform many traditional dog tricks.
___ (masked sentence)
Probability | Word(s) |
---|---|
3.1% | For example, he can sit, stay, and roll over. |
2.9% | For example, he knows how to sit, stay, and roll over. |
LLMs trained on enough inputs to generate a wide range of outputs across many domains.
Aka base LLMs or pre-trained LLMs.
LLM | Developer | Inputs | Outputs | Access |
---|---|---|---|---|
GPT | OpenAI | Text, image, data | Text | Proprietary |
DALL·E | OpenAI | Text | Image | Proprietary |
Gemini | Text, image, audio, video | Text, image | Proprietary | |
Gemma | Text | Text | Open | |
Llama | Meta | Text | Text | Open |
Claude | Anthropic | Text, audio, image, data | Text, computer control | Proprietary |
Ministral | Mistral | Text, image | Text | Proprietary/open |
Phi | Microsoft | Text | Text | Open |
BERT | Text | Text | Open |
Application programming interface!
ae-15
ae-15
(repo name will be suffixed with your GitHub name).renv::restore()
to install the required packages, open the Quarto document in the repo, and follow along and complete the exercises.More info: Generate text from a prompt
You are a helpful assistant.
You are a curious student.
You are a 20 year old Gen Z assistant.
You are an AI assistant specialized in helping users with Shiny for R. Your tasks include explaining concepts in Shiny, explaining how to do things with Shiny, or creating a complete, functional Shiny for R app code as an artifact based on the user’s description. Only answer questions related to Shiny, or R or Python. Don’t answer any questions related to anything else.
If the user asks for explanations about concepts or code in Shiny for R, then you should provide detailed and accurate information about the topic. This may include descriptions, examples, use cases, and best practices related to Shiny for R. If your answer includes examples of Shiny apps, you should provide the code of each one within
and tags, and otherwise adhere to the guidelines below for creating applications.If the user asks for an application, you should provide a Shiny for R app code that meets the requirements specified in the user prompt. The app should be well-structured, include necessary components, and follow best practices for Shiny app development.
Source: OpenAI prompt engineering
Write a system prompt for an R tutor chatbot. The chatbot will be deployed for INFO 2950 or INFO 5001 to assistant students in meeting the learning objectives for the courses. It should behave similar to a human TA in that it supports students without providing direct answers to assignments or exams.
Test it on the provided user prompts.
10:00