
Embeddings, Tokenization, and Sequence Labeling
For practitioners building representations, tokenizers, taggers, and entity extraction systems from first principles.
Part of Language AI Handbook. The online chapters are free to read; the PDF edition is yours to keep, with future updates included.
Become a more confident language AI practitioner.
Build the understanding to explain how language models work and make more informed choices about using them. The handbook connects the foundations to the methods behind modern language AI, with explanations you can return to as you learn.
See what you’ll learnWhat you will learn
- Understand Word Embeddings.
- Understand Subword Tokenization.
- Understand Sequence Labeling.
Who this volume is for
- Engineers, researchers, students, AI enthusiasts, linguists, product managers, and anyone interested in understanding or building modern language AI systems, from foundational NLP to advanced large language models.
Prerequisites: Builds on Volume 1 or equivalent NLP fundamentals.
Volume 2 PDF edition
Own this 790-page edition
Keep the PDF for offline reading, with future updates included. The corresponding chapters stay free online.
- Carefully typeset PDF
- Future updates and errata included
- Online chapters remain free to read
Volume 2 of 20 · Available now
$24
one-timeVersion 2026.08.0 · 790 pages · secure checkout via Stripe
Delivered by email · Free updates included
Want the complete library?
Access to every volume, delivered as separate PDFs. Save $257 vs. buying available volumes separately.
Get all-volume access · $199Reader verdict
5.0
out of 5
12 five-star reader reviews
Genuine feedback, with names abbreviated for privacy.
Meet the community“Really appreciate the way you have explained the concepts. Simple to understand, yet builds up knowledge exponentially, all while reinforcing it with examples repeatedly. I've read the last two chapters `74.Self-attention & 75.Q,K,V` and I've to admit, my concepts have never been clearer. You really are doing an amazing job breaking down maths and complex concepts like a story!”
“I would like to thank you for your work. Specifically, the chapter: 'LIME Explainability: Complete Guide to Local Interpretable Model-Agnostic Explanations' was extremely helpful for me in understanding LIME and communicating to colleagues. Your work is inspiring and valuable. Thank you for doing it.”
“I am enjoying reading your writings. I appreciate the effort you put into it. I want to drop a note of thanks. Thank you!”
“Your writing feels like a treasure trove of great material. So, thank you for compiling everything on your website!”
“I found your book Language AI Handbook's explanations of Transformer architectures and production deployment strategies to be exceptionally clear and insightful”
“Thanks so much for establishing such an amazing community. I appreciate the opportunity to be a learner and a contributor to the community.”
“Thank you Michael. It's top!”
“I came across your collection of online handbooks covering quantitative finance, AI, and machine learning. I wanted to reach out and thank you for making such high-quality material openly available. They are incredibly helpful for my CFA Level II review and for brushing up ahead of ML interviews.”
“I came across one of your books, Language AI Handbook, and man, I'm loving it. I've read many books but have never found such a comprehensive book on large models that covers everything from start to finish with such depth.”
“I just came across your website where your books are available for free to read. Thank you so much for making this available to the public. This will help a lot of people.”
“Thanks for putting cool stuff out into the world.”
“I read a few of your blogs on NLP and oh WOW, they really are something, now I exactly know how all of the terms Entropy, Cross-entropy and how it is connected to Perplexity, will definitely read more of your blogs.”
Read all 12 reader reviews
“I would like to thank you for your work. Specifically, the chapter: 'LIME Explainability: Complete Guide to Local Interpretable Model-Agnostic Explanations' was extremely helpful for me in understanding LIME and communicating to colleagues. Your work is inspiring and valuable. Thank you for doing it.”
“Really appreciate the way you have explained the concepts. Simple to understand, yet builds up knowledge exponentially, all while reinforcing it with examples repeatedly. I've read the last two chapters `74.Self-attention & 75.Q,K,V` and I've to admit, my concepts have never been clearer. You really are doing an amazing job breaking down maths and complex concepts like a story!”
“Thanks so much for establishing such an amazing community. I appreciate the opportunity to be a learner and a contributor to the community.”
“I just came across your website where your books are available for free to read. Thank you so much for making this available to the public. This will help a lot of people.”
“I am enjoying reading your writings. I appreciate the effort you put into it. I want to drop a note of thanks. Thank you!”
“Thank you Michael. It's top!”
“Thanks for putting cool stuff out into the world.”
“I found your book Language AI Handbook's explanations of Transformer architectures and production deployment strategies to be exceptionally clear and insightful”
“Your writing feels like a treasure trove of great material. So, thank you for compiling everything on your website!”
“I came across your collection of online handbooks covering quantitative finance, AI, and machine learning. I wanted to reach out and thank you for making such high-quality material openly available. They are incredibly helpful for my CFA Level II review and for brushing up ahead of ML interviews.”
“I read a few of your blogs on NLP and oh WOW, they really are something, now I exactly know how all of the terms Entropy, Cross-entropy and how it is connected to Perplexity, will definitely read more of your blogs.”
“I came across one of your books, Language AI Handbook, and man, I'm loving it. I've read many books but have never found such a comprehensive book on large models that covers everything from start to finish with such depth.”
Exact contents
25 chapters across 3 parts
Every linked chapter is free to read online.
Part IV: Word Embeddings
- 01Skip-gram Model
Covers skip-gram architecture diagram, input/output representations, softmax over vocabulary, skip-gram objective function, training data generation, window size hyperparameter, skip-gram vs CBOW intuition.
- 02CBOW Model
Covers CBOW architecture, context word averaging, CBOW objective function, CBOW vs skip-gram training speed, CBOW for frequent words, implementing CBOW forward pass, CBOW gradient derivation.
- 03Negative Sampling
Covers softmax computational bottleneck, negative sampling objective derivation, sampling distribution (unigram^0.75), number of negatives hyperparameter, negative sampling gradient computation, NCE vs negative sampling, implementing efficient sampling.
- 04Hierarchical Softmax
Covers binary tree construction (Huffman coding), path probability computation, hierarchical softmax objective, gradient computation along paths, tree structure impact on learning, hierarchical softmax vs negative sampling, when to use each approach.
- 05Word2Vec Training
Covers data preprocessing pipeline, subsampling frequent words, learning rate scheduling, minibatch vs online training, convergence monitoring, gensim Word2Vec usage, training from scratch in PyTorch.
- 06Word Analogy
Covers vector arithmetic for analogies, parallelogram model, analogy evaluation datasets, 3CosAdd vs 3CosMul methods, analogy accuracy metrics, limitations of analogy evaluation, what analogies reveal about embeddings.
- 07GloVe
Covers GloVe objective function derivation, weighted least squares formulation, relationship to matrix factorization, weighting function design, bias terms in GloVe, GloVe vs Word2Vec comparison, training GloVe efficiently.
- 08FastText
Covers character n-gram representation, word vector as n-gram sum, FastText architecture, handling OOV words, morphological awareness, FastText for morphologically rich languages, training FastText models.
- 09Embedding Evaluation
Covers intrinsic vs extrinsic evaluation, word similarity datasets (SimLex, WordSim), analogy accuracy, embedding visualization (t-SNE, UMAP), downstream task evaluation, embedding bias detection, evaluation pitfalls.
Part V: Subword Tokenization
- 01The Vocabulary Problem
Covers OOV word problem, vocabulary size explosion, rare word representation, morphological productivity, compound words, code and technical text, the case for subword units.
- 02Byte Pair Encoding
Covers BPE algorithm step-by-step, merge rules learning, vocabulary size control, BPE encoding procedure, BPE decoding procedure, BPE implementation from scratch, BPE hyperparameters.
- 03WordPiece
Covers WordPiece vs BPE differences, likelihood objective for merges, greedy tokenization algorithm, ## prefix notation, WordPiece in BERT, training WordPiece tokenizers, handling unknown characters.
- 04Unigram Language Model Tokenization
Covers unigram LM formulation, EM algorithm for training, Viterbi decoding for tokenization, sampling multiple segmentations, subword regularization, unigram vs BPE comparison, SentencePiece unigram mode.
- 05SentencePiece
Covers treating text as raw bytes, whitespace handling (▁ prefix), BPE and unigram modes, training from raw text, pretokenization elimination, SentencePiece in production, multilingual tokenization.
- 06Tokenizer Training
Covers corpus preparation, vocabulary size selection, special tokens configuration, training with HuggingFace tokenizers, saving and loading tokenizers, tokenizer versioning, domain-specific tokenizers.
- 07Special Tokens
Covers [CLS], [SEP], [PAD], [MASK], [UNK] tokens, beginning/end of sequence tokens, custom special tokens, special token embeddings, token type IDs, handling special tokens in generation.
- 08Tokenization Challenges
Covers number tokenization issues, code tokenization, multilingual text mixing, emoji and Unicode edge cases, tokenization artifacts, adversarial tokenization, measuring tokenization quality.
Part VI: Sequence Labeling
- 01Part-of-Speech Tagging
Covers POS tag sets (Penn Treebank, Universal), POS tagging as classification, contextual disambiguation, POS tagging accuracy metrics, POS tagging for downstream tasks, rule-based vs statistical taggers.
- 02Named Entity Recognition
Covers entity types (PER, ORG, LOC, etc.), NER as sequence labeling, nested entity challenges, entity boundary detection, NER evaluation (exact vs partial match), NER datasets and benchmarks.
- 03BIO Tagging
Covers BIO scheme explanation, BIOES/BILOU variants, converting spans to BIO tags, BIO decoding to spans, handling tagging inconsistencies, BIO for multi-label scenarios, implementing BIO utilities.
- 04Chunking
Covers noun phrase chunking, chunk types (NP, VP, PP), IOB tagging for chunks, chunking vs full parsing, chunking evaluation, chunking as preprocessing, regex chunking with NLTK.
- 05Hidden Markov Models
Covers HMM components (states, observations, transitions), emission and transition probabilities, HMM assumptions (Markov, independence), HMM for POS tagging, HMM parameter estimation, HMM limitations for NLP.
- 06Viterbi Algorithm
Covers optimal path problem formulation, Viterbi recursion derivation, backpointer tracking, Viterbi complexity analysis, log-space computation, implementing Viterbi efficiently, Viterbi for beam search foundation.
- 07Conditional Random Fields
Covers CRF vs HMM comparison, CRF feature functions, log-linear formulation, partition function computation, CRF for NER, CRF inference complexity, neural CRF layers.
- 08CRF Training
Covers CRF log-likelihood objective, forward-backward algorithm, gradient computation, L-BFGS optimization, feature template design, CRF regularization, CRF training convergence.
Choose the edition that fits your next step
Volume 2: Embeddings, Tokenization, and Sequence Labeling
790 pages focused on this subject, with future updates included.
$24
Choose this volumeThe complete Language AI Handbook library
All-volume access with separate volume PDFs and future updates. No combined PDF. Includes future volumes as they become available.
$199
Get all-volume accessExplore the other volumes

Volume 1 · 570 pages
Language Data and Classical NLP
Text as Data · Classical Text Representations · Distributional Semantics

Volume 3 · Coming soon
Linguistic Structure and Meaning
Morphology · Syntax · Semantics · Discourse · Dialogue

Volume 4 · 920 pages
Neural NLP and Sequence Models
Neural Network Foundations · Recurrent Neural Networks · Sequence-to-Sequence

Volume 5 · 860 pages
Transformers from First Principles
Self-Attention · Positional Encoding · Transformer Blocks · Transformer Architectures

Volume 6 · 510 pages
Efficient, Long-Context, and Alternative Architectures
Efficient Attention · Long Context

Volume 7 · 760 pages
Pre-training Data and Scaling
Data Curation · Pre-training Objectives · Scaling Laws

Volume 8 · 440 pages
Encoder, Multilingual, and Translation Models
BERT and Variants · Encoder-Decoder Models

Volume 9 · 730 pages
Decoder Language Models and Capabilities
GPT Architecture · Modern Decoder Models · Emergent Capabilities

Volume 10 · 920 pages
Large-Scale Training and Sparse Models
Training Infrastructure · Training Optimization · Mixture of Experts

Volume 11 · 730 pages
Fine-tuning and Efficient Adaptation
Fine-tuning Fundamentals · Parameter-Efficient Fine-tuning · Instruction Tuning

Volume 12 · 510 pages
Alignment, Preferences, and Oversight
Alignment and RLHF

Volume 13 · 220 pages
Reasoning and Verifiable Learning
Reasoning

Volume 14 · 640 pages
Efficient Inference and On-Device Models
Model Compression · Inference Optimization

Volume 15 · 600 pages
Retrieval, Knowledge, and Memory
Retrieval-Augmented Generation · Continual Learning

Volume 16 · 510 pages
Agents and AI Coding Systems
Code Generation · Tool Use and Agents

Volume 17 · 540 pages
Speech, Multimodal, and Embodied Language
Multimodal Models · Speech and Audio

Volume 18 · 950 pages
Evaluation, Factuality, and Reliability
Evaluation Fundamentals · Benchmark Evaluation · Human and Model Evaluation · Hallucination and Factuality

Volume 19 · 760 pages
Responsible, Secure, and Interpretable Language AI
Bias and Fairness · Interpretability · Safety and Security

Volume 20 · 510 pages
Applications, Production, and Compound AI Systems
LLM Applications · Production Systems
Author and edition details
About the author and this edition

Michael Brenndoerfer
Michael has spent more than a decade working across software engineering, data, AI, and business. He writes to understand difficult ideas more deeply and to share what he learns in a clear, practical way.
- Edition
- First edition
- Published
- Last reviewed
Version history
Kept current, not frozen in time
Library access includes every future volume and update. When a volume changes, its updated PDF appears in My books at no extra cost.
Current release
Edition 2026.08.0
Initial volume-library release with 19 written PDFs, a Volume 3 placeholder, and no combined edition.