AI language models
as a teaching tool
Sebastiaan Mathôt | cogsci.nl/smathot | s.mathot@rug.nl | leiden university | june 20 2024
Our mission for the next 90 min
To learn
I will argue that it is important to build our own LLM-based education tools so that we can use this technology on our own terms
And tell you about our efforts in Groningen to make this happen (+ open invitation to join forces)
Introduction to large language models
According to GPT4, this is how it functions on the inside
What is a large language model?
Software that takes a sequence of words (“tokens”) and predicts the next word
This prediction is added to the input (“autoregression”), and then the next word is predicted, and so forth
Using very large “transformer” neural networks
Tokens and embeddings
Text is segmented into meaningful chunks, or “tokens”
Each token is represented as an “embedding”
Tokens and embeddings
Positional encoding
Tokens are processed independently
To overcome this, an embedding that represents position is added to each token embedding
Everybody thinks they know what attention is
“Attention layers” consisting of multiple “attention heads” lie at the heart of the transformer architecture
Attention heads recode tokens as weighted combinations of all tokens, including itself
Layers and attention
This is done over and over again in hundreds of layers consisting of hundreds of heads
Tokens in later layers represent increasingly complex relationships between the input tokens
The final encoding of the last token is the prediction of the next token!
Prediction is deterministic (randomness is added post-hoc)
LLM training: Step 1
First step: text prediction
This works but predictions tend complete rather than reply
LLM training: Step 2
Second step: reinforcement learning
This makes the predictions more conversational
LLM knowledge
LLM knowledge is like long-term (semantic) memory
LLM “prompts” are like working memory
By turning this part of the conversation into a black box you get an AI tutor that has read the textbook
By turning this part of the conversation into a black box
you get an AI tutor that has read the textbook
From word prediction to conceptual understanding
Do LLMs understand things or do they simply make statistical predictions (“stochastic parrots”)?
Predictions at different levels of abstraction
Different ways of using LLMs
Not just chat.openai.com
Ways of using LLMs
Web interface for chatting
Programmatically (API access)
Different ways of using the same technology
Some available options
Proprietary
Top proprietary models are state of the art
Open-source models are less capable, but rapidly becoming realistic alternatives
(Partly) open source
Largely open, but top model is closed
Main driver of open-source AI
Not a model, but open-source chat interface to various models
Not a model, but hub for open-source AI
An example use case: Heymans
AI tutor for Introduction to Psychology
Heymans pilot
Prototype AI tutor for formative assessment
Used in Introduction to Psychology/ Overzicht van de Psychology (2023-2024)
Heymans pilot: architecture
Two modes
Custom software written by us and running on our own server
Uses GPT4 through OpenAI API
Student
Heymans server
Data storage
OpenAI server
No data storage
Textbook
Chat through web app
Get text from textbook
API access
Heymans pilot: practice prompt
You are a friendly tutor for an introductory psychology course. Your name is Heymans. You are about to chat with a student named {{ name }} about the excerpt from a textbook below. The student is a beginner, so keep questions and feedback simple.
<textbook>
{{ source }}
</textbook>
The chat session is structured as follows:
- Begin the conversation with the student by asking a short, open-ended question based on the material provided above. Indicate which section is the basis for the question.
- Evaluate the student's response to determine if it sufficiently demonstrates understanding of the concept(s).
- If the response does not connect to the question, remind the student that the assignment should be taken seriously.
- If the response resembles the textbook or your own feedback, remind the student to use his or her own words.
- If the response is satisfactory, conclude the teaching session. Do not offer to continue the conversation. End your response with <FINISHED>.
- If it the response is not satisfactory, provide constructive feedback and suggestions for improvement.
- After providing feedback, allow the student to respond with an improved answer. Continue this feedback cycle until the answer demonstrates a satisfactory understanding of the concept(s).
Remember to keep the questions simple and concrete.
Heymans pilot: student engagement
Heymans pilot: cost
API calls cost money
At the time of this pilot
Right now already much cheaper
But costs will remain substantial
Other use cases
Ask not what you can do for your LLM. Ask what your LLM can do for you.
What are LLMs good for?
Demanding linguistic tasks that
So that we free up time for meaningful activities
What are LLMs good for?
Such as
But probably not (at this point)
Roadmap
Towards using LLMs as a teaching tool on our own terms
An opinionated prediction
AI-based teaching products will soon be offered by every academic publisher and big-tech company
These products will
Therefore we can and should find a middle ground between developing our own products and using commercial tools
Organizational challenges
We should not underestimate the resources and expertise at universities
The main barriers at universities are organizational
If we as universities overcome these barriers, we can accomplish a lot
Roadmap
In Groningen, we have formed a small team to implement AI teaching tools, building on the Heymans prototype
Initial focus
Everything will be open source
Contributions are welcome (especially development resources)
More ambitious projects
Heymans will have to use a commercial API
In the longer term, can we run our own model on the Groningen Hábrok cluster?
And remember …
There is nothing magical about AI language models
Thank you!
Sebastiaan Mathôt | cogsci.nl/smathot | s.mathot@rug.nl | leiden university | june 20 2024