How to Build AI Lipsync, Part 4: Training LSTMs, Their Limits, and the Leap to Transformers

How to Build AI Lipsync, Part 4: Training LSTMs, Their Limits, and the Leap to Transformers

Hello! Welcome to Part 4 of our lip-sync technology series!

In the previous installment (Part 3), we began exploring the core technology of converting wav2vec features into mouth-shape parameters. We looked at the complex relationship between speech and mouth shapes—especially coarticulation, where the same phoneme changes with context—and then covered the LSTM approach to this time-series problem, from the long-term memory enabled by LSTM gate mechanisms all the way to actual network design.

This time, we explain in detail how to actually train that LSTM, from data preparation through the training process.
Then, after laying out the limits of LSTMs, we introduce the Transformer, a newer approach that overcomes them.

1. Data Preparation: Balancing Quality and Quantity

1.1 The Types of Data You Need (Audio, Mouth Shapes, Synchronization)

Training a high-quality lip-sync model requires three kinds of data. Each comes with strict quality requirements, and if they are not met, even the best network architecture will not produce good results.

First, the audio data: a sampling rate of 16kHz or higher is mandatory. This is because wav2vec is trained at 16kHz; lower sampling rates lose phonetic information. The recording environment also matters—recording in a soundproof room with little background noise is ideal. As for speakers, professional voice actors or announcers with clear articulation are preferable, but ordinary speakers work too if they enunciate carefully.

Next, the mouth-shape data. There are various approaches here. Sometimes we use image-analysis pipelines that can track facial landmarks in 3D; in other cases, to capture facial landmarks from scratch, we attach fluorescent markers to the face and track them three-dimensionally with multiple cameras to record precise mouth movements.
As for the capture equipment, the frame rate ideally needs to be 60fps or higher.
Human mouth movements are surprisingly fast—plosives in particular involve large changes within 20 milliseconds—which is why a high frame rate is necessary.
For 4K capture at 60 or 120 FPS, you will want a high-end digital camera or camcorder, such as an α7 IV or an FX3. Data is everything here, so do not skimp on preparation or equipment.

And the most important element of all is synchronization between audio and mouth shapes. Even a 50-millisecond offset registers as unnatural to the human eye. During recording, therefore, you need a timecode-based system that keeps audio and video perfectly in sync.

1.2 Techniques for Training an LSTM with Minimal Data

In machine learning, the conventional wisdom is "the more data, the better," but collecting high-quality motion-capture data costs enormous time and money. So you need techniques for learning effectively even from limited data.

Professor Quo: Let me explain the data-volume problem with a cooking analogy.
Manabu: Cooking?
Professor Quo: Yes. When you learn to make curry, do you need to make it 100 times before it sticks?
Manabu: No, a few times is enough to learn the basics. Although being able to cook lots of variations probably takes more practice.
Professor Quo: Exactly! Lip-sync is the same: the basic mouth-movement patterns can be learned from relatively little data. For example, Japanese has roughly 100 basic phonemes. Record each one 10 times and you have 1,000 samples. That alone is enough to learn the fundamentals.
Manabu: But natural speech has far more complex patterns, doesn't it?
Professor Quo: Good point. That is why we use a method called "curriculum learning." Start with simple monosyllables and gradually work up to complex sentences. In cooking terms, it is like starting with "cooking rice," then moving on to "miso soup," and then "curry"—learning step by step.

Another technique for efficient training is designing the dataset around phoneme balance. In Japanese, "あ" (a) and "い" (i) appear frequently, while "ぢ" (di) and "づ" (du) are rare. Instead of recording every phoneme equally, adjusting the number of recordings to match real-world frequency lets you build an efficient dataset.

1.3 Efficient Training Through Data Augmentation

To extract the maximum learning effect from limited data, we use a technique called data augmentation: applying various transformations to existing data to effectively increase its volume.

For audio data, changing the speaking rate is effective. Stretching or compressing the original audio between 0.8x and 1.2x lets the model learn a range of speaking rates, from slow speech to rapid speech. Note that the mouth-shape data must be stretched by the same ratio.

Adding slight noise also helps. Real-world environments are never perfectly silent, so adding moderate noise produces a more robust model. If the noise is too strong, however, phonetic information is damaged, so the signal-to-noise ratio should be kept at 20dB or higher.

Professor Quo: Let me compare data augmentation to photo editing.
Manabu: What are we doing with photos?
Professor Quo: Well, from a single photo you can create several variations—changing the brightness, rotating it slightly, zooming in.
Manabu: True. But it's still the same photo, right? Does that actually help training?
Professor Quo: Good question. When training a face-recognition AI, for example, showing it not only frontal shots but also slightly turned faces and photos with different lighting makes its recognition more flexible. Lip-sync is the same: the model learns to predict mouth shapes correctly even when the speaking rate differs or a little noise creeps in.
Manabu: I see! It's training that anticipates real-world conditions.

Small shifts along the time axis are another effective augmentation technique. Randomly offsetting the audio/mouth-shape synchronization within ±30 milliseconds trains a robust model that works even when synchronization is imperfect. This builds tolerance to the sync drift that can occur in real applications.

Combining these augmentation techniques can generate 10 to 20 times the original volume of effective training data. Turning 1,000 original samples into 10,000 to 20,000 training samples makes it possible to train a high-quality model even on a limited recording budget.

2. The LSTM Training Process: Why It Can Learn from Little Data

2.1 The Strength of a Time-Series Inductive Bias

One reason LSTMs can learn effectively from small datasets is that they carry an "inductive bias."An inductive bias is the "preferred direction of learning" built into a model; in the case of LSTMs, the assumption that "time-series data should be processed in order" comes built in.

This inductive bias resembles how humans learn. When we learn language, we instinctively understand that the order of sounds matters. Nobody has to teach us that "こんにちは" (konnichiwa, "hello") and "はちにんこ" (hachininko—the same syllables reversed) mean completely different things—it is too obvious to even mention. Likewise, an LSTM "knows" that temporal order matters, which is why it can learn patterns efficiently from little data.

Professor Quo: Let me explain the LSTM's inductive bias with a musical-instrument analogy.
Manabu: "Inductive bias"... that's quite a mouthful...
Professor Quo: The term is difficult, but the concept is extremely simple. When you learn piano, there is a built-in assumption from the start that notes are played in order. Nobody has to tell you "play re after do" every single time—you look at the score and know to play in sequence.
Manabu: True, we understand that as a given.
Professor Quo: LSTMs are the same. The assumption that "audio is processed in temporal order" is built in from the start, so even with little data the model can efficiently discover patterns like "ah, after this sound, the mouth takes this shape."
Manabu: I see! So it can discover the regularities without being shown every possible combination.

2.2 A Staged Training Strategy (Vowels → Consonants → Complex Phonemes)

Another key to efficient training is a staged strategy. Rather than throwing complex sentences at the model from the start, we begin with easy material and gradually raise the difficulty.

In stage one, the model learns only the five Japanese vowels (あ・い・う・え・お). Vowel mouth shapes are relatively simple and change smoothly, making them easy targets for an LSTM. This stage establishes the basic open/close patterns of the mouth and their correspondence with the audio features. A few hundred samples are usually enough to learn most of the basic vowel patterns.

In stage two, we add plosives (the p-, b-, and t-rows of the kana table, and so on) and fricatives (the s- and h-rows, etc.). These consonants produce distinctive changes in mouth shape and therefore require learning different patterns from vowels. But because the correspondence for the basic patterns was learned in stage one, the new patterns are picked up fairly efficiently.

In stage three, the model learns natural sentences containing all phonemes. At this stage it learns more complex phenomena, such as coarticulation and long-range dependencies. The knowledge acquired in earlier stages serves as the foundation on which more advanced patterns are built up.

Professor Quo: Let me compare this staged training to studying math.
Manabu: I sort of get the idea of staged learning—start from the basics and raise the bar bit by bit, right?
Professor Quo: Yes, exactly. Starting with calculus right away would be brutal. You learn addition first, then multiplication, then equations—step by step.
Manabu: Right, without the basics you can't understand the advanced material.
Professor Quo: Lip-sync training is the same. First learn the "addition" of vowels, then the "multiplication" of consonants, and then the "equations" of complex sentences. The knowledge gained at each stage becomes the foundation for the next, so the total amount of data needed drops dramatically.

2.3 Loss Function Design for Efficient Training

Another important factor in boosting training efficiency is designing an appropriate loss function.Rather than simply minimizing the difference between predicted and ground-truth values, we perform optimization from multiple perspectives directly tied to lip-sync quality.

First is a loss for positional accuracy. For each of the 26 mouth-shape parameters, we compute the difference between the predicted and ground-truth values. However, instead of weighting every parameter equally, visually important parameters (jaw_open, mouth_open, and the like) are given larger weights. This concentrates the limited learning capacity on the parts that matter most.

Next is a loss for temporal smoothness. Physical constraints prevent the human mouth from changing drastically in an instant. So we also include the amount of change between consecutive frames in the loss function. This prevents choppy, unnatural movement and teaches the model smooth mouth motion.

We further add constraints on velocity and acceleration. There are limits to how fast a mouth can open and close, and abrupt acceleration or deceleration looks unnatural. Building these physical constraints into the loss function teaches more human-like movement.

An Example Loss Function

L_total = λ₁L_position + λ₂L_velocity + λ₃L_acceleration + λ₄L_smoothness + λ₅L_phoneme

Now let's look at each term in detail.

1. Position Loss (L_position) - Accuracy of the Mouth Shape
Time Mouth opening Truth Predicted
L_position = Σᵢ wᵢ × ||y_pred - y_true||²

Computes the difference between predicted and ground-truth values at each time step. Important parameters (jaw opening, mouth opening) receive larger weights.

jaw_open: ×2.0
mouth_open: ×2.0
others: ×1.0
2. Velocity Loss (L_velocity) - Speed of Movement
Time Velocity t→t+1
v = y[t] - y[t-1]
L_velocity = ||v_pred - v_true||²

Computes the change between consecutive frames (first derivative). Constrains the mouth from opening or closing too abruptly.

3. Acceleration Loss (L_acceleration) - Rate of Change of Movement
Time Acceleration Good (smooth) Bad (abrupt)
a = v[t] - v[t-1]
L_acceleration = ||a_pred||²

Computes the rate of change of velocity (second derivative). Suppresses abrupt acceleration and deceleration for physically natural movement.

4. Smoothness Loss (L_smoothness) - Minimizing Jerk
Jerky movement Smooth movement
jerk = a[t] - a[t-1]
L_smoothness = ||jerk||²

Minimizes the rate of change of acceleration (third derivative = jerk). Natural human movement is smooth, with no abrupt changes.

5. Phonetic Consistency Loss (L_phoneme) - Matching Sound and Mouth Shape
Phoneme /a/, /i/, /u/ Mouth jaw, lips Predict Verify
phoneme_estimated = inverse_model(y_pred)
L_phoneme = CrossEntropy(phoneme_estimated, phoneme_true)

Estimates the phoneme back from the predicted mouth shape and checks whether it matches the original phoneme. A bidirectional consistency check.

Weight Distribution Across Losses
Position 40%
Velocity 20%
Accel. 20%
Smooth 10%
Phoneme 10%

These weights are adjustable and tuned per use case. For example, you might emphasize smoothness for an animated character, or positional accuracy for a photorealistic human—optimizing for whatever the goal is.

Professor Quo: Let me compare loss-function design to dance choreography.
Manabu: Dance choreography?
Professor Quo: Yes. First, let's try an experiment. Raise your hand from beside your face to above your head over three seconds.
Manabu: (raises hand) Like this?
Professor Quo: Good. Now do it again, but stop crisply at each instant—raise it in a jerky, stop-motion way.
Manabu: (raises hand jerkily) Whoa, I look like a robot...
Professor Quo: Right! Expressing that difference mathematically is exactly what derivatives do. Let me explain in order.
Professor Quo: First, position. This is simply "where the hand is right now."
Manabu: Like, shoulder height at 1 second, ear height at 2 seconds, above the head at 3 seconds... that sort of thing?
Professor Quo: Exactly! But if you only watch position, you can't tell whether it teleported. That's why we need the next one.
Professor Quo: Velocity is "how far it moved compared to one second ago." As a formula:

velocity = (current position - position 1 second ago) ÷ 1 second
Manabu: Ah, you subtract to see the amount of change!
Professor Quo: Yes! That's the first derivative. The "order" tells you how many times you subtracted. But velocity alone still leaves a problem...
Manabu: What, still not enough?
Professor Quo: Imagine driving a car. Going from 0 to 60 km/h in one second versus ten seconds—which is more comfortable?
Manabu: Ten seconds, absolutely! One second would snap my neck...
Professor Quo: That's why acceleration matters! Acceleration is "the change in velocity":

acceleration = (current velocity - velocity 1 second ago) ÷ 1 second
Manabu: Ah, differentiating (subtracting) the velocity once more makes it the second derivative!
Professor Quo: Correct! Mouth movement is the same—opening or closing abruptly looks unnatural.
Professor Quo: One more, last one. When you ride an elevator, don't you feel that "floaty" sensation the moment it starts moving or stops?
Manabu: I do! I hate that feeling...
Professor Quo: That's jerk—the change in acceleration!

jerk = (current acceleration - acceleration 1 second ago) ÷ 1 second
Manabu: Three subtractions, so the third derivative...! But why do we even need this?
Professor Quo: In natural human movement, even the acceleration changes smoothly. Muscles cannot apply or release force instantaneously.
Manabu: So each order of derivative detects a different kind of "unnaturalness"?
Professor Quo: Exactly! To summarize:
Position only → teleporting allowed (bad)
Position + velocity → sudden starts and stops allowed (still bad)
Position + velocity + acceleration → jittery movement allowed (almost there)
All of them → natural, smooth movement (perfect!)
Manabu: Like climbing stairs one step at a time, it gets more and more human!
Professor Quo: A wonderful understanding! That's why the loss function penalizes all of these, teaching the computer to "move like a human."
Manabu: But Professor, how do you obtain the velocity and acceleration data in the first place?
Professor Quo: Very good question! In fact, the captured data contains only position information.
Manabu: What? Then where do velocity and acceleration come from...?
Professor Quo: We use a little mathematical magic! They can be computed automatically from the position data.
Professor Quo: First, we film the actor with markers attached to their face.

Frame 1: mouth opening = 0mm
Frame 2: mouth opening = 5mm
Frame 3: mouth opening = 12mm
Frame 4: mouth opening = 18mm
Manabu: So you record only the position at each instant.
Professor Quo: Yes! At 60fps, that's 60 position samples per second. From these, we compute velocity:

Velocity at frame 2 = (5mm - 0mm) ÷ (1/60 s) = 300mm/s
Velocity at frame 3 = (12mm - 5mm) ÷ (1/60 s) = 420mm/s
Velocity at frame 4 = (18mm - 12mm) ÷ (1/60 s) = 360mm/s
Manabu: I see! Subtract neighboring values and out comes velocity!
Professor Quo: Likewise, acceleration can be computed from the velocity data:

Acceleration at frame 3 = (420 - 300) ÷ (1/60 s) = 7200mm/s²
Acceleration at frame 4 = (360 - 420) ÷ (1/60 s) = -3600mm/s²
Manabu: A negative value means it's decelerating! But why bother computing all this?
Professor Quo: Three reasons:
1. Filming stays simple - you only need to capture positions
2. Noise resistance - you can apply filtering when differentiating
3. Leveraging physics - you can add constraints like "acceleration this abrupt is impossible"
Manabu: Ah, so that's why the loss function computes velocity and acceleration from both the predicted motion and the ground-truth motion and compares them!
Professor Quo: Perfect! In other words:

Ground truth: position → compute velocity → compute acceleration
Prediction: position → compute velocity → compute acceleration
       ↓
   Compare at each level and apply penalties
Manabu: I see! Filming stays simple with positions only, but training still examines the full complexity of the motion... clever!
Professor Quo: And the interesting part is that this way, physically correct movement can be learned even from little data—because strange movements receive heavy penalties at the velocity and acceleration levels.
Manabu: So even with little data, you can teach it the physical common sense that "a human mouth doesn't move like that"!
Professor Quo: Exactly! A derivative is like a "magnifying glass for change." One alone is coarse, but use three and you can spot even subtle unnaturalness. That's the secret of the lip-sync loss function.
Manabu: For dance and lip-sync alike, looking natural comes from a combination of many factors! Physics really is at work everywhere!

Phonetic-consistency loss also matters. We estimate the phoneme back from the predicted mouth shape and check whether it matches the original phoneme. This verifies that the correspondence between sound and mouth shape has been learned correctly. This bidirectional consistency check makes the training more reliable.

By combining these loss functions appropriately, an LSTM can capture the essence of the human speech mechanism even from little data. With each loss term guiding the training from a different angle, learning becomes both efficient and effective.

3. The Limits of LSTMs: The Problem of Not Seeing Far Away

3.1 Information Decay from Sequential Processing

LSTMs are excellent time-series models, but they carry a fundamental limitation. Their biggest problem is "information decay," which stems from their sequential processing structure.

At each time step, an LSTM receives information from the previous step, processes it, and passes it on to the next. Along the way, the information is inevitably transformed, and some of it is lost. The gate mechanism preserves information longer than a plain RNN can, but there are still limits. In particular, experiments confirm that information from more than 20 steps away fades considerably.

Professor Quo: Let me explain LSTM information decay with a bucket brigade.
Manabu: A bucket brigade?
Professor Quo: Yes—the old firefighting method where people line up from the river to the fire and pass buckets of water along. Even if the first bucket starts out full, a little water spills at every handoff.
Manabu: Right, by the end there'd be a lot less water.
Professor Quo: LSTMs are the same. Information about the first phoneme is lost bit by bit as it gets passed along. The gate mechanism acts like a "bucket that doesn't spill easily," so it does better than a plain RNN, but after a relay of 20 or 30 people, the original information is still quite diluted.
Manabu: So in a long sentence, information from the beginning never quite reaches the end.

3.2 The Problem with Long Sentences: Information 20 Steps Away Fades

In real lip-sync tasks, this problem has a serious impact. For example, consider the sentence "私は昨日、友達と一緒に映画を見に行って、とても感動しました" ("Yesterday I went to see a movie with a friend, and it really moved me").

This sentence consists of roughly 20 phonemes. By the time the model predicts the mouth shape for the sentence-final "ました" (mashita), almost none of the information from the sentence-initial "私は" (watashi wa) remains. Yet in actual speech, there are features that stay consistent from start to finish—the intonation pattern of the whole sentence, the speaker's emotional state, and so on. LSTMs cannot adequately capture these long-range dependencies.

Japanese honorific expressions make things even trickier. "行きます" (ikimasu, "I will go") and "行きました" (ikimashita, "I went") differ only in their final syllables, yet the articulation pattern of the whole sentence actually differs subtly between them. Polite speech tends to involve clearer mouth movements overall, but by the time an LSTM reaches the end of the sentence, this stylistic information has already been lost.

3.3 Problems Even Bidirectionality Cannot Fully Solve

As introduced in the previous article, a bidirectional LSTM can also use future information, which alleviates the problem to some extent. But it is still not a fundamental solution.

Even in a bidirectional LSTM, information decays in both the forward and backward directions. For instance, when processing the middle (15th) phoneme of a 30-phoneme sentence, the forward LSTM has already lost much of the first five phonemes or so, while the backward LSTM has lost much of the last five. In other words, information from both ends of the sentence cannot be fully utilized.

Professor Quo: Let me compare the limits of bidirectional LSTMs to writing meeting minutes.
Manabu: Hmm, meeting minutes?
Professor Quo: Yes. When you summarize a remark from the middle of a one-hour meeting, you want to reference the background discussed at the beginning and the conclusions reached at the end, right?
Manabu: Right. But as time passes, the fine details start slipping away.
Professor Quo: That is exactly the problem with bidirectional LSTMs. Whether you look from the front or from the back, information about distant parts fades. Even with notes, the details don't survive. So when processing a phoneme near the middle of a sentence, the model cannot fully use the important information at the beginning or the end.
Manabu: I see. Even looking from both directions, faraway information ends up blurry anyway.

Bidirectional LSTMs also have a structural constraint. The forward and backward information is eventually combined, but that combination is nothing more than simple concatenation or addition. Complex operations such as "directly comparing information at the start of the sentence with information at the end" are not something it handles well. These limits become problematic in situations such as: long exclamatory sentences where the emotion at the start influences the mouth movement of the whole sentence; questions where the sentence-final interrogative determines the intonation of the entire sentence; and sentences with complex subordinate clauses where the relationship between the main and subordinate clauses must be understood correctly.

To solve this long-range dependency problem at its root, we need a mechanism that can reference information from every position simultaneously and directly, rather than processing it sequentially.
Enter the Transformer—the approach that solves exactly this problem!

4. The Transformer Revolution: Seeing Everything at Once

4.1 The Basic Concept of Self-Attention

The heart of the Transformer is an innovative mechanism called Self-Attention. Where an LSTM processes information in order, Self-Attention can reference the information at every position simultaneously and directly.

To understand the difference, first consider how humans read. When we read a sentence, we do not necessarily process it one character at a time in order. Our eyes jump to important words, moving back and forth between related parts as we grasp the overall meaning. Self-Attention is a mechanism that mimics exactly this human cognitive process.

Professor Quo: Let me explain how Self-Attention works with an analogy: viewing paintings at an art museum.
Manabu: Attention is famous in the AI world, isn't it? How does it actually work?
Professor Quo: Well—when you look at a large painting, how do you view it? Do you start at the top-left corner and scan it piece by piece in order?
Manabu: No. I take in the whole thing first, then focus on the parts that catch my eye, or compare related areas.
Professor Quo: That is exactly Self-Attention! An LSTM views the painting from one edge in order, but Self-Attention sees the whole painting at once and can freely compare important or related parts.
Manabu: I see! So it can directly understand relationships between parts that are far apart.

Self-Attention proceeds in three steps. First, from the information at each position, it generates three vectors: a Query, a Key, and a Value. Next, it computes the similarity between Queries and Keys across all positions to decide where to attend. Finally, it takes a weighted sum of the Values according to those attention scores, producing a new representation for each position.

4.2 Why It Can "See Far": The Power of Parallel Processing

The reason Self-Attention can "see distant information" lies in its parallel processing. In an LSTM, information propagates sequentially, so distant information inevitably decays; Self-Attention instead computes the relationship between every pair of positions directly.

Suppose we have a 50-phoneme sentence. In an LSTM, information from the 1st phoneme needs 49 hops to reach the 50th. If each step multiplies the information by 0.95, it ends up decayed to 0.95^49 ≈ 0.08 of its original strength.

Self-Attention, by contrast, computes the relationship between the 1st and 50th phonemes directly. No matter what lies in between, if these two positions are strongly related, they can form a strong connection. There is no information decay at all.

Professor Quo: Let me compare LSTMs and Self-Attention to ways of reaching people on a smartphone.
Manabu: Smartphones? What do you mean?
Professor Quo: An LSTM is like a phone tree. A calls B, B calls C, C calls D, passing the message along in order. For A's message to reach D, it has to go through B and C.
Manabu: Professor, phone trees don't even exist anymore! That's the thing from elementary school where announcements got passed along like a game of telephone, right? Halfway through, someone always goes, "um, what was it again?"
Professor Quo: Exactly! Self-Attention, on the other hand, is like a group chat. Everyone is in the same group, and anyone can talk to anyone directly.
Manabu: I see! If D wants to see A's message, he just scrolls up and reads it directly!
Professor Quo: A perfect understanding! And you can freely compare related messages. For example, you can directly connect the question "Where should we go for lunch today?" with the reply "I'm craving ramen" even if they are far apart.
Manabu: With a phone tree (the telephone game), someone in the middle might forget the "lunch" part, but in a group chat you can see every past message. Reassuring!

4.3 Concrete Benefits for Lip-Sync

Self-Attention brings the following benefits to lip-sync tasks in particular.

First, stylistic consistency can be maintained across long sentences. For example, in the sentence
"私は昨日、友達と一緒に映画を見に行って、とても感動しました"
, the speaker information in the sentence-initial "私は" (watashi wa, "I") and the emotional expression in the sentence-final "感動しました" (kandou shimashita, "was deeply moved") can be linked directly. This makes it possible to maintain a consistent style of mouth movement across the entire sentence.

Second, complex coarticulation patterns become learnable. In Japanese, the mouth shape for "っ" (the geminate consonant) depends heavily on the consonants around it, but Self-Attention can assign appropriate attention to the neighboring phonemes and predict the correct mouth shape.

Prosody-pattern capture also improves. In a question, the rising intonation at the end affects the entire sentence; Self-Attention can directly relate the sentence-final interrogative to every position in the sentence, learning the appropriate prosodic pattern.

Professor Quo: Let me explain the benefits of Self-Attention for lip-sync with a karaoke analogy.
Manabu: Karaoke?
Professor Quo: Yes. When you sing a song for the first time at karaoke, which goes better: chasing the lyrics character by character as you sing, or reading through the whole lyric sheet and memorizing it first?
Manabu: Knowing the whole song, definitely! You know what lyrics are coming next.
Professor Quo: Exactly! An LSTM is the "chase the lyrics one character at a time" method. Self-Attention is the "see the whole lyric sheet at a glance" method.
Manabu: Ah! So even for the word "ありがとう" (arigatou, "thank you"), whether it's followed by "!" or "..." can change the mouth shape from the very first "あ" (a)!
Professor Quo: Perfect! For an energetic "ありがとう!" the mouth opens wide from the start; for a murmured "ありがとう..." it stays subdued from the start. Because the whole is visible, the right expression is possible from the very beginning.

Self-Attention also offers a major benefit in interpretability. Because you can visualize which phonemes attend to which, you can understand why the model predicted a given mouth shape—extremely useful for improving and debugging the model. In this way, the Transformer's Self-Attention mechanism fundamentally solves the LSTM's long-range dependency problem and enables higher-quality lip-sync generation.

Summary and a Look Ahead

This installment started with the LSTM training process, laid out its limitations, and then introduced the Transformer as an innovative alternative.

In data preparation, we learned techniques for effective training with limited resources. Through data augmentation to multiply effective data volume, a staged training strategy for efficient knowledge acquisition, and loss-function design that optimizes from multiple perspectives, we saw that an LSTM can reach practical performance even with little data.

But we also saw that LSTMs carry a fundamental limitation: information decay caused by sequential processing. The Transformer solves this with its Self-Attention mechanism, which references the information at every position simultaneously and directly—fundamentally resolving the long-range dependency problem and producing more natural, more consistent lip-sync.

In the next installment (Part 5), we will dig into concrete Transformer network designs and the practical challenges of implementing them. We will also introduce hybrid approaches that combine the strengths of LSTMs and Transformers, offering guidance for real-world technology choices—which technique to pick in which situation, drawing on our experience in actual product development. Stay tuned!

Read more