NLP & Large Language Models Notes
Subject Overview
How language models work, how to use them, and how to fine-tune them for specific tasks. Six modules trace the road from classical NLP and sequence models through the transformer architecture to working with frontier and open models — prompt engineering, structured outputs and function calling — closing with adaptation techniques and the evaluation and safety practices that responsible deployment requires.
Subject at a glance
8
Units
39
Topics
15
Hours
8
Infographics
Unit-wise Syllabus
8 units — click WhatsApp below to get the full notes for each
Unit 1: Classical NLP (2 hours)
- Tokenization
- stemming
- TF-IDF
- word2vec
- GloVe
- why embeddings changed everything
- 1Raw text
- 2Tokenise
Split into words or subwords
- 3Normalise
Lowercase, stem or lemmatise
- 4Vectorise
TF-IDF or word embeddings
- 5Model
Classifier or similarity
Study guide
This module starts with classical NLP: tokenisation, stemming, TF-IDF, word2vec and GloVe and why embeddings changed everything. Understand embeddings as meaning represented by position in space.
Unit 2: Sequence Models (3 hours)
- RNNs
- LSTMs
- the attention mechanism
- the road from seq2seq to transformers
- 1RNN
Reads one token at a time
- 2LSTM
Gates help remember longer context
- 3Seq2seq
Encoder-decoder for translation
- 4Attention
Decoder looks back at all inputs
- 5Transformer
Attention only, fully parallel
Study guide
You study sequence models: RNNs, LSTMs, the attention mechanism and the road from seq2seq to transformers. Attention is the idea to master; it explains the next unit.
Unit 3: Transformers Deep Dive (3 hours)
- Self-attention
- multi-head attention
- positional encoding
- reading the 'Attention is All You Need' paper
Scaled dot-product attention
softmax(Q Kᵀ / √dk) V
Q, K, V
Query, key and value projections of each token
Multi-head attention
Several attention heads in parallel, concatenated
Positional encoding
Adds word-order information
Study guide
The transformers deep dive covers self-attention, multi-head attention, positional encoding and reading the 'Attention Is All You Need' paper. Read the paper alongside a code walkthrough.
Unit 4: Working with LLMs (4 hours)
- GPT
- Claude
- Llama and Mistral families
- API usage
- prompt engineering
- structured outputs
- function calling
Prompt engineering
Clear role, context, examples
Structured outputs
JSON that matches a schema
Function calling
Model asks your code to run a tool
Model choice
Claude, GPT, Llama, Mistral: cost vs quality
Study guide
You work with LLMs: the GPT, Claude, Llama and Mistral families, API usage, prompt engineering, structured outputs and function calling. Practise writing prompts and measuring the difference they make.
Unit 5: Fine-tuning & Adaptation (4 hours)
- Full fine-tuning
- LoRA
- QLoRA
- instruction tuning
- when to fine-tune versus prompt versus RAG
Prompting
Task fits in instructions and examples
Lowest
RAG
Model needs your up-to-date documents
Medium
LoRA / QLoRA fine-tuning
Need a specific style, format or skill
Higher, but far below full fine-tuning
Full fine-tuning
Large data and deep changes
Highest
Study guide
You study fine-tuning and adaptation: full fine-tuning, LoRA, QLoRA, instruction tuning and when to fine-tune versus prompt versus use RAG. Start with prompting, add RAG for knowledge and fine-tune only when necessary.
Unit 6: Evaluation & Safety (4 hours)
- Benchmarks
- hallucinations
- prompt injection
- content safety
- bias detection
Hallucination
Confident but false answers
Prompt injection
Malicious instructions hidden in input
Bias
Unfair outputs for some groups
Content safety
Harmful or toxic text
Benchmarks
Measure quality consistently
Study guide
You study evaluation and safety: benchmarks, hallucinations, prompt injection, content safety and bias detection. Always test models on adversarial inputs, not only friendly ones.
Unit 7: Tools introduced
- Hugging Face transformers
- PEFT and TRL
- OpenAI / Anthropic / open-source model APIs (Together, Groq, Replicate)
- Ollama for running local models
- LangSmith / Langfuse for LLM observability
Transformers, PEFT, TRL
Load, adapt and train models
Model APIs
Anthropic, OpenAI, open-source hosts
Ollama
Run models locally
LangSmith / Langfuse
Trace and observe LLM apps
Study guide
The tools include Hugging Face transformers, PEFT and TRL, model APIs from OpenAI, Anthropic and open-source providers, Ollama for local models and LangSmith or Langfuse for observability. Run a small open model locally to understand cost and latency.
Unit 8: Mini-projects
- Build a sentiment classifier using a fine-tuned BERT
- fine-tune a 7B open-source model on a domain-specific dataset with LoRA
- build a chatbot with structured outputs and tool use
- 1Prepare an instruction dataset
- 2Load the base model in 4-bit
QLoRA
- 3Attach LoRA adapters
Train only small matrices
- 4Train and evaluate
- 5Merge or serve the adapter
Study guide
The mini-projects are a fine-tuned BERT sentiment classifier, a 7B open-source model fine-tuned on a domain dataset with LoRA and a chatbot with structured outputs and tool use. A fine-tuned domain model is a distinctive portfolio item.
Why NLP & Large Language Models Matters
Language models are the most visible and fast-moving area of AI. Understanding transformers, prompting, fine-tuning and evaluation prepares you for roles such as LLM engineer, AI application developer and applied scientist.
How to Prepare for NLP & Large Language Models
- Implement a small transformer block to understand attention.
- Evaluate every LLM feature with a test set, not just impressions.
- Follow current model releases but build on fundamentals.
NLP & Large Language Models: Frequently Asked Questions
What is LoRA?
LoRA is a parameter-efficient fine-tuning method that trains small added matrices instead of all model weights, greatly reducing memory and cost.
What is a hallucination in an LLM?
A hallucination is a confident but incorrect or invented output produced by a language model.
