Machine learning roadmap for beginners (2027)
A seven-stage machine learning roadmap from Python to deployed models, with a free resource type per stage, a done test for each, and three portfolio projects.
Here is the machine learning roadmap I'd give a colleague who can already write software: Python and the data stack, then just enough maths to read a gradient, then classical ML before any neural network, then PyTorch, then transformers and LLM APIs, then the engineering that makes a model survive production, then the security basics nobody used to teach. Seven stages, in that order, with a free resource type for each and a test that tells you when to move on.
The order matters more than the pace.
I'm a software engineer, not a researcher, and that shapes this roadmap. I care about whether you can build a thing that works, measure it, and keep it working.
The machine learning roadmap in seven stages
| Stage | What you learn | How you know you're done |
|---|---|---|
| 1. Python and the data stack | Python, NumPy, pandas, plotting | You can load a messy CSV, clean it and describe it without searching for syntax |
| 2. The maths you actually need | Linear algebra, probability, calculus for gradients | You can explain what a gradient is and why we step against it |
| 3. Classical ML | Regression, trees, evaluation, overfitting | You can tell when a model is lying to you |
| 4. Neural nets and PyTorch | Layers, loss, backprop, training loops | You've trained a small net from scratch and debugged it |
| 5. Transformers and LLM APIs | Attention, tokens, prompting, retrieval | You can build something useful on an LLM and explain its failure modes |
| 6. ML engineering | Pipelines, deployment, monitoring | A model you built is running somewhere and you'd know if it broke |
| 7. Security and safety | Prompt injection, data leakage, model supply chain | You can threat-model your own project |
Stage 1 and 2: Python, the data stack, and the maths
Python and the data stack. If you already code in something else, Python itself is a week. The data stack is the real work: NumPy for arrays and vectorised maths, pandas for tables, matplotlib for looking at what you've got. Learn to think in arrays rather than loops, because every ML library assumes you do. Learn pandas well enough to group, join, pivot and handle missing values without a search engine open.
Free resource type: the official NumPy and pandas documentation, specifically the getting-started and user guide sections. Pair them with a public dataset from Kaggle or a government open-data portal.
Done test: load a dataset you've never seen, find its three worst data quality problems, fix them, and produce one plot that tells a true story.
The maths you actually need. You don't need a maths degree. You need three things, each at a specific depth.
Linear algebra: vectors, matrices, matrix multiplication, dot products, and the idea that a matrix is a function that transforms space. You need to read W @ x + b and know what shapes come out. Eigenvalues can wait.
Probability and statistics: distributions, conditional probability, expectation, variance, and Bayes' rule at the level of applying it.
Calculus: derivatives, partial derivatives, the chain rule. The target is to understand what a gradient is (the direction of steepest increase of a function with many inputs) and why gradient descent steps the other way. The chain rule is why backpropagation works. That's the whole reason to learn calculus here. Integrals can wait.
Free resource type: 3Blue1Brown's video series on linear algebra and on neural networks, Khan Academy for calculus and probability refreshers.
Done test: write out, on paper, how a change to one weight in a two-layer network changes the loss, using the chain rule. If you can do that for a tiny network, you understand gradients well enough to start.
Stage 3: classical machine learning before any deep learning
This is the stage people skip, and it's the stage that teaches you to distrust your own results.
Learn in this order: linear regression, logistic regression, decision trees, random forests, gradient-boosted trees, k-means, all in scikit-learn. Each teaches a different idea: regression teaches loss and fitting, trees teach non-linear splits and feature importance, ensembles teach why averaging many weak models beats one strong one.
The important part isn't the models. It's evaluation.
Learn train/validation/test splits and why you need all three. Learn cross-validation. Learn precision, recall, F1 and confusion matrices, and when accuracy is a useless number (any imbalanced dataset). Learn what overfitting looks like on a learning curve, and the two ways out: more data or more regularisation. Learn data leakage, which is when information from the test set sneaks into training through a feature, a preprocessing step or a time ordering, and makes a bad model look brilliant.
I check for leakage before I believe any result that looks too good. A near-perfect score on a hard problem is nearly always leaking, not learning.
Free resource type: the scikit-learn user guide, the free online edition of a well-known introductory statistical learning textbook, and Andrew Ng's introductory machine learning course on Coursera.
Done test: take a tabular classification problem, build a baseline (predict the majority class), beat it with logistic regression, beat that with a gradient-boosted tree, then write one honest paragraph on what the model gets wrong and why.
For most business problems this is where you'd stop. A boosted tree on tabular data beats a neural network far more often than people admit.
Stage 4 and 5: neural networks, PyTorch, transformers and LLM APIs
Neural networks and PyTorch. Read Mukul's explanation of what a neural network is first. Then build one. Not with a high-level wrapper: write the forward pass, the loss and the training loop yourself in PyTorch so you see tensors, autograd, optimisers and batches as separate things.
Go from a multilayer perceptron, to a convolutional network on images, to an attention layer. At each step, break it on purpose: set the learning rate too high, remove normalisation, shrink the dataset, and watch the loss curve. Debugging a training run is a skill you only get by having runs go wrong.
Free resource type: the official PyTorch tutorials, especially the learn-the-basics sequence, and Andrej Karpathy's free video series building neural networks from scratch.
Done test: train an image classifier on a standard small dataset from scratch, get a reasonable result, then explain the gap between your training and validation loss and what you'd try next.
Transformers and LLM APIs. Read Mukul's posts on what a transformer is and on RAG. Then understand three things at mechanism level: tokenisation (the model sees tokens, not words, which explains a lot of odd behaviour), attention (every token can look at every other token and weigh it), and the fact that a language model is a next-token predictor with scaffolding on top.
Then learn to use an LLM API well, which is a different skill from training one: system versus user messages, what temperature actually controls, tool calling, retrieval, and above all evaluation. Prompt changes without an eval set are guesswork.
Free resource type: the official API documentation of whichever provider you use, and the Hugging Face course on transformers.
Done test: build a question-answering tool over your own documents with retrieval, write an eval set of twenty questions, and measure how often it answers correctly and how often it makes something up. You're done when you can state both numbers and explain the main reason for each failure.
Stage 6 and 7: the engineering, and the security basics
ML engineering. A model in a notebook is a prototype. The job is the rest.
Data pipelines: how data gets from where it lives to where the model trains, how it's versioned, how you know when it changed. Training pipelines: reproducible runs, logged hyperparameters, saved artefacts. Deployment: wrapping a model in an API (FastAPI is the common choice in Python), containerising it, serving it. Monitoring: tracking prediction distributions over time so you notice drift, which is when the world changes and your model quietly gets worse without ever throwing an error.
Free resource type: the official docs for FastAPI, Docker and an experiment tracker such as MLflow. The Made With ML course covers the full MLOps loop.
Done test: a model you trained is behind an HTTP endpoint, in a container, with a health check, and a log or dashboard would tell you within a day if its input distribution shifted.
Security and safety basics. This stage wasn't on roadmaps a few years ago and now can't be left off.
An ML system has new trust boundaries. Training data is an input an attacker may be able to influence (data poisoning). Model weights and the libraries that load them are a supply chain, and some model file formats can execute code on load, which is why safer serialisation formats exist. Prompts are inputs that get mixed with instructions, which is the mechanism behind prompt injection: Kushagra's post on what prompt injection really is is the one to read, and Simon Willison coined both that term and the "lethal trifecta" framing for when an agent becomes dangerous.
Then the data side. Everything you send to a hosted model is a disclosure, which matters when your prompts contain customer data. Model outputs can leak training data. And a model that makes decisions about people needs evaluating for the ways it can be unfair, not just inaccurate.
Free resource type: the OWASP Top 10 for LLM Applications at owasp.org and the MITRE ATLAS knowledge base of adversarial ML techniques. Run anything you build through the AI Audit before you show it to anyone; it's a browser-side checklist against the OWASP list and it'll surface what you forgot.
Done test: for your stage 5 project, write a one-page threat model. Who can influence the documents it retrieves? What happens if one contains instructions? What data does the model see that it shouldn't? Answer those three and you're ahead of many working ML engineers.
If security is the part that interests you most, Rohan's cybersecurity roadmap is the companion to this one, and Komal's comparison of the three careers is worth reading before you commit to either.
Three portfolio projects, and what each one proves
A portfolio is proof, not decoration. Three projects is enough. Each needs a README that states the problem, the baseline, the result, and what went wrong.
Project one: a tabular prediction with honest evaluation. A public dataset with a real target (house prices, loan defaults, anything with a stake). Baseline, classical models, a proper write-up including the leakage check and where the model fails. This proves stage three, and it's the project hiring managers actually read.
Project two: a neural network trained from scratch with a debugging log. An image or text classifier in PyTorch, training loop written by you. The artefact that matters is the log of what went wrong and how you fixed it.
Project three: an LLM application with an eval set and a threat model. A retrieval-based assistant over a document set, a twenty-question eval set, measured accuracy and hallucination rates, a one-page threat model, deployed in a container behind an endpoint. This proves stages five, six and seven at once, and it separates "did a course" from "can ship".
Put all three in public repositories. Keep the data out of git and scan for secrets before you push; an API key in a commit is the commonest way a portfolio project becomes a security incident.
What this roadmap doesn't cover: reinforcement learning, the maths needed to read current papers fluently, and any one cloud provider's ML platform. All three are stage eight, which is yours to choose.
Frequently asked questions
How long does this machine learning roadmap take? It depends on where you start and how many hours a week you have, so I won't give a number. Expect classical ML to be the longest stage, because it's where you build judgement rather than knowledge. Rushing it is how people end up with impressive-looking projects that don't survive questions.
Do I need a degree in maths or computer science? No. You need the stage two maths at the depth described, and you need to be able to write software. A degree gets you both faster, but plenty of good ML engineers got there without one.
Should I skip classical ML and go straight to LLMs? I think that's the most expensive mistake on the list. Classical ML is where you learn evaluation, overfitting and leakage, and those are what stop you fooling yourself with a neural network or an LLM later.
Where does security fit if I just want to build models? Everywhere you'd rather it didn't. If your model takes input from users or documents, it has a prompt injection surface. If it loads weights from the internet, it has a supply chain. Read the lethal trifecta post to see why a helpful agent can become a data exfiltration channel.
Start today with stage one: open the pandas getting-started guide, download one dataset, and find the three worst problems in it.