In 5-3, a motion became a point made of 16 numbers. This time, words become points too. We train a text funnel and a motion funnel together so that the sentence "손을 흔든다" (waves a hand) and the hand-waving motion land on the same spot of the same map. Watch the lines, tangled at first, find their partners as training goes on, and at the end type a sentence to make the stick figure move. Even the single word "춤춰" (Dance!) becomes a motion here for the first time.
With generator E in 5-3, we had to pick "the spot where throws gather" ourselves. This time, people pick it with words. For that, words must also become points on the map.
Type a sentence or click an example. Of the 40 word pieces in the dictionary, only those found in the sentence become 1. These 40 numbers are the input to the text funnel.
A bag of words sees a sentence only as "which words are in it". It throws away word order, particles and context. So "버린" (threw away) in "길에 캔을 던져 버린다" (throws a can away on the street) and "버린" in "쓰레기통에 쓰레기를 버린다" (throws trash into the bin) switch on the same slot — even though one is littering and the other is normal. This crudeness shows up as real mistakes in Section 6. Ways to put a sentence’s order and context into numbers as well are covered in 3-5 and 3-8.
Sentences are on the left, motions on the right (deliberately shuffled). The thickness of a line is the probability that the sentence picks that motion. Press "Play training" or drag the slider to advance training.
| Training step | Pair-matching loss | 7 test sentences → own kind among the 5 nearest test motions | 140 test motions → kind of the nearest sentence is correct |
|---|---|---|---|
| 0 | — | 2.9% | 10.0% |
| 10 | 1.763 | 28.6% | 55.0% |
| 25 | 1.317 | 65.7% | 72.1% |
| 50 | 0.395 | 71.4% | 96.4% |
| 100 | 0.090 | 71.4% | 100.0% |
| 400 | 0.010 | 71.4% | 100.0% |
The training on screen above re-runs the same computation in the browser (with different random numbers), so the numbers at each step differ slightly. 5 of the 7 test sentences found their own motion. The 2 that did not are examined in Section 6.
CLIP [R1], which aligns words and images this way, and MotionCLIP [R2], which aligns words and motions, work on the same principle. Real models use a transformer as the text funnel and hundreds of millions of pairs.
Type a sentence and press Enter. "Find" pulls out the nearest scene on the map as is, and "Make" draws a new motion from the spot where the 5 nearest scenes gather. Join two sentences with "~다가" (while …) or "~고 나서" (after …) and the two motions are stitched one after the other.
| Mode | 21 training sentences (×5 each) | 7 test sentences (×5 each) |
|---|---|---|
| Find | 100.0% | 71.4% |
| Make | 100.0% | 71.4% |
The kind of each generated motion was judged by which kind’s center is nearest in the 5-3 latent space. "춤춰" (Dance!) → the generated motion was judged as dancing, with a bone-length error of 5.4%. Stitching: "걸어가다가 손을 흔든다" (waves a hand while walking) → first half walking past · second half waving; "손을 흔들고 나서 춤춰" (wave, and then dance!) → waving · dancing; "캔을 줍고 쓰레기통에 넣는다" (picks up a can and puts it in the bin) → picking up · putting in the bin.
In this part, "Make" approximates the spot where the five nearest scenes on the map gather with a mean and a spread, and unfolds it with the linear decoder from 5-3. Real text-to-motion models instead use diffusion models that take the sentence as a condition and strip noise away to reveal a motion (MDM [R4]), or turn motion into tokens and keep writing the next token (T2M-GPT [R5]). For training data, HumanML3D [R3], in which people wrote sentences for every motion, is widely used.
2 of the 7 test sentences found the wrong motion. In both cases the reason is clear.
| Test sentence | Correct answer | Motions found (5 nearest) | Why it failed |
|---|---|---|---|
| "길에 캔을 던져 버린다" (throws a can away on the street) | Throw far | putting in the bin × 5 | "던져" (throw) is a piece that never appeared in the training sentences, and "버린" (threw away) is a piece learned from a binning sentence ("쓰레기통에 쓰레기를 버린다", throws trash into the bin). Without context, it got dragged toward "버린다 = binning" |
| "손을 펴서 떨어뜨리고 걸어간다" (opens the hand, drops it and walks away) | Drop at feet | walking past × 5 | "걸어" (walk) and "간다" (goes) pulled hard toward walking past. A bag of words does not know which word is the main action (dropping) |
| "걷다가 손 흔들기" (walking, then waving) (Section 5) | walking past → waving | First half is wrong | "걷" (walk) is in the dictionary but never appeared in a training sentence (the training sentences all use "걸어"). A slot that was never learned does not point anywhere on the map |
The "Motions found" in the table above are the results of Code 1. In Section 5, which re-trains in the browser, "길에 캔을 던져 버린다" (throws a can away on the street) sometimes goes toward picking up instead. Where it gets dragged depends on the random numbers in training, but the reason it cannot find throwing (a bag of words that does not know context) stays the same.
Both code notebooks use only libraries preinstalled in Colab. After "Download notebook (.ipynb)", open it in Colab via File → Upload notebook, or copy the code and paste it into a new notebook cell.
Adds the dancing scene, turns sentences into a bag of words and motions into 16 numbers, then aligns the two funnels with contrastive learning. Prints the loss at each training step and the hits for the test sentences. To use your own data put description sentences for your motions in CAPTIONS and the word pieces to use in VOCAB.
Uses the two trained funnels to find or newly make a motion from a sentence, and stitches sentences joined with "~다가" (while …) one after the other. Judges the kind of each generated motion in the latent space. The table in Section 5 is built directly from this output.
These are prompts to paste into AI assistants such as ChatGPT, Qwen, or Claude. When you press "Copy," the selected code is attached after the prompt. Just replace the parts in 〔 〕 with your own situation.
The AI's answer is only a starting point. Always verify suggested papers, figures, and library functions against the original sources and official documentation. When using footage of real people, first check filming consent and personal data processing rules.
The same dictionary as the yellow dotted underlines in the text. Click a section name to jump to where the term first appears.
Analogies are a first step toward understanding, but they can also plant misconceptions. Analogies to human perception are marked by strength. Direct there is evidence that it actually does the same thing · Partial only some properties are similar · None no known counterpart
| Concept | Everyday analogy | Human perception analogy | Where the analogy breaks |
|---|---|---|---|
| Bag of words | Cutting a sentence into word cards, putting them in a bag and shaking it | None | Cards taken out of the bag have no order. "The dog bites the man" and "The man bites the dog" become the same |
| Contrastive learning | A pair-matching card game: stick matching pairs together, pull the others apart | Partly a child who learns what words mean by hearing them while watching the action | A child learns in a few tries, but a model has to see the same pair hundreds of times, and a word with no pair stays unknown forever |
| Same map | Putting two languages together in one dictionary | None | In a dictionary, people decide the correspondences, but on this map the correspondences emerge from pair data alone. Words with few pairs end up in the wrong place |
| Find vs. make | Borrowing a book from a library vs. reading similar books and writing something new | None | New writing has the author’s intent behind it, but “make” in this part only draws something near the average of the five nearest scenes |
| Stitching | Choreography instructions like "first do ~, then do ~" | Partly moving the body in the order of the sentence | A choreographer makes the transitions flow naturally, but here we simply blend 10 frames |
E-1 About the author · E-2 Academic references · E-3 Sources of figures and numbers
A teaching guide for instructors, on-the-job (OJT) trainers and tutors. Times are estimates, so adjust them to your actual class.
| Audience | University students and working adults who have finished 5-3. Planners and practitioners who want to know what goes on inside generative AI where "you type a prompt and get a result" |
|---|---|
| Prerequisites | The latent space from 5-3; dot product and softmax (3-2, 3-8) |
| Learning goals | ① Explain the simplest way to turn a sentence into numbers (bag of words) and its limits ② Describe how contrastive learning aligns two funnels by "partners close, strangers far" ③ Give examples of the difference between find, make and stitch on a shared map |
| Estimated time | Reading 30–40 min · animation demos 25 min · Colab practice 25 min (Code 1 12 min, Code 2 13 min) |
Intro 5 min (Section 1) → Section 2 bag of words 8 min → Section 3 training playback 15 min → Section 4 map 7 min → Section 5 trying sentences 10 min → Section 6 failed sentences 5 min.
Sections 2–3, 20 min → discussion of "words the model knows and words it does not" using the Section 6 table, 15 min → in Section 5, teams look for sentences that work and sentences that fail, 20 min → add new sentences to Code 1 and retrain, 25 min → wrap-up 10 min.
Beginners: Sections 2, 3 and 5 only. Have intermediate learners work out by hand, with a 2 × 2 table, why the single line G = (P − I + Q − I) / 14 in Code 1 "raises the diagonal and lowers the rest".
| Section | Question to pause and ask | Hands-on tip |
|---|---|---|
| 2 Words are numbers | "Why do '캔을 던진다' (throws a can) and '던진다 캔을' (same words, swapped) get the same numbers?" | Click the two examples in turn |
| 3 Pair matching | "How many steps did it take for the lines to find their partners? And for the test sentences?" | After playing the training, switch to "Test sentences" |
| 4 Same map | "Where were the diamonds before training?" | Drag the step slider from 400 → 0 |
| 5 Words → motion | "How do the results of find and make differ?" | Press "춤춰" (Dance!) several times in Make mode |
| 6 Limits | "What would we have to change so that '던져 버린다' (throws away) is found correctly?" | Type that sentence in Section 5 and check for yourself |
| Misconception | Correct explanation | Scene to show |
|---|---|---|
| AI understands the meaning of a sentence and then picks a motion | It only turns the sentence into numbers and finds a nearby spot on the map. In this part, the numbers only record whether each word piece is present | Section 2, Section 6 |
| Contrastive learning needs answer labels | All it needs are pairs saying "this sentence and this motion go together". Kind names are not used | Section 3, explanation |
| If the training loss is close to 0, it will also get unseen sentences right | The loss is measured on training sentences. Only 5 of the 7 test sentences were right | Section 3 table |
| Longer, more detailed sentences always work better | If words outside the dictionary or words from other motions creep in, the sentence can get dragged somewhere completely wrong | Section 6, "손을 펴서 떨어뜨리고 걸어간다" (opens the hand, drops it and walks away) |
| "Make" creates entirely new motions that were not in the training data | It draws near the spot where nearby scenes on the map gather. It can hardly go beyond the kinds of motion it learned | Section 5, "날아올라" (Fly up!) |
[1, 1, 1, 1]. All four pieces are in it. This sentence ends up somewhere between throwing and waving.
e³ / (e³ + e¹) ≈ 0.881, e¹ / (e³ + e¹) ≈ 0.119. Training adjusts the two funnels to push the diagonal (0.881) toward 1 and the non-pair cell (0.119) toward 0.
On the motion side there are 420 scenes, so each kind has a well-defined shape; on the sentence side there are only 3 training sentences per kind, and the bag of words does not know context. When an unseen combination of words comes in, the text funnel wobbles.
"걷" (walk) is in the dictionary but never appeared in a training sentence. The weights for that slot are still the small random values they started with, so it does not point anywhere meaningful on the map. Change it to "걸어가다가" (while walking) and walking past comes out.
Find. It pulls out training scenes as they are, so if they were real people’s motion data, that person’s movements would come out unchanged (like generator C in 5-2). Make draws something new from the spot where several scenes gather.
In Code 1’s CAPTIONS, change one of the throwing training sentences to something similar to "길에 캔을 던져 버린다" (throws a can away on the street) and retrain. Report how the test-sentence hits change.
Instead of the bag of words, write a bag function that uses "overlapping two-character pieces" (e.g. "던져" → "던", "져", "던져"), and compare by test-sentence hits whether it handles unseen words ("걷다가", while walking) better.
| Beginners | The training playback in Section 3 alone is enough to get across "it learns by matching pairs" |
|---|---|
| Advanced | Have learners put Figure 1 of the CLIP and MotionCLIP papers next to Section 3 of this part and present the similarities and differences |
| Next episode | 5-5 From "Dance!" to a Dance Video — dressing the stick figure’s dance in the Assistant’s appearance |
You have read "5-4 From Words to Motion" to the end. The lab crew sums it up, one line each.