Images, language and games
Machine learning for natural language processing
Machine learning for natural language processing sorts documents into categories, extracts names, dates and amounts from text, and answers questions from a document collection. Fine-tuned transformer models handle most of these tasks, while TF-IDF with a linear model remains a strong, fast baseline.
How machine learning is used in natural language processing
Text classification
Models assign labels such as topic, sentiment or urgency to documents, emails and reviews. Fine-tuning a pretrained language model works well even with modest labelled data.
Real exampleULMFiTULMFiT showed that fine-tuning a pretrained language model outperformed the previous state of the art on six text classification tasks.
Extracting names, dates and facts
Named entity recognition and relation extraction pull structured facts out of text, such as drugs, genes or contract parties. Domain-specific pretraining helps in specialist text.
Real exampleBioBERTBioBERT is a language model pretrained on biomedical text that improved on BERT for biomedical named entity recognition, relation extraction and question answering.
Search and question answering
Language models help a search engine understand what a query means, not just which words it contains. The same models rank passages and extract answers.
Real exampleBERT in Google SearchGoogle announced in 2019 that it was applying BERT models to better understand search queries.
Machine translation
Sequence-to-sequence models translate text between languages, trained on large collections of parallel sentences. Recent work extends this to languages with little training data.
Real exampleNo Language Left Behind (Meta AI)Meta AI's No Language Left Behind project built translation models covering 200 languages, including many low-resource languages.
Can you learn machine learning for NLP?
Yes. NLP is very accessible because pretrained models and libraries do much of the heavy lifting. Learn Python and text handling first, then classical models such as TF-IDF with logistic regression, then transformers and fine-tuning.
- Python and text handlingClean, tokenise and count text with Python strings, pandas and regular expressions.Learn it in Python
- Classical text modelsBuild TF-IDF features with logistic regression and evaluate with precision, recall and F1, which gives a fast baseline.Learn it in Machine Learning
- Neural networks and embeddingsLearn how words and sentences become vectors and how sequence models use them.Learn it in Deep Learning
- Transformers and fine-tuningFine-tune a pretrained model such as DistilBERT with Hugging Face Transformers for classification or entity extraction.Learn it in Generative AI
Moving into natural language processing
If you already work in the field
If you work with language professionally, as a linguist, translator, analyst or editor, you know where meaning is ambiguous and how to write labelling rules. Add Python and Hugging Face, then start with a classification project on documents you already know well.
If you come from data science or ML
If you come from tabular machine learning, learn tokenisation, embeddings and transformer fine-tuning. Pay attention to annotation guidelines and inter-annotator agreement, which limit how good any NLP model can be.
Roles that do this workNLP engineerMachine learning engineer, NLPComputational linguistApplied scientist, language
Tools you will use
| Tool | What you use it for |
|---|---|
| Hugging Face Transformers | Load pretrained language models and fine-tune them for classification, tagging and question answering. |
| spaCy | Tokenise text, tag entities and parse sentences in fast production pipelines. |
| scikit-learn | Build TF-IDF and linear-model baselines and compute precision, recall and F1. |
| Sentence Transformers | Turn sentences into embeddings for semantic search, clustering and similarity. |
| NLTK | Teaching-friendly tokenisers, corpora and classic NLP algorithms for exploring text. |
Public data to practise on
- IMDb Large Movie Review Dataset: Movie reviews labelled positive or negative, the standard first dataset for sentiment classification.
- Universal Dependencies: Treebanks in many languages annotated with parts of speech and syntax, for tagging and parsing models.
- MultiNLI: Sentence pairs labelled entailment, neutral or contradiction across several genres, for natural language inference.
Your first project
Download the IMDb movie review dataset, predict review sentiment by fine-tuning DistilBERT, and compare it with TF-IDF and logistic regression using accuracy and F1 on the test set.
Common questions
Is NLP still relevant now that LLMs exist?
Yes. LLMs are themselves NLP models, and smaller fine-tuned models are often cheaper, faster and easier to evaluate for fixed tasks such as classification and extraction.
Do I need to know linguistics for NLP?
No formal linguistics is required to start, but understanding syntax, ambiguity and how languages differ helps with error analysis and multilingual work.
What is the best first NLP project?
Sentiment or topic classification on a public dataset such as IMDb reviews. Compare TF-IDF with logistic regression against a fine-tuned transformer.
Which library should I learn first for NLP?
scikit-learn for baselines and Hugging Face Transformers for pretrained models cover most practical work. spaCy is useful for fast entity recognition and text pipelines.
Courses for these skills
- Practical Machine Learning in PythonBuild classification baselines and evaluate rare categories.51 published lessons · more lessons in production
- Deep Learning with PyTorchStudy image and sequence representations.Syllabus available · lessons open as produced
- Generative AI: LLMs, RAG and AgentsUse structured-output checks when building a later document assistant.Syllabus available · lessons open as produced
- Data Tools: NumPy, pandas, Matplotlib and scikit-learnPreserve page identifiers and extracted-field metadata.23 published lessons · all planned lessons open
New to programming or maths? Start with Python, or follow the machine learning path in order. Published lessons are free to read; compare Free and Pro.