Three demonstrations for Week 4: how computers represent meaning
Type three short documents and turn them into rows of word counts: the bag of words. Start here. It shows what a computer can do with text before any language model is involved. Guide
Enter your own sentences and compare two representations: counting words, and sentence embeddings from a real language model. Both appear as similarity tables and a 2D map. “Dog” and “canine” share no words, yet end up close together as embeddings. A search box compares keyword search with semantic search.
Runs on Streamlit Community Cloud. If the app has been asleep, it takes about a minute to wake up, so open it a few minutes before class.
Images and words placed in one shared space. Press Train (or Space) and watch the space align over a few seconds, or drag the slider through it by hand: the picture of a cat moves next to the words “Cat” and “Feline”, while the car and the word “Apple”, which have no partner, end up on their own.
Click a word or a picture to draw lines to its three nearest neighbours; the panel ranks everything by similarity. Before training, “Feline” is closest to “Dog”; after training, to the picture of a cat. That ranking is how semantic search works: search with a word, get the nearest pictures.
Random start, “Feline” selected Already trained
The vectors on this page are illustrative, not produced by a real model.