COMP 3361
Natural Language Processing
Spring 2024
1
Logistics
● Location: KB 132
● Meetings: Tuesday 9:30 am - 10:20 am and Friday 9:30 am - 11:20 am
● Instructor: Tao Yu (https://taoyds.github.io/)
● Office hours: Wednesday 4 - 5 pm @IDS
P2
Logistics
Course website: https://taoyds.github.io/courses/comp3361
● We will maintain the website for schedule, lecture slides, reading lists,
grading policies, etc
● Only submit your reports on Moodle.
P3
Logistics
Slack: https://join.slack.com/t/slack-fdv4728/shared_invite/zt-2asgddr0h-6wIXbRndwKhBw2IX2~ZrJQ
● We will use Slack as the primary mode of communication. DM me on
Slack instead of emails.
○ Answer any questions about lectures, assignments, grading, and so on
○ Share random thoughts, highlight interesting papers, brag about cool finding there.
● Join Slack via the invitation link above.
P4
Course prerequisites
● COMP3314 or COMP3340; and MATH1853
● Familiarity with deep learning and machine learning
● Familiarity with Python programming
● Helpful: exposure to AI assistants such as ChatGPT
P5
Course goals
● Understand core techniques and modern advances in NLP, especially
in the era of large language models.
● Design, implement, and test NLP systems based on large language
models.
P6
Components and grading
● Assignments: 40%
○ ~2 assignments, 20% for each
● Course project: 30%
○ More guidelines will be announced soon
● In-class exam: 25%
● Class participation: 5%
P7
Policy on ChatGPT, Copilot, and other AI assistants
● This course emphasizes understanding the capabilities and limitations of
these AI systems, and there's no better way to do that than by using them!
Collaboration with these systems is allowed, treating them as
collaborators in the problem-solving process. However, Using them to
substantially complete assignments will be considered a violation of
the Honor Code.
P8
Class readings
● Readings from textbook chapters, blogs, tutorials, and papers will be
posted on the course website.
● You may find it useful to do these readings before lecture as
preparation or after lecture to review, but you are not expected to
know everything discussed in the textbook if it isn’t covered in lecture.
● Paper readings are intended to supplement the course material if you
are interested in diving deeper on particular topics.
P9
Topics and Schedule (Tentative)
● Introduction and NLP model basics
● Large language models (LLMs)
● NLP applications
● Advanced LLM topics
P 10
Introduction and NLP model basics
● Word embeddings
● Text Classification and Language Modeling
● Sequence-to-Sequence, Attention, Transformers
P 11
Large language models (LLMs)
● LLM pretraining
● LLM Prompting, in-context learning
● LLM evaluation, data, and benchmarking
● Instruction tuning for LLMs
● LLM alignment/RLHF
P 12
NLP applications
● Question answering, reasoning
● Text generation
● Semantic parsing, code generation
● LM agent, language grounding
P 13
Advanced LLM topics
● Robustness, interpretability, explainability of LLMs
● Bias, toxicity, and privacy in LLMs
● Parameter-efficient LM tuning
● Efficient LLM methods and Infrastructure
● Multimodal LM, language in robotics, and embodied interaction
P 14
What is NLP? Wait, what is language?
● Language is the abstraction of the real world!
● Natural Language Processing (NLP) aims to teach computers human
languages a computational perspective.
P 15
About NLP: teaching computers human languages
● NLP in real world applications
○ Q&A / IR - Google search
P 16
About NLP: teaching computers human languages
● NLP in real world applications
○ Q&A / IR - Google search
Input: x Output: y
When was HKU founded? March 30, 1911
P 17
AI brain/model: f(x)
About NLP: teaching computers human languages
● NLP in real world applications
○ Q&A / IR - Google search
○ Dialogs - Apple Siri / Amazon Alexa
P 18
About NLP: teaching computers human languages
● NLP in real world applications
○ Q&A / IR - Google search
○ Dialogs - Apple Siri / Amazon Alexa
○ Grammar checking (Grammarly), summarization, sentiment analysis …
P 19
What ChatGPT can do?
P 20
https://beta.openai.com/examples/
Q&A example with ChatGPT
P 21
https://beta.openai.com/examples/
More examples with ChatGPT
P 22
https://beta.openai.com/examples/
Examples with ChatGPT
P 23
https://beta.openai.com/examples/
New learning paradigm: in-context learning
P 24
Few-shot in-context learning
● Few-shot: In additional to the task
description, the model sees a few examples
of the task. task description
● No fine-tuning, GPT-3 doesn’t update their
task examples
parameters!
task prompt
GPT-3 output
P 25
Language Models are Few-Shot Learners
About NLP: teaching computers human languages
● NLP in real world applications
○ Q&A / IR - Google search
○ Dialogs - Apple Siri / Amazon Alexa
○ Grammar checking (Grammarly), summarization, sentiment analysis …
○ Text to images: image creation from a text description - OpenAI’s DALLE-2
P 26
DALLE-2 demo: text to images
P 27
https://openai.com/dall-e-2/
DALLE-2: text to images
P 28
https://openai.com/dall-e-2/
Language models are powerful, but they still suffer from
● Lack of interpretability
● Inconsistency
● Limited scalability
● Restricted capabilities
● …
P 29