The History of AlexNet: From the ImageNet Challenge to Modern Vision AI
Modern artificial intelligence has a clear starting point. On 30 September 2012, a neural network called AlexNet won the ImageNet image-recognition contest and did not just win, it left every other entry far behind. Until that day most researchers treated deep learning as a nice idea that could not be made practical. After it, the field changed direction. This article tells that history in order: the people and the dataset behind ImageNet, the contest, the network itself, the techniques it made famous, and the long line of ideas that grew out of it, all the way to today's generative, multimodal and robotic systems.
Where the story began: Fei-Fei Li, WordNet and Mechanical Turk
In 2006 computer vision was an under-funded field and most researchers were busy building cleverer models. Progress came every year, but slowly. Fei-Fei Li had just finished her PhD in computer vision at Caltech and started as a computer science professor at the University of Illinois Urbana-Champaign. She noticed that everyone focused on models and almost nobody on data. Her view was that bigger datasets, reflecting the real diversity of the world, could be the key to better models.
While reading about datasets she learned of Professor Christiane Felbaum, who had co-developed WordNet in the 1980s, a collection of English words arranged in an ontology, a tree of ever more general categories. The two met in 2007. Felbaum described her work on attaching a reference picture to every word in WordNet, and that sparked the idea of a huge image collection built on the same structure. Li put together a team to build it. The result was ImageNet.

The idea was that a large ontology of images, based on WordNet, could open the way to advanced content-based image retrieval and understanding. The first version appeared about two years later with 12 million images, organised and labelled according to WordNet. The scale of the job is easy to feel: one person labelling one image a minute, doing nothing else for two years, not even sleeping or eating, would have needed 22 years and 10 months. To finish in under two years, Li turned to Amazon Mechanical Turk, a crowdsourcing platform where anyone can hire people around the world to do small tasks cheaply.
The ImageNet team asked these “Turkers” to decide whether a picture showed a given WordNet word or not, and used several safeguards, such as collecting more than one Turker's score for every image and word pair. Even so, when ImageNet was released it was the largest publicly available labelled image dataset in the world, and almost nobody cared. After it was shown as a poster at the CVPR conference, the team had to find another way to draw attention.
ImageNet: the dataset
ImageNet is a large collection of annotated photographs made for computer vision research. Its stated aim was to give researchers a resource that would speed up better methods, in the words of its founding paper, a large-scale ontology of images as a critical resource for advanced image search and understanding, and for training and benchmarking such algorithms. When the paper came out in 2009 the dataset held 12 million images across 22,000 categories. Current figures on its homepage describe a little over 14 million images, a little over 21 thousand classes (called synsets) and a little over a million images that also carry bounding boxes drawn around the objects in them.

Because it reused the WordNet structure, the pictures roll up into more and more general categories. People annotated the photographs through crowdsourcing platforms such as Mechanical Turk, and the project was run by academics at Princeton, Stanford and other American universities. One legal detail matters: the project does not own the photographs, the copyright holders do, so the dataset is not handed out directly. Instead, people receive the web addresses of the images.
There were rivals. The best known was the Extra Sensory Perception (ESP) dataset, which also used crowdsourcing, through the “ESP game” in which two partners tried to match words to pictures and in doing so created labels. Most of ESP was never made public. Of the 60 thousand images that were, ImageNet gave much larger and denser coverage for many terms, and ESP was later found to be fundamentally flawed. Apart from a re-licensed version used in Google Image search, it had little effect on AI.

At first, ImageNet and similar datasets drew very little interest. Hardly anyone believed that more data could make models better. Many researchers called it too big and too complicated. Looking back that sounds odd, but at the time models struggled even on datasets with 12 categories, so 22,000 categories must have looked absurd.
The ImageNet Challenge (ILSVRC)
The way out was a contest. The ImageNet Large Scale Visual Recognition Challenge, or ILSVRC, ran every year from 2010 to 2017 and used subsets of ImageNet. Its goals were to encourage better computer vision techniques and to measure the state of the art. The contest is often just called the ImageNet Competition. Entrants had to classify images and find objects and scenes across a trimmed list of 1,000 categories, such as dogs, cars and musical instruments, and each year the team with the lowest error rate won.
Before the contest, computer vision leaned on slow, hand-built feature extractors such as SIFT and HOG. The challenge became the world's standard yardstick for progress in computer vision and AI. It covered several tasks:
- Image classification: predict which classes of objects are in a picture.
- Single-object localization: classify, then draw a bounding box around one example of each object present.
- Object detection: classify, then draw a bounding box around every object present.
The annotations came in two kinds: image-level labels saying whether an object class is present or absent, and object-level labels giving a tight bounding box and a class around a specific object. The datasets held roughly 1 million images and 1,000 object classes, and were published so that universities and companies could all take part. For each year an annotated training set was released together with an unlabelled test set. Entrants trained on the first, predicted labels for the second and sent them to an evaluation server, and the results were revealed at the end of the contest period. A typical split was 1 million training images, 50,000 for validation and 150,000 for testing. Winners presented at an annual workshop at a computer vision conference so that successful techniques would spread. The data for each year is still available, though you must register. In recent years the tasks have been moving to harder problems, such as labelling video.
Scale made ILSVRC the main benchmark in computer vision, and researchers began to accept that more data could be a good thing. The speed of improvement in the first five years was dramatic, perhaps even shocking to the field. Most of the progress came from large, deep convolutional neural networks running on graphics processing units (GPUs), and that success pulled deep learning out of the lab and into the mainstream.

30 September 2012: AlexNet wins
On 30 September 2012 the new ILSVRC results came out, and one entry stood far apart. AlexNet, built by Alex Krizhevsky, Ilya Sutskever and Geoffrey Hinton at the University of Toronto and described in their paper “ImageNet Classification with Deep Convolutional Neural Networks”, reached a top-5 error rate of 15.3%. The runner-up was around 25.7% to 26%, roughly ten percentage points behind, and AlexNet was the first model to score below 25%. It had done this with a deep convolutional neural network (CNN), a design most people had dismissed as impractical. In the authors' own words, they had trained one of the largest convolutional networks to date on the ILSVRC subsets and obtained by far the best results ever reported on them.


This was the first widely accepted, successful use of deep learning. Until then deep learning was an idea that most people thought impractical; AlexNet showed it was more than a pipe dream and showed the world how to make it practical. Still, AlexNet alone did not cause the surge that followed. Without the huge ImageNet dataset there would have been no AlexNet. The future of AI was built on the base that the ImageNet challenge set, and on the new solutions that let ImageNet and AlexNet work together.

What AlexNet was and how it worked
AlexNet is a convolutional neural network. A CNN uses convolutional layers stacked on top of each other: the first layers pick up simple features such as edges, shapes and textures, and as the network gets deeper it builds more abstract ideas, until it can recognise things from mammals to dogs to Siberian huskies. CNNs are known for strong results on image data with little preprocessing or hand-made feature extraction. They work best with many layers and lots of data, which is exactly why they had been overlooked: shallow versions had no edge over other networks, and deep versions were too expensive to compute.

The conditions finally lined up. ImageNet supplied the huge amount of data a deep CNN needs. A few years before, Nvidia had released CUDA, an API that let software use highly parallel GPU processing, and GPU power had reached the point where training AlexNet's 60 million parameters was practical with more than one GPU. The authors were, as it turned out, the right people in the right place at the right time.
AlexNet was far from small, and the authors had to solve many problems to make it work. It had eight layers: five convolutional layers followed by three fully connected (linear) layers. To produce the 1,000-way classification ImageNet needs, the last layer used a 1,000-node softmax, which gives a probability for each of the 1,000 classes. In total it held about 60 million parameters and 650,000 neurons. It was split across two Nvidia GPUs, each handling half of the network, and the two halves exchanged information in particular layers so that they did not become two separate models.

A key lesson was that depth made the difference. Depth means a lot of parameters, which makes training impossibly slow on a CPU. GPUs made it practical, although top GPUs at the time had only about 3 GB of memory, not enough for AlexNet, which is why it had to be spread over two cards.
The tricks AlexNet made famous: ReLU, dropout and more
Several techniques that AlexNet popularised are now standard everywhere.
ReLU (Rectified Linear Unit)
An activation function decides whether a neuron in the network should “fire” and pass information on. ReLU follows a very simple rule, f(x) = max(0, x): if the input is negative the output is 0, and if it is positive the number passes through unchanged. Older functions such as sigmoid and tanh needed heavy mathematics and made the learning signal shrink towards zero in deep networks. Because ReLU is only a comparison, AlexNet trained about six times faster than it would have with the traditional functions. In the paper's own test, a four-layer CNN with ReLU reached a 25% error rate on the CIFAR-10 dataset six times faster than the same network with tanh. ReLU also does not need normalisation to stop activations piling up at extreme values, although AlexNet still added a different normalisation called Local Response Normalization (LRN), which lowered top-1 and top-5 error by 1.4% and 1.2%.


Dropout
Deep networks have millions of parameters, so it is easy for them to memorise the training pictures instead of learning general rules. This problem is called overfitting. During every training step, dropout randomly switches off a share of the neurons, typically 50% in AlexNet, and those neurons cannot send or receive signals in that pass. Since a neuron can never count on its neighbours being active, the network is pushed to learn independent, robust features along many different paths. When training ends and the model is used for real predictions, all the neurons are switched back on.
Data augmentation and overlapping pooling
AlexNet also used data augmentation, creating extra training examples by flipping and cropping images. It used overlapping pooling too. Pooling summarises a group of activations in one layer into a single activation in the next. In overlapping pooling the window overlaps the previous one as it slides across the layer, and AlexNet found this improved top-1 and top-5 error by 0.4% and 0.3% and reduced overfitting.

A taste of AlexNet in code
The Pinecone walkthrough runs the pretrained AlexNet from PyTorch on a small ImageNet sample. Images are converted to RGB, resized and cropped to 224×224, turned into tensors and normalised with mean [0.485, 0.456, 0.406] and standard deviation [0.229, 0.224, 0.225], then stacked into a batch of 50. The model returns 1,000 scores (logits) per image and the highest one is the predicted class. On the 50 goldfish images it got 72% right, a 28% error for that single class, better than the 37.5% average reported in the paper, though accuracy varies from class to class.
After AlexNet: the ILSVRC milestones
AlexNet set off a rapid scale-up of neural networks: more layers, better ways of moving information through them. Each year of the contest produced a technique that is still taught today, and the papers behind them became required reading.
- ILSVRC-2012, AlexNet (SuperVision): Krizhevsky and colleagues from the University of Toronto reached the best results on the ILSVRC-2010 and 2012 classification tasks and sparked interest in deep learning for vision.
- ILSVRC-2013, ZFNet (Clarifai): Matthew Zeiler and Rob Fergus proposed a variation of AlexNet in “Visualizing and Understanding Convolutional Networks”, and a version of it won the 2013 classification task.
- ILSVRC-2014, Inception (GoogLeNet): Christian Szegedy and colleagues at Google won object detection with a model built on the inception module, described in “Going Deeper with Convolutions”. It set a new state of the art for classification and detection that year.
- ILSVRC-2014, VGG: Karen Simonyan and Andrew Zisserman of the Oxford Vision Geometry Group won classification and localization with VGG, in “Very Deep Convolutional Networks for Large-Scale Image Recognition”. Their architectures were much more accurate and also worked well on other image datasets, even inside fairly simple pipelines.
- ILSVRC-2015, ResNet (MSRA): Kaiming He and colleagues at Microsoft Research won object detection and detection with localization with the Residual Network in “Deep Residual Learning for Image Recognition”. An ensemble of residual nets reached 3.57% error on the ImageNet test set and took first place in classification.
The contest was held every year until 2017. By then 29 of 38 entrants had an error rate under 5%, a measure of how far computer vision had come in the ImageNet years. Microsoft Research Asia displaced AlexNet as winner in 2015, and many more CNN designs have come and gone since.
AlexNet versus VGGNet and ResNet
| Feature | AlexNet (2012) | VGGNet / VGG-16 (2014) | ResNet / ResNet-50 (2015) |
|---|---|---|---|
| Total layers | 8 layers | 16 to 19 layers | 50 to 152 layers |
| Filter sizes | Large mixed filters (11×11, 5×5, 3×3) | Uniform small filters (3×3 only) | Mostly 3×3 and 1×1 bottleneck filters |
| Parameters | ~60 million | ~138 million (heavy memory use) | ~25.6 million (much more efficient) |
| Top-5 error rate | 15.3% | 7.3% | 3.57% (surpassed human performance) |
| Key innovation | GPU training, ReLU, and dropout | Stacking small filters for uniform depth | Skip connections (residual blocks) |
VGGNet's contribution was the finding that stacking several small 3×3 filters covers the same patch of picture as one large filter, with fewer parameters and more non-linear learning steps. The price was that VGGNet became slow and hungry for memory. ResNet answered a different problem: simply adding more layers eventually made networks break down in training, known as the vanishing gradient problem. ResNet used skip connections, also called residual blocks, which let data bypass some layers so the network can grow past 100 layers without losing its training signal.
The lesson of this period was that AlexNet's core training techniques, ReLU and dropout, stayed foundational in modern AI even after the architecture itself was replaced by deeper, more efficient ones.
Beyond convolutions: Vision Transformers
The next big step came from Google researchers in 2020, in the paper “An Image is Worth 16x16 Words”. Vision Transformers (ViTs) swapped convolutional sliding windows for self-attention, so a model can look at the whole image at once instead of building it up pixel by pixel. They showed that the same Transformer architecture behind large language models such as GPT can beat CNNs such as ResNet when used at scale.
How a Vision Transformer works
- Splitting into patches: the model cuts the 2D image into a grid of small fixed squares, typically 16×16 pixels. Each patch is flattened into a list of numbers and acts like a word token in a text model.
- Adding position embeddings: a Transformer handles all patches at once, so it does not know where each came from. A position embedding, a spatial coordinate tag, is attached to every patch so the model remembers whether it was in the top-left corner or the centre.
- Self-attention layers: patches pass through standard Transformer encoder layers where every patch compares itself with every other patch to learn how they relate, for example linking a dog's ear in one corner with its tail in another.
- Classification token: a special extra token, often called [CLS], gathers summary information from all patches through the layers, and a final classifier head uses it to name the object.
Vision Transformers compared with CNNs
| Feature | CNNs (e.g. ResNet) | Vision Transformers (ViTs) |
|---|---|---|
| Core mechanism | Convolutions: small filters sliding across local pixel neighbourhoods. | Self-attention: comparing every image patch with every other patch. |
| Field of view | Local first: starts with tiny edges and textures and slowly combines them into shapes in deeper layers. | Global immediately: sees relationships across the whole image from the very first layer. |
| Built-in assumptions | Strong inductive bias: assumes nearby pixels are closely related and objects look the same wherever they are. | Minimal inductive bias: has to learn spatial relationships from scratch using huge amounts of data. |
| Data efficiency | Trains well on small to medium datasets such as standard ImageNet. | Struggles on small datasets but beats CNNs when pre-trained on tens or hundreds of millions of images. |
| Compute scaling | Faster and lighter at standard, smaller image sizes. | Scales smoothly with huge compute and data, which makes it ideal for multimodal AI that combines vision and text. |
Why Vision Transformers changed AI
- Unified architecture: ViTs erased the boundary between computer vision and natural language processing. Because text and images now use the same Transformer backbone, researchers could easily build multimodal models, such as modern Gemini or GPT-4o, that understand text, photos and video together.
- Hybrid evolution: the rivalry also sparked hybrids. Models like ConvNeXt updated classic CNNs with Transformer design tricks, while architectures like Swin Transformer brought sliding local windows back into Vision Transformers to make them faster on high-resolution images.
Self-attention, with a simple example
Self-attention calculates how much focus each image patch (or word) should place on every other patch, using matrix multiplication. Imagine an image split into just three patches: Patch A (a dog's ear), Patch B (a dog's nose) and Patch C (green grass). To understand the scene, Patch A needs to work out how strongly it relates to Patches B and C.
- Create queries, keys and values. For every patch the model makes three vectors (lists of numbers) by multiplying the patch data by learned weights. The Query (Q) is what this patch is looking for, for example “I am an ear, looking for facial features”. The Key (K) is what this patch contains, for example “I am a nose” or “I am grass”. The Value (V) is the actual visual information in the patch that gets passed forward.
- Calculate similarity scores. Patch A compares its Query with the Keys of all patches using a dot product (multiply matching numbers and add them up). Ear Query · Nose Key gives a high score, say 8.0, because ears and noses often appear together. Ear Query · Grass Key gives a low score, say 1.0, because they are less directly connected.
- Scale and apply softmax. The raw scores are divided by the square root of the key size, to keep the numbers stable, and passed through a softmax function that turns them into percentages adding up to 100%. In the example: attention on itself (ear) 20%, on the nose 70%, on the grass 10%.
- Weighted sum. Patch A updates its own representation by blending the Values of all patches by those percentages: New Ear Representation = (0.20 × V_ear) + (0.70 × V_nose) + (0.10 × V_grass). Because 70% of its new information comes from the nose, Patch A now knows it is not just an isolated triangle but part of a dog's face.
How multimodal models combine vision and text
Because Vision Transformers turn images into tokens just as language models do for words, modern AI systems can merge both media types into one stream. There are two main ways.
Approach A: contrastive alignment (CLIP)
Used heavily for image search and image generation, this method trains a Vision Transformer and a Text Transformer side by side. The model receives millions of image-caption pairs, such as a photo of a Golden Retriever and the text “a happy dog”. Both encoders convert their inputs into vectors of exactly the same length, in a shared embedding space. Training pushes matching image and text vectors close together and mismatched pairs far apart. The result is a model that learns that the visual pattern of a Golden Retriever and the words “happy dog” mean the same thing.
Approach B: unified multimodal LLMs (Gemini, GPT-4o)
Used by modern AI assistants that can look at a photo and answer questions about it, this approach feeds image tokens directly into a Large Language Model.
- Vision encoder: a Vision Transformer processes the image and outputs a sequence of visual patch tokens.
- Projection adapter: a small translator layer, often a simple neural network, reshapes the visual tokens so their dimensions match the language model's word tokens.
- Single-sequence processing: the model lines up visual tokens and text tokens one after another, for example [IMG_1] [IMG_2] [IMG_3] “What breed is this dog?”, and runs self-attention across all of them at once.
- Result: every word of your question attends directly to the relevant patches of the image, so the model can give a text answer grounded in what it sees.
How diffusion models generate images from text
Diffusion models, such as Stable Diffusion, Midjourney and FLUX, work by learning how to reverse the destruction of an image.
Phase 1: training, adding and removing noise
- Forward diffusion: during training, the model takes a real image and slowly adds random static (Gaussian noise) over hundreds of steps until the image is pure, unrecognisable snow.
- Reverse diffusion: a neural network, traditionally a U-Net or a Diffusion Transformer (DiT), is trained to look at a noisy image at any step and predict which pixels are static, so it can subtract them.
Phase 2: generation, text to image
When you type a prompt like “an astronaut riding a horse on Mars”, the model builds an image from scratch in three steps.
- Text encoding: a text encoder (like CLIP or T5) converts your prompt into numerical vectors that represent the concepts “astronaut”, “horse” and “Mars”.
- Cross-attention guidance: starting from a canvas of 100% random noise, the denoising network runs 20 to 50 cleanup steps. At every step, cross-attention layers inject your text vectors into the image grid and steer the cleanup so the emerging shapes match your words.
- Latent decoding: to save a lot of computing power, modern models do this cleanup in a compressed mathematical space called latent space, and a final decoder (VAE) expands the result into crisp, full-resolution pixels.
Learning without labels: self-supervised learning
In the original 2012 ImageNet era, humans had to label millions of photos by hand. Self-supervised learning (SSL) removes that bottleneck by turning the image itself into a fill-in-the-blank quiz, so Vision Transformers can learn visual concepts from raw, unlabelled images.
Method A: masked image modeling (MAE)
Inspired by how language models like BERT learn by guessing missing words in a sentence, Masked Autoencoders hide parts of a picture. The model splits an image into patches and randomly hides 75% of them. The Vision Transformer sees only the remaining 25% and must reconstruct the missing pixels from scratch. To paint in the missing 75% accurately it cannot rely on simple colour matching. It is forced to learn deep structural rules: if it sees two wheels and handlebars, the hidden patches in between must hold a bicycle frame.
Method B: self-distillation and contrastive learning (DINO, DINOv2)
Developed by Meta AI, DINO trains a Vision Transformer to recognise that different views of the same object share the same meaning. The system takes a single unlabelled photo and makes several distorted crops, such as a zoomed-in close-up of a dog's face and a wide shot of the whole dog. Two identical Vision Transformers, a Student and a Teacher, each look at a different crop. The Student is trained to match the Teacher's output even though it sees a different angle or zoom level. Through this game the Vision Transformer learns on its own to separate foreground objects from messy backgrounds with great precision, without a single human label.
The full arc of modern computer vision
- ImageNet and AlexNet (2012): proved that deep CNNs on GPUs could beat human-engineered rules on labelled data.
- VGGNet and ResNet (2014-2015): scaled depth safely using small filters and skip connections.
- Vision Transformers (2020): replaced sliding filters with global self-attention over image patches.
- Multimodal and self-supervised AI (2021 to the present): unified vision and text in shared spaces, so models can learn from the whole unlabelled internet and generate brand-new visuals from words.
Running AI on smartphones and edge devices
A massive Vision Transformer or diffusion model can need dozens of gigabytes of memory and kilowatts of power, far beyond what a smartphone battery or smartwatch can handle. Engineers use three core compression techniques to squeeze these models onto local chips such as Apple's Neural Engine or a Qualcomm NPU.
Quantization: reducing mathematical precision
During training on cloud supercomputers, a neural network stores every weight (parameter) as a high-precision 32-bit floating-point number (FP32), such as 0.14159265. Quantization rounds those long decimals into simpler, smaller integers, typically 8-bit integers (INT8) or even 4-bit integers (INT4), where INT8 means whole numbers between -128 and 127. This works because neural networks are naturally resilient to tiny rounding errors. Moving from 32-bit to 8-bit cuts the memory footprint by 75% and makes the maths run 2x to 4x faster on mobile chips, with almost no drop in accuracy.
Knowledge distillation: teacher to student
Instead of forcing a tiny mobile model to learn complex patterns from raw data on its own, researchers first train a massive cloud model and have it teach a smaller one. A giant Teacher model, such as a 1-billion-parameter ViT, processes millions of images and outputs detailed probability scores, for example “85% Golden Retriever, 12% Labrador, 3% Lion”. A tiny Student model, such as MobileNet or TinyViT, is trained to mimic that nuanced distribution rather than just guess a single hard label. The Teacher's soft probabilities reveal hidden relationships, such as Golden Retrievers looking like Labradors, which lets a Student 10x smaller reach nearly the same real-world accuracy.
Pruning and efficient architectures
- Pruning: engineers inspect the trained network and permanently delete weak connections, weights close to zero that rarely fire, like trimming branches off a tree.
- Mobile-first designs: architectures like MobileNet and MobileViT replace heavy maths with lightweight shortcuts, such as depthwise separable convolutions. This enables real-time face unlock, background blur and live camera translation on your phone without an internet connection.
How video generation models extend diffusion across time
Generating video, as seen in models like Sora, Veo and Runway Gen-3, is much harder than generating a single picture. If a model simply produced 24 separate images per second, objects would flicker, morph and teleport between frames. Video models solve this by treating a video as a 3D volume of space and time.
Spatiotemporal patches (3D tokens)
While an image Vision Transformer slices a picture into flat 2D squares (for example 16×16 pixels), a video Diffusion Transformer (DiT) slices a clip into 3D cubes, called spacetime patches or tubelets, that span height, width and several consecutive frames. Every 3D token gets an (x, y, t) coordinate tag so the Transformer knows both where a patch is on screen and when it happens in the timeline.
Factorized space-time attention
Running self-attention across every pixel cube in a 10-second HD video would overwhelm even the largest supercomputers, so modern video models split attention into two alternating steps.
- Spatial attention: within each frame, patches attend to nearby patches so objects look sharp, well lit and structurally accurate, for example keeping a car's wheels round.
- Temporal attention: across consecutive frames, each patch attends to the same region forward and backward in time. This locks in motion consistency: if a person walks behind a lamp post in frame 10, they come out smoothly on the other side in frame 20.
3D video compression (causal VAEs)
Just as image diffusion models work in a compressed latent space rather than on raw pixels, video generators use a 3D Variational Autoencoder (3D VAE). It compresses spatial resolution (height and width) and the temporal frame rate at the same time, turning gigabytes of raw frames into a compact grid of latent tokens. When these Diffusion Transformers are trained on millions of hours of video at massive scale, they begin to learn basic real-world physics implicitly: how water splashes, how shadows move when a light source shifts, and how objects stay solid even when briefly hidden from view.
Aligning models with human preferences: RLHF and DPO
Pre-training teaches a model to predict pixels or words accurately, but mathematical accuracy does not always match what humans want. An unaligned image generator might draw six fingers on a hand, or a multimodal assistant might give a blunt, unhelpful answer. Post-training alignment closes that gap.
Reinforcement Learning from Human Feedback (RLHF)
Used to polish models like Midjourney, Stable Diffusion and multimodal assistants, RLHF teaches human aesthetic and behavioural preferences in three steps.
- Collecting pairwise rankings: humans see two outputs made from the same prompt, for example Image A and Image B of “a cinematic sunset over Sydney Harbour”, and click the one that looks better, follows the prompt more closely or has fewer visual glitches.
- Training a reward model: a separate neural network, the Reward Model, is trained on tens of thousands of these votes until it can automatically score any new image or answer by how much a human would like it.
- Fine-tuning with reinforcement learning: the main generative model makes thousands of new attempts, gets high or low scores from the Reward Model, and adjusts its internal weights, often with an algorithm called PPO, to maximise its reward without drifting too far from its original knowledge.
Direct Preference Optimization (DPO)
Training a separate Reward Model and running reinforcement learning is slow, unstable and expensive. DPO reaches the same result much more simply. Instead of building a Reward Model, it uses a mathematical shortcut to update the generative model directly from human “winner versus loser” pairs. During training the model adjusts its weights to raise the probability of producing the winning image or response and lower the probability of the losing one. Because DPO is fast, stable and memory-efficient, it has become the industry standard for fine-tuning modern image generators such as SDXL and FLUX, and multimodal models, to produce sharp lighting, accurate anatomy and natural text rendering.
Turning 2D photos into navigable 3D worlds: NeRFs and 3D Gaussian Splatting
Traditionally, creating a 3D environment for video games or movies meant artists manually sculpting millions of triangles (meshes) and painting textures onto them. Modern AI reconstructs real-world 3D spaces automatically from a few dozen ordinary smartphone photos taken from different angles.
Neural Radiance Fields (NeRFs)
Introduced in 2020, a NeRF stores an entire 3D scene inside the weights of a compact neural network instead of using traditional 3D polygons. You give the system 50 to 100 photos of an object or room along with the camera angle of each. To render a new angle, it shoots virtual light rays from the virtual camera through every pixel on screen into 3D space. Along each ray the network takes the 3D coordinates (x, y, z) and the viewing direction (θ, φ) and outputs two things: colour (RGB) and density, meaning how solid or transparent that point is. NeRFs capture photorealistic reflections, glass and lighting with astonishing accuracy, but rendering one frame means querying a neural network millions of times along thousands of rays, so they are slow to render in real time.
3D Gaussian Splatting (3DGS)
Introduced in 2023, 3D Gaussian Splatting solved NeRF's speed bottleneck by replacing slow neural ray-tracing with millions of tiny, glowing 3D ellipsoids (blobs). Instead of hiding a scene inside a black-box neural network, 3DGS fills 3D space with millions of soft, semi-transparent 3D ovals called Gaussians, which look like stretched, fuzzy cotton balls. Starting from a sparse cloud of 3D points detected across your photos, the algorithm adjusts every Gaussian's position, size, stretch, rotation, colour and transparency until projecting them onto a 2D screen matches your original photos. Because graphics cards are built to project and blend shapes onto a screen quickly, “splatting” them like paint, 3D Gaussian Splatting renders photorealistic, freely navigable scenes at 100+ frames per second. That makes it ideal for virtual reality, robotics and digital twins.
NeRFs versus 3D Gaussian Splatting
| Feature | NeRFs (2020) | 3D Gaussian Splatting (2023) |
|---|---|---|
| Scene representation | Implicit: stored inside the weights of a neural network. | Explicit: stored as millions of editable, coloured 3D ellipsoids. |
| Rendering method | Ray marching (slowly sampling points along light rays). | Rasterization / splatting (fast GPU projection onto the screen). |
| Rendering speed | Slow, often seconds per frame without heavy optimization. | Real time: 100+ FPS in full HD on consumer GPUs. |
| Editability | Hard to edit individual objects inside the network weights. | Easy to delete, move or animate specific groups of 3D splats. |
Embodied AI and robotics: Vision-Language-Action models
Historically, robots were programmed step by step for rigid factory tasks, and if a part shifted by two centimetres the robot failed. Modern robotics solves this by putting multimodal AI inside a physical body, which is called embodied AI.
How a VLA model works
Models like Google's RT-2, Physical Intelligence's π0 (Pi-Zero) and the open-source OpenVLA take the multimodal architecture described above and add physical movement as a third language.
- Visual and spatial input: cameras on the robot's head and wrists feed live video frames into a Vision Transformer, while depth sensors or 3D Gaussian maps help the robot judge exact distances and avoid obstacles.
- Language instruction: you give the robot a plain-English goal, such as “Pick up the ripe banana and place it in the fruit bowl”.
- Action tokens: instead of text words, the Transformer outputs action tokens, sequences of numbers for exact 3D wrist coordinates (x, y, z), hand rotation and gripper pressure, sent to the robot's motors dozens of times per second.
Sim-to-real and world models
Collecting real-world robot training data is slow because physical hardware moves in real time and can break. Engineers train robots inside ultra-fast virtual physics worlds, such as NVIDIA Isaac Lab or MuJoCo, where a virtual robot can practise folding laundry or assembling parts millions of times in a single afternoon. During simulation training, researchers constantly randomise lighting, textures, object weights and camera angles. This is called domain randomization. When the trained model moves to a real robot (sim-to-real), the messy real world looks like just another small variation it already knows how to handle.
Tools to build it yourself
Experimenting with CNNs, Vision Transformers, diffusion models or edge deployment is possible because the whole modern AI ecosystem is built on free, open-source Python tools.
Core ecosystem and model libraries
- PyTorch: the industry standard for deep learning research and production. You use it to define network layers (convolutions, ReLU, dropout, self-attention), run matrix maths on GPUs and train models from scratch.
- Hugging Face (transformers and diffusers): the “GitHub of AI”. Instead of training a Vision Transformer or Stable Diffusion model from zero, you can download thousands of pre-trained weights in three lines of Python and fine-tune them on your own images.
- timm (PyTorch Image Models): an open-source library maintained within Hugging Face with over 1,000 ready-to-use computer vision architectures, from classic AlexNet and ResNet to ViT, ConvNeXt and DINOv2.
Computer vision and 3D toolkits
- OpenCV: the classic library for fast image and video processing, used for reading webcam feeds, resizing frames, cropping images and drawing bounding boxes around detected objects.
- Ultralytics (YOLO): for real-time object detection on live video, such as counting cars or tracking sports players, the YOLO (You Only Look Once) family offers plug-and-play speed and accuracy.
- Nerfstudio and gsplat: open-source frameworks that let you feed in a smartphone video of any room or object and produce interactive NeRFs or 3D Gaussian Splats on your desktop GPU.
Deployment and edge optimisation tools
- ONNX (Open Neural Network Exchange): a universal file format for AI models. You can train in PyTorch, export to .onnx and run it anywhere, in a web browser, a C++ robotics controller or a Windows or Linux server, without needing Python installed.
- LiteRT (formerly TensorFlow Lite) and Apple Core ML: specialised conversion toolkits that apply quantization (shrinking FP32 weights to INT8 or INT4) and compile your models to run natively on Android Neural Processing Units (NPUs) or the iPhone's Neural Engine.
The roadmap: from pixels to physical action
- Foundations (2012-2015): ImageNet, AlexNet, ReLU, dropout, VGGNet and ResNet.
- Attention and scale (2020-2022): Vision Transformers (ViTs), self-attention maths, multimodal alignment (CLIP) and self-supervised learning (MAE, DINO).
- Generative and 3D AI (2022 to the present): image and video diffusion, human preference alignment (RLHF and DPO), NeRFs and 3D Gaussian Splatting.
- Deployment and robotics: quantization and distillation for edge devices, Vision-Language-Action (VLA) models for robotics, and the open-source stack (PyTorch, Hugging Face, ONNX) that powers them all.
Code walkthroughs
1. Running a pre-trained Vision Transformer
This script downloads Google's pre-trained Vision Transformer (vit-base-patch16-224), processes an image into 16×16 patches and predicts the ImageNet class label. First install the libraries, in a terminal or a free Google Colab notebook:
pip install torch torchvision transformers pillow requestsThen run inference on an image:
import requests
import torch
from PIL import Image
from transformers import ViTForImageClassification, ViTImageProcessor
# 1. Load an image from the web (or use Image.open("your_photo.jpg"))
url = "http://cocodataset.org"
image = Image.open(requests.get(url, stream=True).raw)
# 2. Load the pre-trained Vision Transformer and its patch processor
model_name = "google/vit-base-patch16-224"
processor = ViTImageProcessor.from_pretrained(model_name)
model = ViTForImageClassification.from_pretrained(model_name)
# 3. Slice the image into 16x16 patches and convert to PyTorch tensors
inputs = processor(images=image, return_tensors="pt")
# 4. Run the model without tracking gradients (saves memory during prediction)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
# 5. Find the highest-scoring ImageNet category out of 1,000 classes
predicted_class_idx = logits.argmax(-1).item()
predicted_label = model.config.id2label[predicted_class_idx]
confidence = torch.softmax(logits, dim=-1)[0][predicted_class_idx].item()
print(f"Prediction: {predicted_label} ({confidence:.2%} confidence)")How this connects to what you learned: ViTImageProcessor resizes the photo to 224×224 pixels, normalises the colour values and prepares it to be sliced into 16×16 patches. torch.no_grad() switches off backpropagation maths, because we are only predicting, not training. torch.softmax() converts the raw output scores (logits) into clean percentages summing to 100%, just like in the self-attention example. To swap to ResNet, change model_name to “microsoft/resnet-50” and replace ViT with AutoImageProcessor and AutoModelForImageClassification; Hugging Face handles the architectural switch automatically.
2. Fine-tuning a Vision Transformer on your own images
Rather than training a Vision Transformer from scratch, which needs millions of images, you take a pre-trained model and replace its final 1,000-class ImageNet head with your own categories, for example healthy_leaf, blight and rust. Step one is to arrange your photos into folders named after each class:
my_dataset/
├── train/
│ ├── cats/
│ └── dogs/
└── test/
├── cats/
└── dogs/Step two: install datasets and accelerate (pip install datasets accelerate), then run:
import torch
from datasets import load_dataset
from transformers import (
AutoImageProcessor,
AutoModelForImageClassification,
Trainer,
TrainingArguments,
)
# 1. Load your local image folders automatically
dataset = load_dataset("imagefolder", data_dir="./my_dataset")
labels = dataset["train"].features["label"].names
label2id = {label: i for i, label in enumerate(labels)}
id2label = {i: label for i, label in enumerate(labels)}
# 2. Load the processor and attach a new classification head for your custom classes
model_name = "google/vit-base-patch16-224"
processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForImageClassification.from_pretrained(
model_name,
num_labels=len(labels),
id2label=id2label,
label2id=label2id,
# Replaces the 1,000-class ImageNet head
ignore_mismatched_sizes=True,
)
# 3. Slice images into 16x16 patches on the fly during training
def transform(batch):
inputs = processor(
[img.convert("RGB") for img in batch["image"]],
return_tensors="pt"
)
inputs["labels"] = batch["label"]
return inputs
prepared_ds = dataset.with_transform(transform)
# 4. Configure training settings and start fine-tuning
training_args = TrainingArguments(
output_dir="./my-custom-vit",
per_device_train_batch_size=16,
num_train_epochs=3,
# A small learning rate preserves pre-trained knowledge
learning_rate=2e-5,
remove_unused_columns=False,
logging_steps=10,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=prepared_ds["train"],
eval_dataset=prepared_ds["test"],
)
trainer.train()
trainer.save_model("./my-custom-vit-final")3. Exporting and INT8-quantizing to ONNX for edge deployment
Once the model is trained, you can convert it from PyTorch into a standalone .onnx file and compress its 32-bit floating-point (FP32) weights to 8-bit integers (INT8), so it runs quickly on CPUs, laptops or mobile devices. Install ONNX Runtime first:
pip install onnx onnxruntimeThen export and quantize the model:
import os
import onnxruntime as ort
from onnxruntime.quantization import QuantType, quantize_dynamic
import torch
from transformers import AutoImageProcessor, AutoModelForImageClassification
# 1. Load your fine-tuned model (or any pre-trained Hugging Face ViT/ResNet)
model_dir = "./my-custom-vit-final"
processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
model = AutoModelForImageClassification.from_pretrained(model_dir)
# Switches off training features like Dropout
model.eval()
# 2. Create a dummy 224x224 image tensor so PyTorch can trace the model graph
dummy_input = torch.randn(1, 3, 224, 224)
fp32_onnx_path = "vit_fp32.onnx"
int8_onnx_path = "vit_int8.onnx"
# 3. Export the PyTorch model to standard FP32 ONNX format
torch.onnx.export(
model,
dummy_input,
fp32_onnx_path,
input_names=["pixel_values"],
output_names=["logits"],
dynamic_axes={"pixel_values": {0: "batch_size"}, "logits": {0: "batch_size"}},
opset_version=14,
)
# 4. Apply INT8 dynamic quantization (shrinks weights from 32-bit to 8-bit)
quantize_dynamic(
model_input=fp32_onnx_path,
model_output=int8_onnx_path,
weight_type=QuantType.QUInt8,
)
# 5. Compare file sizes before and after quantization
fp32_mb = os.path.getsize(fp32_onnx_path) / (1024 * 1024)
int8_mb = os.path.getsize(int8_onnx_path) / (1024 * 1024)
print(f"Original FP32 size: {fp32_mb:.1f} MB")
print(f"Quantized INT8 size: {int8_mb:.1f} MB")
# 6. Run ultra-fast inference without PyTorch using ONNX Runtime
session = ort.InferenceSession(int8_onnx_path)
outputs = session.run(None, {"pixel_values": dummy_input.numpy()})
print("Quantized output shape:", outputs[0].shape)- model.eval(): remember dropout from AlexNet? Calling .eval() makes sure every neuron stays switched on during export and prediction.
- dynamic_axes: lets the exported .onnx file process one image or a batch of images without re-exporting.
- Pure edge execution: in step 6, ort.InferenceSession runs the model completely independently of PyTorch, so you can ship vit_int8.onnx to a lightweight Raspberry Pi, a desktop app or a mobile device with roughly a 4x smaller memory footprint.
A 12-week learning roadmap
Follow these four stages to go from basic neural network maths to building modern multimodal and generative systems.
Stage 1: foundations and CNNs (weeks 1 to 3)
- Free course: fast.ai, Practical Deep Learning for Coders. It teaches PyTorch top-down by having you train real image classifiers in your very first lesson.
- Free course: Stanford CS231n, Deep Learning for Computer Vision. Lecture videos and notes are on YouTube and GitHub; it is the gold standard for understanding convolutions, ReLU, dropout and backpropagation.
- Must-read paper: ImageNet Classification with Deep Convolutional Neural Networks (Krizhevsky et al., 2012), the AlexNet paper.
- Must-read paper: Deep Residual Learning for Image Recognition (He et al., 2015), the ResNet paper.
Stage 2: Transformers and self-attention (weeks 4 to 6)
- Video walkthrough: Andrej Karpathy, “Let's build GPT: from scratch, in code, spelled out” on YouTube. Coding self-attention in pure PyTorch makes Vision Transformers easy to understand.
- Free course: Hugging Face Computer Vision Course, with hands-on tutorials on ViTs, object detection and fine-tuning on custom datasets.
- Must-read paper: Attention Is All You Need (Vaswani et al., 2017), the original Transformer.
- Must-read paper: An Image is Worth 16x16 Words (Dosovitskiy et al., 2020), the Vision Transformer.
Stage 3: multimodal and self-supervised AI (weeks 7 to 9)
- Hands-on practice: load OpenAI CLIP (openai/clip-vit-base-patch32) or Meta DINOv2 (facebook/dinov2-base) in Hugging Face and build a zero-shot image search engine that finds photos from plain English descriptions.
- Must-read paper: Learning Transferable Visual Models From Natural Language Supervision (Radford et al., 2021), the CLIP paper.
- Must-read paper: Emerging Properties in Self-Supervised Vision Transformers (Caron et al., 2021), the DINO paper.
Stage 4: generative diffusion, edge AI and 3D (weeks 10 to 12)
- Free course: Hugging Face Diffusion Models Course, which teaches U-Nets, noise schedulers and text-to-image pipelines in PyTorch.
- Project, edge quantization: export your PyTorch ViT to ONNX (torch.onnx.export) and apply INT8 dynamic quantization with onnxruntime to measure the speed boost on your CPU.
- Project, 3D reconstruction: install Nerfstudio (ns-train splatfacto), film a 30-second walk-around video of an object on your phone and watch it turn into a live 3D Gaussian Splat.
Closing thoughts
In little more than a decade, a contest result and a dataset of labelled photos grew into the foundations of today's AI: networks that see, read, draw, make video, build 3D worlds and move robots. The 2012 AlexNet moment mattered because data, compute and a good idea arrived together, and the lessons of that moment, depth, scale and open competition, still drive the field.