• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Start selling Create your account
Document preview thumbnail
Preview 2 out of 5 pages
Study guide

Natural Language Processing: Embeddings, Transformers and Evaluation

Document preview thumbnail
Preview 2 out of 5 pages

A study guide to natural language processing: tokenisation from word to subword and its trade-offs, the distributional hypothesis and static embeddings with their single-vector limitation, intrinsic versus extrinsic evaluation, recurrent models and why they struggle with long dependencies, self-attention, multi-head attention, positional encoding and the quadratic cost in sequence length, the transformer encoder and decoder, pretraining objectives and why they determine downstream suitability, fine-tuning and parameter-efficient methods, prompting from zero-shot to chain-of-thought and its sensitivity, retrieval augmentation, evaluation of generation with BLEU, ROUGE and human rubrics, benchmark contamination and tail failures, bias and residual risk, two case studies with an annotation artefact and a hallucinating summariser, a comparative architecture table, answer technique, five model answers, a glossary and references.

Content preview

Natural Language Processing: Embeddings, Transformers
and Evaluation
Teaching a machine that meaning depends on context
Computer Science | Undergraduate (Level 6) | December 2026


WHAT IS INSIDE

1. Core Concepts and Theoretical Frameworks
2. Tokenisation, embeddings and the distributional hypothesis
3. Sequence models and attention
4. Pretraining, fine-tuning and prompting
5. Evaluation, bias and the limits of benchmarks
6. Real-World Case Studies
7. Comparative Summary Table
8. Common Exam Pitfalls and Essay Tips
9. Practice Exam Questions with Model Answers
10. Glossary of Exam-Ready Definitions


1. Core Concepts and Theoretical Frameworks
Natural language processing is examined as a progression of representations, each solving the failure of the
previous one. The table sets each representation against what it captures and what it still cannot do.

Representation Unit Strength Weakness
Bag of words Document Simple, interpretable Ignores order and context
TF-IDF Document and term Downweights common terms Still orderless
Static word embedding Word Captures similarity One vector per word regardless
of context
Contextual embedding Token in context Disambiguates meaning Compute and data heavy
Subword tokenisation Subword unit Handles rare and unseen words Longer sequences
Sentence embedding Sentence Efficient retrieval Loses fine-grained detail
Attention over tokens Token pair Long-range dependencies Quadratic cost in length

The mark-earning idea is context. The word bank means different things in a river bank and a bank account, so
any representation that assigns one vector per word type is wrong by construction. Contextual representations
fixed this and made the transformer the dominant architecture, at the cost of computation that grows quadratically
with sequence length.

2. Tokenisation, embeddings and the distributional hypothesis
Text must be converted into tokens before a model can process it. Word-level tokenisation produces a large
vocabulary and fails on misspellings and morphology. Subword tokenisation, using byte pair encoding or
WordPiece, builds a vocabulary of frequent units, so rare words are represented as compositions and unseen
words are never out of vocabulary. The trade-off is that sequences become longer, which matters because
attention cost grows with length.
The distributional hypothesis states that words occurring in similar contexts have similar meanings, and it is the
basis of static embeddings, which are learned from co-occurrence. Word2vec and GloVe produce vectors with
useful geometric properties, including analogy relations. Their limitation is that a single vector must represent all
senses, so the representation is an average over contexts rather than a representation of any particular use.


Natural Language Processing: Embeddings, Transformers and Evaluation Page 1 of 5

,Natural Language Processing: Embeddings, Transformers and Evaluation


Evaluation of embeddings has two forms. Intrinsic evaluation measures similarity and analogy on benchmarks,
which is fast and weakly related to downstream performance. Extrinsic evaluation trains a model for a task and
measures the task metric, which is expensive and definitive. Reporting only intrinsic results is a common
weakness in student work, because a higher similarity score does not imply a better classifier.

Tokeniser Vocabulary Handles unseen words Typical effect
Word level Large No Out-of-vocabulary tokens
Character level Small Yes Very long sequences
Byte pair encoding Medium Yes, by composition Balanced
WordPiece Medium Yes, by composition Used in BERT
SentencePiece Medium Yes, language agnostic Handles whitespace
languages


3. Sequence models and attention
Recurrent networks process a sequence one step at a time, carrying a hidden state. They handle variable length
naturally and are limited by the difficulty of propagating gradients over long distances, which long short-term
memory cells mitigate but do not eliminate. The sequential computation also prevents parallelisation across the
sequence, which is a practical limitation on modern hardware.
Attention computes a weighted combination of representations, where the weights depend on the similarity
between a query and a set of keys. Self-attention applies this within one sequence, so every position can attend to
every other position in a single layer. Multi-head attention runs several attention functions in parallel, which
allows different heads to specialise in different relations, such as syntactic or coreferential links.
The transformer stacks self-attention with feedforward layers, residual connections and layer normalisation, and it
adds positional encodings because attention alone is permutation invariant. The encoder attends to the whole
input; the decoder attends to the output produced so far and masks future positions. The complexity is quadratic
in sequence length, which motivates sparse attention, local windows and linear approximations.
• Self-attention allows every position to depend on every other in one layer.
• Multi-head attention lets different heads capture different relations.
• Positional encodings are required because attention ignores order.
• Masked attention prevents the decoder from seeing future tokens.
• Attention cost grows quadratically with sequence length.
• Residual connections and layer normalisation make deep stacks trainable.
• Recurrent models are sequential and therefore hard to parallelise.

4. Pretraining, fine-tuning and prompting
Pretraining on a large corpus with a self-supervised objective produces a general language representation.
Masked language modelling predicts hidden tokens from their context, which gives a bidirectional encoder suited
to classification and extraction. Causal language modelling predicts the next token, which gives a decoder suited
to generation. The objective determines what the representation is good for, which is why the architecture and the
objective are chosen together.
Fine-tuning adapts a pretrained model to a task with a small labelled dataset. Parameter-efficient methods, such as
adapters and low-rank adaptation, freeze most of the model and train a small number of additional parameters,
which reduces cost and storage. This is now the standard approach where a full fine-tune is impractical, and it
changes the economics of deploying one base model for many tasks.
Prompting treats the task as a text completion. Zero-shot prompting gives instructions only, few-shot prompting
provides examples, and chain-of-thought prompting elicits intermediate reasoning steps which improve
performance on multi-step problems. The limitations are sensitivity to phrasing, the absence of any guarantee of

Natural Language Processing: Embeddings, Transformers and Evaluation Page 2 of 5

Document information

Study
Unknown
Uploaded on
December 4, 2026
Number of pages
5
Written in
2026/2027
Type
Study guide
£6.35

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
225
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions