COMP5046 — Natural Language Processing

Lecture 2: Foundations of NLP Systems

Five components · linear BoW baseline · embeddings · train/dev/test · P/R/F1 · ROC.

How to use this guide: bullets = chunking. Answer Recall prompts with the page hidden. Quiz Hub + flashcards = retrieval + spacing.

Architecture

Five core components

RecallList the five components. In one line each: what does inference do? What does learning do?

Running example

Sentiment (Pang et al. 2002)

RecallName two classification tasks beyond sentiment from the lecture list.

Scale

How much data?

RecallOrder-of-magnitude: sentiment vs LM corpus (which is larger?).

Features

Tokenisation & BoW

RecallWhy is sparse storage cheaper than full \(|V|\) for a short sentence? Name two feature tricks beyond unigrams.

Scoring

Linear classifier & multi-class

\[\text{score} = \sum_{f \in \text{features}} \text{count}_f \cdot \text{weight}_{f}\]

RecallHow do you predict multi-class with linear weights? Why exhaustive label scoring is OK when \(|\mathcal{L}|\) is small?

Objectives

Learning & losses

RecallPerceptron update rule in words. Logistic loss gradient form.

Dense inputs

Word vectors in the baseline

RecallOne pro and one con of embedding-based features vs raw counts.

Evaluation

Splits & metrics

RecallWrite Precision and Recall. When does micro-averaging P equal micro R in the slide example?

Lab

Workshop 2

RecallName the three pipeline stages in order.

Quick practice

What are the five core components of an NLP system?
Data, model, features, loss, accuracy
Data, model, inference, learning, metric
Input, hidden, output, loss, optimizer
Tokenise, embed, classify, decode, evaluate
Why is a sparse dictionary cheaper than a full length-\(|V|\) array?
Only non-zero entries stored; most of \(|V|\) unused in short docs
Sparse arrays use compression algorithms
Python dicts are always faster than arrays
Sparse storage avoids floating-point issues

Chapter quizzes

Retrieval practice beats passive review.

Open Quiz Hub Chapter flashcards