← Reference · Nestor G Pestelos Jr

Reference Document

Natural Language Processing

A citable reference on Natural Language Processing (NLP): linguistic representations, statistical language modeling, tokenization algorithms, sequence-to-sequence mechanisms, and transformers.

See Also & Related References

Jump to Section

1. Definition & Theoretical Scope

Natural Language Processing (NLP) is an interdisciplinary subfield of computer science, artificial intelligence, and computational linguistics concerned with giving computers the capability to process, analyze, translate, and generate human natural language.

The fundamental challenge of NLP stems from linguistic ambiguity across multiple structural levels:

2. Evolution of NLP Paradigms

Era Dominant Paradigm Representation & Approach
Symbolic / Rule-Based (1950s–1980s) Formal grammars (Chomsky), expert rule systems, dictionary lookups. Discrete hand-crafted syntax trees and symbolic logic. Highly brittle to ungrammatical input.
Statistical NLP (1990s–2000s) N-gram probability models, Hidden Markov Models (HMM), Maximum Entropy classifiers. Bag-of-Words (BoW) and TF-IDF matrices; manual linguistic feature engineering.
Dense Embeddings & RNNs (2013–2017) Static vector embeddings (Word2Vec, GloVe), Recurrent Networks (LSTMs, GRUs), Seq2Seq. Continuous geometric vector spaces; sequential hidden state recurrence with early attention (Bahdanau 2014).
Transformer Era (2017–Present) Self-attention architectures (Vaswani et al., 2017), Masked (BERT) and Autoregressive (LLMs) Foundation Models. Contextualized token embeddings learned self-supervised over trillions of words via next-token prediction.

3. Subword Tokenization Algorithms

Modern NLP processes text as integer token IDs using subword algorithms that balance vocabulary size against sequence length, eliminating Out-of-Vocabulary (OOV) errors:

4. Distributed Word Representations

NLP relies on the Distributional Hypothesis (Harris 1954, Firth 1957): "You shall know a word by the company it keeps."

In dense vector spaces, words are represented as vectors \(v \in \mathbb{R}^d\) (e.g. \(d = 768\) to \(4096\)). Linear vector arithmetic captures semantic and syntactic analogies (e.g., \(\vec{v}_{\text{King}} - \vec{v}_{\text{Man}} + \vec{v}_{\text{Woman}} \approx \vec{v}_{\text{Queen}}\)), and semantic proximity is measured by cosine similarity:

$$\text{sim}(u, v) = \frac{u \cdot v}{\|u\|_2 \|v\|_2} = \cos(\theta)$$

5. Statistical Language Modeling

The core theoretical task of NLP is Language Modeling: estimating the joint probability distribution \(P(W)\) over arbitrary token sequences \(W = (w_1, w_2, \dots, w_N)\).

Under the autoregressive factorization, this probability is computed sequentially via cross-entropy loss:

$$\mathcal{L}_{\text{LM}} = -\frac{1}{N} \sum_{i=1}^N \log P(w_i \mid w_1, w_2, \dots, w_{i-1})$$

Model evaluation is formally measured by Perplexity (\(\text{PPL}\)), which equals the exponentiated average cross-entropy per token:

$$\text{PPL}(W) = \exp\left( \mathcal{L}_{\text{LM}} \right) = \left( \prod_{i=1}^N \frac{1}{P(w_i \mid w_{\lt i})} \right)^{1/N}$$

6. Core NLP Task Taxonomy

Task Category Specific Objectives Primary Evaluation Metrics
Sequence Labeling Part-of-Speech (POS) tagging, Named Entity Recognition (NER). Precision, Recall, F1-Score.
Text Classification Sentiment analysis, intent detection, topic classification, spam filtering. Accuracy, Macro/Micro F1, ROC-AUC.
Sequence-to-Sequence Machine translation, abstractive text summarization. BLEU, ROUGE-1/2/L, METEOR.
Information Extraction & QA Open-domain question answering, RAG, entity relation extraction. Exact Match (EM), F1, MRR (Mean Reciprocal Rank).
Generative Reasoning Code generation, agentic reasoning loops, mathematical derivation (LLMs). Pass@k, HumanEval, LLM-as-a-Judge Rubric scoring.