Free course · 16 hands-on notebooks · no GPU needed
Neural Networks 1002
The advanced sequel to Neural Networks 1001: how language models are aligned and fine-tuned, how images, sound and speech are generated, how graphs, physics and uncertainty are handled, how to explain and audit a model, and how agents and generalist models fit together. Every idea is measured on a laptop CPU, with honest baselines and honest negative results.
- 16modules
- ~32 hof study
- 0GPUs or API keys
- 100%runnable code
Current topics, toy-sized
Alignment, diffusion, state space models, speech and agents are built at a scale a CPU can train, so every mechanism is visible, then compared with a real pre-trained model where one is small enough to run.
Measured, not asserted
Each claim is backed by a number computed in the notebook, with fixed seeds and a baseline. Where the fashionable method does not win, the notebook says so.
Responsible by design
Interpretability, uncertainty, fairness, privacy and safety are modules of their own, with measurements, not a closing paragraph.
Syllabus
Six parts, 16 modules: adapting and aligning models, representations and generation, other architectures and science, reliable and responsible AI, systems and the horizon, and a closing case study in wind energy. Each module is one notebook: read the explanations, run the cells, then try the exercises at the end. Your progress is remembered in this browser.
Adapting and aligning models
Post-training with preferences, open checkpoints and fine-tuning, and the cost of architectures and training at scale.
From Pretrained to Aligned: RLHF, DPO and GRPO
The whole post-training pipeline at toy scale: supervised fine-tuning, a reward model from preferences, policy gradient with a KL penalty, reward over-optimisation, DPO and GRPO.
- SFT
- reward model
- PPO & KL penalty
- Goodhart's law
- DPO
- GRPO
Open Models, Transfer Learning and Fine-Tuning
What open really means, how to read a licence, load real checkpoints on a laptop, fine-tune with LoRA, and save and export models safely.
- licences
- quantisation
- linear probe
- LoRA & QLoRA
- safetensors
- ONNX
Efficient Architectures and Training at Scale
Where the cost of a transformer lives and how to cut it: FlashAttention, grouped-query attention, mixture of experts, state space models, mixed precision, data parallelism and honest energy numbers.
- 6ND cost rule
- FlashAttention
- GQA & KV cache
- RoPE
- mixture of experts
- Mamba
- data parallelism
Representations and generation
Learning without labels, and generating images, audio, video and speech.
Learning Representations: Autoencoders, VAEs, GANs and Self-Supervised Learning
Learn from data without labels: anomaly detection with autoencoders, the VAE bottleneck, GAN mode collapse, SimCLR, and a CLIP in miniature next to a real one.
- autoencoders
- VAE & ELBO
- GANs
- SimCLR
- CLIP
- zero-shot
Diffusion Models: How Images Are Generated Today
Guess the noise, run it in a loop and a picture appears: forward and reverse processes, DDPM and DDIM, guidance, latent diffusion and how a text-to-image system is assembled.
- noise schedule
- denoising U-Net
- DDPM & DDIM
- classifier-free guidance
- latent diffusion
Audio and Video Generation
Waveforms, spectrograms and neural codecs, vocoders, token and diffusion models for sound, a real music model, then video consistency, optical flow and provenance.
- mel spectrogram
- EnCodec
- Griffin-Lim & HiFi-GAN
- MusicGen
- video diffusion
- watermarking
Speech: Recognition, Synthesis and Voice Cloning
A CTC recogniser from scratch, real Whisper and wav2vec 2.0 with measured word error rates, text to speech, a translation cascade, speaker similarity, voice cloning and its ethics.
- CTC
- word error rate
- Whisper
- TTS
- speaker embeddings
- voice cloning
- deepfakes
Other architectures and science
Networks for graphs, and networks that respect physics.
Graph Neural Networks
Message passing from scratch, GCN, GraphSAGE, GAT and GIN, communities in a network, over-smoothing, and molecules, with an honest result against simple baselines.
- message passing
- GCN & GAT
- GIN
- over-smoothing
- readout
- molecules
Scientific Machine Learning: PINNs and Neural Operators
Put the equation in the loss: physics-informed networks against a classical solver, inverse problems, known failure modes, DeepONet and Fourier neural operators.
- finite differences
- PINN
- inverse problems
- spectral bias
- DeepONet
- Fourier neural operator
Reliable and responsible AI
Explaining a model, knowing how sure it is, keeping it fair, private and safe, and fixing the data.
Interpretability and Explainability: What Is the Model Doing?
Every explanation method is measured: SHAP, LIME, integrated gradients and Grad-CAM with sanity checks, planted shortcuts, probes, induction heads and sparse autoencoders.
- feature attribution
- Shapley values
- Grad-CAM
- sanity checks
- probes
- activation patching
- sparse autoencoders
Uncertainty, Calibration and Robustness
How sure is the model? Calibration and temperature scaling, ensembles, MC dropout, conformal prediction, distribution shift and adversarial examples with their cost.
- calibration (ECE)
- deep ensembles
- conformal prediction
- OOD detection
- FGSM & PGD
- adversarial training
Responsible AI: Fairness, Privacy and Safety
Measure what can go wrong: group fairness metrics and mitigation on census data, membership inference and DP-SGD, red teaming, text watermarking, model cards and energy.
- fairness metrics
- membership inference
- differential privacy
- red teaming
- model cards
- EU AI Act
Data-Centric AI: Better Data, Better Models
Hold the model fixed and fix the data: label noise, confident learning, leakage and duplicates, learning curves, data valuation, active learning and weak supervision.
- label noise
- confident learning
- leakage
- active learning
- weak supervision
- data monitoring
Systems and the horizon
Agents that use tools, and generalist models on the road to AGI.
Agents: Tools, Planning and Orchestration
Tools, ReAct, memory and planning around a simulated model, then seven orchestration patterns measured on the same tasks, with guardrails, evaluation and risks.
- tools & function calling
- ReAct
- guardrails
- orchestration patterns
- pass@k
- MCP
- prompt injection
Generalist Models and the Road to AGI
One transformer for images and words, a small scaling experiment with an extrapolation we then test, and a calm separation of what is measured from what is speculation.
- multimodal tokens
- scaling laws
- emergence
- reasoning
- world models
- what AGI means
Capstone
What actually worked on real wind-energy problems, and what did not.
Run it yourself
Each lesson page shows the notebook with its saved outputs, so you can read the whole course in the browser. To experiment, download a notebook or open it in Google Colab from the lesson page, or clone the repository and run everything locally:
git clone https://github.com/fborbon/academy.git
cd academy/neural-networks-1002
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
jupyter lab
The requirements file marks the heavier optional libraries. Several modules download small pre-trained models once (from a few megabytes to a few gigabytes) and cache them; each notebook says what it will download before it does.
What you need
- Neural Networks 1001 or equivalent: neurons, backpropagation, training well, convolutions, the transformer and a GPT. Each notebook lists the 1001 modules it builds on, with links.
- Python: comfortable with PyTorch tensors and a training loop (the AI frameworks module of our free Python course covers them).
- Hardware: any laptop from the last decade; everything runs on a CPU. The heaviest notebooks take 15 to 30 minutes, and a few downloads need free disk space and a connection.
Data and credits
- Most notebooks use data generated in the notebook or bundled with scikit-learn (the UCI handwritten digits, Alpaydin and Kaynak, CC BY 4.0). Others use small open datasets, each credited and licensed where it is used: MUTAG molecules, UCI Adult, Banking77, the Free Spoken Digit Dataset, LibriSpeech samples and open wind-farm data.
- Some pre-trained models carry non-commercial or gated licences (for example MusicGen weights, CC BY-NC 4.0). The notebooks say so next to each model, and the open-models module teaches how to read a licence before building on a checkpoint.
- Module 16 bundles five Spanish notebooks on real wind-energy data; some of that data is licensed for non-commercial use only, as the module explains.
Further reading
- Ouyang et al., Training language models to follow instructions with human feedback (2022) · Rafailov et al., Direct Preference Optimization (2023)
- Hu et al., LoRA (2021) · Dao et al., FlashAttention (2022) · Gu and Dao, Mamba (2023)
- Kingma and Welling, Auto-Encoding Variational Bayes (2013) · Ho et al., Denoising Diffusion Probabilistic Models (2020) · Radford et al., CLIP (2021)
- Raissi et al., Physics-informed neural networks (2019) · Kipf and Welling, Graph Convolutional Networks (2017)
- Guo et al., On Calibration of Modern Neural Networks (2017) · Lundberg and Lee, SHAP (2017)
- Yao et al., ReAct (2022)