Please enable JavaScript to use CodeHS

AI Explained

Beyond text

AI does not only read and write. It also sees images, hears audio, and watches video. The trick is the same: turn everything into numbers, then process it with the same kinds of models.

AI ~12 min High school
Vision

Images as patches

A color image is already a grid of numbers: each pixel has red, green, and blue values. Vision models split the image into patches, flatten each patch into a vector, and feed the sequence of vectors into a transformer.

This means the same attention mechanism that works for words can also work for image regions. A patch in the corner can attend to a patch in the center to figure out context. This architecture is called a Vision Transformer (ViT).

Core idea: if you can turn something into a sequence of vectors, a transformer can process it. That is why the same model can handle text, images, and sound.


Multimodal

Audio and video

Audio is a waveform: a long sequence of numbers that describes air pressure over time. Models can process audio directly or convert it into a spectrogram, which is like an image of frequencies over time. Speech recognition and music generation both work this way.

Video is even richer: it is a sequence of image frames, plus audio, plus motion. A video model has to track objects across time, understand physics, and keep long-term context. This is much harder than processing a single image.


World models

World models

Beyond recognizing pictures, some AI systems try to build an internal model of how the world works. A world model can predict what will happen next when an agent takes an action. This is useful for robotics, games, and autonomous systems.

World models are still an active research area, but the goal is clear: an AI that can plan and act in the real world, not just predict text.


Interactive

Tiny image classifier

Click the 4x4 grid to draw a simple shape. A tiny classifier treats your drawing as a 16-dimensional vector and computes how much it matches three learned patterns: smile, frown, or noise.

Click cells to toggle them. Bright cells are on.

Classifier outputs

Draw something to see the classifier guess.

Code

Images as numbers

A picture is just a grid of pixels, and each pixel is made of numbers for red, green, and blue. This Python example builds a tiny 2x2 image from scratch.


Check yourself
?

Why can a transformer work on both text and images?

Text is a sequence of word vectors. An image is a sequence of patch vectors. What does the transformer care about?

The transformer does not care what the vectors represent. It only attends to relationships between positions. As long as the data is turned into a sequence of vectors, the same architecture works.


Quick quiz

Three questions

1. How does a Vision Transformer represent an image?

2. What is a spectrogram?

3. What is a world model trying to learn?

Keep learning

Multimodal models can perceive the world, but to act in it they need a different design. The next tutorial covers agents: systems that combine perception, reasoning, and tools.

Part of the AI Explained tutorial series.