Learning AI from Scratch: A Two-Week Hands-On Roadmap
This article presents a two-week practical roadmap for beginners learning AI from scratch. It focuses on building a minimal engineering loop that can run, be evaluated, and be reproduced, rather than trying to master every AI subfield first. The roadmap covers environment setup, tensors and shapes, training and evaluation loops, data cleaning, small-scale fine-tuning, experiment management, export and inference, and review. It also summarizes common pitfalls and engineering habits that matter for continued learning.
Learning AI from Scratch: A Two-Week Hands-On Roadmap
AI is a very broad field. Text, image, audio, multimodal, search, advertising, and recommendation each have their own knowledge systems. However, with the rapid development of large language models (LLMs), beginners now have a clearer starting point: instead of trying to cover every branch at the beginning, it is better to first build a minimal engineering loop that can run, be evaluated, and be reproduced. This article provides a two-week hands-on roadmap. The goal is not to make readers algorithm experts immediately, but to help them move from conceptual confusion to independently running a small-scale training or fine-tuning task, and to form engineering habits for further study.
1. Define the Two-Week Goal: Close the Loop, Not Build Everything from Scratch
The most common mistake beginners make is to interpret “getting started” as first finishing calculus, linear algebra, and probability, then hand-writing neural networks, and only then touching real data. A more efficient path is to organize learning in reverse: first define a small deliverable goal, then fill in the necessary knowledge around that goal.
It is recommended to break the two-week goal into four capabilities:
- Understand tensors and shapes: Know how a batch of data flows through a model and be able to locate dimension problems from error messages.
- Write a training loop: Understand the basic order of forward computation, loss function, backpropagation, parameter updates, and validation evaluation.
- Perform data cleaning: Handle missing values, duplicate samples, inconsistent labels, and isolation between training and validation sets.
- Run small-scale fine-tuning: Complete a small task based on an existing model, such as text classification, image classification, or simple question-answer matching, and provide evaluation results.
The corresponding deliverable can be a small project: prepare hundreds to thousands of samples, choose a pretrained model with a moderate number of parameters, and complete data cleaning, training, validation, export, and one batch inference run. The focus should be reproducibility, not leaderboard metrics.
2. Two-Week Roadmap: Day-by-Day, Small to Large
Days 1–2: Minimal Environment and Project Skeleton
On the first day, do not rush to install a large number of tools, and do not build a complex platform from the beginning. First prepare a minimal runtime environment: script runtime, dependency management, data directory, configuration files, and log directory. If conditions allow, use a general-purpose GPU instance; if not, first run the process on CPU with a small model and small data.
Keep the project skeleton simple:
project/data/train.csvvalid.csvconfigs/base.jsonsrc/train.*evaluate.*predict.*outputs/logs/checkpoints/
The configuration file should record data paths, batch size, learning rate, number of training epochs, random seed, and output directory. The benefit is that later parameter tuning does not require code changes, and experiment records are clearer. On the second day, use a very small sample to run through the chain of “read data—forward computation—output result” and eliminate environment issues first.
Days 3–4: Build Intuition for Tensors and Autograd
At this stage, only three things need to be mastered: what a tensor is, how shapes change, and how gradients propagate. A tensor can be understood as a multidimensional array; the batch dimension is usually placed first. For example, a common shape in image tasks is [B, C, H, W], and a common shape in text tasks is [B, T, D]. Here B is batch size, C is the number of channels, H/W are spatial dimensions, T is sequence length, and D is feature dimension.
The core of automatic differentiation is the chain rule. At the introductory stage, it is enough to understand that “the loss has gradients with respect to parameters, and the optimizer updates parameters based on gradients.” There is no need to hand-write complete backpropagation with basic numerical libraries. Spending time on engineering issues such as computation graphs, vanishing and exploding gradients, the effect of learning rate, and gradient clipping is more valuable.
The following pseudocode can be used to build minimal understanding:
function train_step(batch):x, y = batch // x: [B, ...], y: [B]logits = model(x) // logits: [B, num_classes]loss = loss_fn(logits, y) // loss: scalarloss.backward() // compute gradientsoptimizer.step() // update parametersoptimizer.zero_grad() // clear gradientsreturn loss
Days 5–6: Run the Training Loop and Evaluation Process
The training loop is the backbone of AI engineering. It is important to be clear: the training set is used to update parameters, the validation set is used to select models and perform early stopping, and the test set is only used for final evaluation. The loss function should match the task; cross-entropy is commonly used for classification tasks, and mean squared error is commonly used for regression tasks. The optimizer updates parameters according to gradients, and the learning rate is one of the most important hyperparameters.
At this stage, develop three habits:
- Run a baseline first: Obtain baseline metrics with a simple model or default configuration before discussing optimization.
- Experiment in small steps: First use a small batch and few epochs to confirm the process is correct, then scale up.
- Record metrics: Record training loss, validation loss, validation accuracy, or F1 score. Do not only look at whether training loss decreases.
During evaluation, ensure metrics match business goals. When classes are imbalanced, accuracy may be misleading; analyze precision, recall, F1 score, or a confusion matrix together.
Day 7: Data Cleaning and Data Pipeline
Data quality often affects final results more than model architecture. Check for missing values, duplicate samples, outliers, label consistency, text length distribution, corrupted images, and leakage between training and validation sets. For tabular data, general table-processing and numerical computing libraries can be used for deduplication, missing-value filling, type conversion, and statistical analysis. For text and image data, check encoding, resolution, truncation length, and annotation standards.
A practical habit is to output a data summary before training, including sample count, class distribution, length distribution, missing ratio, and duplicate ratio. Add shape assertions for each batch:
assert x.shape[0] == y.shape[0]assert x.shape[1:] == expected_feature_shape
Data cleaning is not a one-time task; it should be solidified into repeatable scripts. In this way, when data is updated, the process can be rerun quickly and distribution changes can be compared.
Days 8–10: Complete Small-Scale Fine-Tuning
Fine-tuning is more suitable for beginners than training from scratch. Choose a small pretrained model, freeze some layers or use a smaller learning rate, and train for a small number of epochs on your own data. Text tasks can use classification or matching, and image tasks can use small-class classification. Key parameters include batch size, learning rate, number of epochs, weight decay, and early stopping strategy.
At the fine-tuning stage, avoid two extremes: first, a learning rate that is too large causes the model to diverge; second, too little data with too much training causes overfitting. Continuously monitor validation metrics and save the best checkpoint. If GPU memory or RAM is insufficient, reduce batch size, shorten sequence length, or lower model size.
Days 11–12: Experiment Management and Tuning
Tuning is not random parameter trying; it is controlling variables. It is recommended to fix the random seed and record the configuration, data version, code version, and metrics of each experiment. Change only one variable at a time, such as only the learning rate or only the batch size; otherwise, it is impossible to determine where the gain comes from.
A common tuning order is: first confirm that data and evaluation are correct, then tune learning rate and batch size, then address overfitting or underfitting, and finally consider model size. If validation performance is clearly lower than training performance, prioritize regularization, early stopping, and data augmentation. If both are low, first check underfitting, a learning rate that is too small, or insufficient feature representation.
Days 13–14: Export, Inference, and Review
Use the last two days to complete model export and a batch inference script, and verify whether new samples can produce stable outputs. If cloud deployment is needed, general GPU instances, object storage, logging services, and monitoring and alerting cloud service categories can be used, but focus on permission isolation, cost alerts, data masking, and access auditing. Do not expose an experimental model directly to real users without evaluation.
During review, answer four questions: Is the data trustworthy? Is the evaluation reasonable? Is training reproducible? Is inference stable? These four questions are more important than “how new the model is.”
3. Four Pitfalls to Avoid: Spend Time Where It Matters
1. Converge on One Framework, Prefer Mainstream Dynamic-Graph Solutions
At the introductory stage, do not learn multiple deep learning frameworks at the same time. Prefer a mainstream solution whose debugging experience is close to ordinary scripts, whose dynamic-graph mechanism is intuitive, and which has rich community resources. Dynamic graphs make line-by-line debugging and printing intermediate tensors convenient, which is suitable for locating problems. After running through the complete loop, expand according to team requirements. Avoid spending a large amount of time switching frameworks.
2. Understand Autograd; Do Not Hand-Write Backpropagation
Hand-writing backpropagation is suitable as a learning exercise, but it is not a required beginner task. What really needs to be mastered is: how to design the loss function, how gradients are produced, how the learning rate affects updates, and how to troubleshoot gradient anomalies. After understanding the chain rule and computation graph concepts, focus energy on data pipelines, model architecture, evaluation methods, and experiment management.
3. Shape Management Is an Engineering Skill, Not a Minor Issue
Many errors in deep learning code come from dimension mismatches. When writing each network layer, annotate input and output shapes in comments, for example [B, C, H, W] -> [B, num_classes]. Add assertions for key tensors, and when printing shapes, print both the batch dimension and feature dimensions. With shapes in mind, debugging efficiency improves significantly.
4. Data Cleaning Is the Long-Term Moat
Model architectures converge, and public solutions are reproduced quickly. What truly determines the upper limit of results is often data quality. Learn to perform deduplication, missing-value handling, label validation, hard-case analysis, and distribution comparison. Proficiency with general table-processing and numerical computing tools is more useful for solving practical problems than memorizing formulas.
4. Build Engineering Habits Early
In addition to technical knowledge, it is recommended to build engineering habits from the first day: externalized configuration, complete logs, fixed random seeds, traceable data versions, independent evaluation scripts, and recoverable checkpoints. Do a small review at least once a week: which experiments were effective, which errors recurred, and which data issues most affected metrics. In this way, after two weeks, what remains is not just a model file, but a method that can continue to be iterated.
5. Conclusion
Getting started with AI does not require becoming a math PhD first, nor does it require covering every branch from the beginning. A more realistic path is: choose a small task, build a minimal loop of data, training, evaluation, and inference, and then gradually fill in theory, expand data, and change models. Two weeks is enough for a beginner developer to move from “not understanding” to “being able to run their own small-scale fine-tuning task.” What really creates a gap is engineering ability such as shape management, data cleaning, experiment reproducibility, and evaluation awareness. Once these foundations are solid, moving into text, image, multimodal, or search and recommendation directions later will be much more comfortable.
