Lecture 2: Basics of Linguistics and Word Representation

What is language made of — and how can a model learn what a word means from the company it keeps? Watch the lecture in ten short chapters with English and Chinese subtitles, follow the lecture map below, then try the ideas in Colab.

📅 Sep. 18th, 2026 🎥 chapters · min 🖼 slides 💬 EN + 中文 subtitles 🧭 Lecture map 💻 Colab notebooks ⬇ Slides (PDF)
Transcript follows the video · click a sentence to jump · Shift + ←/→ jumps between slides

1The lecture map

What is language made of — and how can a model learn what a word means from the company it keeps?

Five acts, ten chapters. The first half climbs the levels of language — characters, words, subwords, sentences, discourse — and asks where that structure went in today's LLMs. The second half turns words into vectors: first by counting contexts, then by predicting them with word2vec. The thread through both halves is context. Click a chapter to watch it.

IStructure
Language has structure below the surface
IIUnits
From bytes and characters to words and subword tokens
IIISentences & beyond
Who did what to whom — and what LLMs learn of it
IVCount
Turn where words occur into vectors
VPredict
Learn dense vectors by predicting context
Chapter by chapter what each chapter covers, and the question it leaves for the next
  1. IStructureLanguage has structure below the surface
  2. 1

    What Is Linguistics? Structure, Grammar and Englishes

    Linguistics is the scientific study of language. Substitution tests on "The cat sat on the mat" reveal constituents, "Colorless green ideas sleep furiously" separates form from meaning, and English varieties remind us that communication is cooperative.

    → Structure exists at many levels — what are the smallest units a computer actually stores?
  3. IIUnitsFrom bytes and characters to words and subword tokens
  4. 2

    From Characters to Words: Scripts, Unicode, Tokens

    Chinese characters carry sound and meaning; encodings from GB2312 to Unicode and UTF-8 map them to bytes. Spaces do not define words, normalization is a trade-off, and Zipf's long tail guarantees out-of-vocabulary words.

    → How can a model represent a word it has never seen?
  5. 3

    Morphemes, Chinese Words and Byte Pair Encoding

    Words are built from morphemes; Chinese words have little inflection and ambiguous boundaries (乒乓球拍卖完了). GPT-style models sidestep both with byte-level BPE, which learns frequent pieces and can always fall back to bytes. Parts of speech give words a grammatical role.

    → Words have categories — how do they combine into sentences?
  6. IIISentences & beyondWho did what to whom — and what LLMs learn of it
  7. 4

    Sentences and Discourse: Parse Trees to Coherence

    Phrase-structure trees group words into constituents; dependency trees link each word to its head. Ambiguity ("I shot an elephant in my pajamas") makes parsing hard, and discourse relations connect sentences into a coherent text.

    → Do modern language models still need all this annotation?
  8. 5

    Linguistics Meets Deep Learning: The Pendulum

    A review with a contrastive "but" once needed a pipeline of separate analysis stages; a language model trained only to predict text handles it end to end, and probes find linguistic structure inside it. The field swings between empiricism and rationalism — may it swing back?

    → If we describe a word with a short list of numbers, what should the numbers tell us?
  9. IVCountTurn where words occur into vectors
  10. 6

    Words for Search: Term Matching, TF-IDF and LSA

    Search needs a score, not just a match. The vector space model with TF-IDF weights ranks documents; latent semantic analysis compresses the term-document matrix with SVD so related words meet even without exact matches.

    → Can the same counting represent individual words?
  11. 7

    Distributional Semantics: Context Becomes Vectors

    Hand-built resources like WordNet are costly; the distributional hypothesis lets text do the work. You can guess "ongchoi" from its contexts, and so can a computer: co-occurrence counts, cosine similarity, PPMI weighting, and SVD for dense vectors.

    → Instead of counting and factorizing, can we learn dense vectors by prediction?
  12. VPredictLearn dense vectors by predicting context
  13. 8

    Word Embeddings and the Word2vec Skip-Gram Model

    Embedding spaces capture neighbors, analogies (king − man + woman), cross-lingual structure, semantic change — and social bias. Skip-gram learns them by predicting context words with a softmax over the vocabulary, using two tables of 2|V|d parameters.

    → Every update sums over the whole vocabulary — how can training be cheap?
  14. 9

    Negative Sampling, GloVe and Evaluating Embeddings

    Negative sampling turns prediction into a few binary decisions, touching K + 2 vectors per update. CBOW flips the direction, GloVe fits global counts, pretrained vectors save training, and intrinsic and extrinsic tests answer different questions.

    → Where exactly does the full-softmax cost come from?
  15. 10

    Wrap-Up and Appendix: Deriving Word2vec Gradients

    A recap of the thread from structure to representation, then the calculus: the center-word gradient is the expected context vector minus the observed one, and the full-softmax update costs about |V|·d per pair, against K·d with negative sampling.

2Try it in Colab

Three short notebooks turn the lecture into experiments. Click Open in Colab, then Runtime → Run all. Each ends with exercises. All three run on the free CPU runtime; no GPU is needed.

Notebook 1 · Chapters 2–3 · ~3 min

From bytes to tokens

  • See 自然语言处理 as code points, UTF-8, UTF-16 and GBK bytes — and as mojibake
  • Draw Zipf's law and the long tail of a novel
  • Watch a segmenter split 乒乓球拍卖完了 two ways
  • Write BPE from scratch, then compare GPT-2 (about 2 tokens per Chinese character) with Qwen2.5 (自然 | 语言 | 处理)
Open in Colab .ipynb · CPU
Notebook 2 · Chapters 6–7 · ~3 min

From counts to vectors: TF-IDF, LSA and PPMI

  • Build a TF-IDF search engine by hand
  • Let LSA match titles that share no word with the query
  • Count co-occurrences in Wikipedia; compare cosine with the dot product
  • PPMI + SVD: coffee finds milk, red finds blue
Open in Colab .ipynb · CPU
Notebook 3 · Chapters 8–10 · ~10 min

Word2vec from scratch, and how to evaluate it

  • Time full softmax against negative sampling
  • Train skip-gram with negative sampling in PyTorch on 1.7 M words
  • Neighbors and analogies with your vectors and with pretrained GloVe
  • Score both on WordSim-353 and the Google analogies; probe for gender bias
Open in Colab .ipynb · CPU

3Concept index

Key terms of the lecture. Each link opens the video at the slide where the idea is explained.

5Quotes & reading

"You shall know a word by the company it keeps."

J. R. Firth, A Synopsis of Linguistic Theory, 1930–1955 (1957), quoted on slide 133
The one-line summary of Chapters 7–9.

"Difference of meaning correlates with difference of distribution."

Zellig Harris, "Distributional Structure", Word 10 (1954)
The distributional hypothesis (slide 132) stated as a testable claim.

"Colorless green ideas sleep furiously."

Noam Chomsky, Syntactic Structures (1957), on slide 16
Grammatical form and meaning are different things.

"The meaning of a word is its use in the language."

Ludwig Wittgenstein, Philosophical Investigations §43 (1953)
The philosophical root of learning meaning from usage.

Further reading

6About this video

This is an AI-narrated version of the lecture. The slides are the ones used in class. The spoken script was written from the slides with AI assistance and is read in an AI clone of Prof. Benyou Wang's voice (MiniMax speech synthesis); the picture in the corner is a still photo. The red dot points at what is being discussed. When the narration and the slides disagree, trust the slides and the in-class lecture — and please tell us, so we can fix it.
CSC5051/CSC6052/MDS5110 Natural Language Processing · CUHK-Shenzhen · Fall 2026 · Back to the course page