We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Google의 타이탄: 트랜스포머 이후의 AI 시대?
0:05 In 2017, Google published the groundbreaking paper titled "Attention is All You Need",
0:11 which sparked the AI revolution we experience today. This paper introduced Transformers,
0:16 which have become the backbone of most, if not all, top large language models out there
0:20 today. The strength of Transformers is largely attributed to their use of attention. Given
0:25 a sequence of tokens, Transformers process the entire sequence at once, and capture dependencies
0:30 across the entire sequence using the attention mechanism, to provide a high-quality output.
0:35 This incredibly powerful capability comes with a cost, a quadratic dependency on the input
0:39 sequence length. This cost poses limitations on the ability of Transformers to scale up to
0:45 longer sequences. On the other hand, a different type of architecture, recurrent models, does not
0:51 suffer from this quadratic dependency. Instead of processing the entire sequence at once, they do it
0:57 gradually, compressing the data from the sequence into a compressed memory, also called the hidden
1:03 state. This linear dependency contributes to the enhanced scalability of recurrent models. However,
1:10 recurrent models have not proven to be as performant as Transformers. In this video,
1:14 we dive into a new paper by Google Research titled Titans: Learning to Memorize at Test Time, which
1:20 introduces a new model architecture called Titans, that shows promising results while mitigating the
1:25 quadratic cost issue of Transformers. The Titan models are designed with inspiration
1:30 from how memory works in the human brain. An interesting quote from the paper mentions that
1:35 memory is a fundamental mental process and is an inseparable component of human learning. Without
1:40 a properly functioning memory system, humans and animals would be restricted to basic reflexes and
1:45 stereotyped behaviors. More specifically, the paper introduces a novel deep neural
1:50 long-term memory module, that can effectively learn to memorize at test time. Let's start
1:56 with understanding what the deep neural long-term memory module is, and afterwards we'll understand
2:01 how it is incorporated into the Titans models. Unlike in recurrent neural networks, where the
2:06 memory is encoded into a fixed vector, the neural long-term memory module is a model,
2:12 a neural network with multiple layers, that encodes the abstraction of past history into
2:17 its parameters. To train such a model, one idea is to train the model to memorize its training data.
2:24 However, memorization is known to limit models’ generalization and may result in poor performance.
2:30 The researchers designed a fascinating approach to create a model capable of memorization,
2:36 but without overfitting the model to the training data. This approach is inspired by an analogy
2:41 from human memory. When we encounter an event that surprises us, which we did not expect,
2:45 we are more likely to remember that event. The learning process of the neural long-term memory
2:50 module is designed to reflect that. We can learn about that by reviewing the following definition
2:56 from the paper. Mt represents the neural long-term memory module at time t. It is updated using its
3:02 parameters from the previous timestep, and a surprise element modeled as a gradient. If the
3:08 gradient is large, the model is more surprised by the input, resulting in a more significant update
3:13 to the model weights. However, this definition is still not ideal. From a human perspective, a
3:19 surprising event will not continue to surprise us through a long period of time, although it remains
3:24 memorable. We usually adapt to the surprising event. Nevertheless, the event may have been
3:28 surprising enough to get our attention through a long timeframe, leading to memorizing the entire
3:34 time frame. We can learn about the improved modeling from the following definitions from
3:38 the paper that include modeling of past surprise. Now, we update the weights of the neural long-term
3:44 memory using the state of the previous weights, and a surprise component, noted as St. The
3:49 surprise component is now measured over time, and is composed of the previous surprise, with a decay
3:54 factor and the same momentary surprise we already discussed. Another factor that is not modeled
3:59 here yet is forgetting. When dealing with very large sequences millions of tokens for example,
4:05 it is crucial to manage which past information should be forgotten. We can see the final modeling
4:10 in the following definitions from the paper. This is identical to the previous definition except
4:15 that we add an adaptive forgetting mechanism, noted with alpha and is also called a gating
4:21 mechanism. This allows the memory to forget the information that is not needed anymore. The loss
4:26 function is defined with the following equations. The loss aims to model associative memory,
4:31 by storing the past data as the pairs of keys and values, and teach the model to map between keys
4:37 and values. Similarly to Transformers, linear layers project the input into keys and values.
4:43 The loss then measures how well the memory module learns the associations between keys and values.
4:49 To clarify, the model does not process the entire sequence at once, but rather process it gradually,
4:54 accumulating embedding memory information in its weights. We'll now review how this deep neural
4:59 long-term memory module is incorporated into the Titans models, but before, if you're finding
5:04 this content valuable, please don't forget to subscribe and hit the like button to support the
5:09 channel. We also send one-minute read summaries by mail about the papers we review here. You can
5:15 find the link to join in the description of this video. Let's move on to review the architecture
5:19 of the Titan model. The paper suggests a few different architectures. The first is called
5:24 Memory as a Context. We can learn about it using the following figure from the paper. The model
5:29 consists of 3 components, persistent memory, core, and contextual memory. Given a long input
5:36 sequence, we chunk it into smaller sequences. The sequence shown at the Core component is actually a
5:41 chunked sequence. We first incorporate persistent memory by adding learnable data-independent
5:47 weights to the beginning of the sequence. These are in practice learnable tokens that store global
5:53 information which is not impacted by the input. The sequence is also passed via an attention block
5:58 and adding the learnable tokens at the beginning of the sequence helps avoid attention drain,
6:03 where due to bias, attention weights are highly active toward initial tokens. Adding learnable
6:08 meta tokens also proved successful in Hymba by Nvidia, which we covered not long ago on this
6:14 channel as well. Next, we incorporate contextual memory. Contextual memory consists of the deep
6:20 neural long-term memory module, since it depends on the context. We retrieve memory tokens from
6:25 the long-term memory using a forward pass of the neural long-term memory module, with the input
6:30 chunked sequence as input. Since the neural memory keeps being updated even in test time,
6:36 when we process a chunk of a long sequence, the neural memory is already updated with information
6:42 from previous chunks of the same sequence. The retrieved memory tokens are added to the input
6:47 sequence, after the persistent memory tokens. The core component brings it all together,
6:53 using an attention block that is fed with the extended sequence, that contains information from
6:57 the persistent memory, the contextual memory and the input itself. This way the model can
7:03 leverage multiple memory types. The output from the attention block is used to update the neural
7:07 memory. The attention mechanism helps to determine for a given input, whether the long-term memory
7:12 should be used or not. Additionally, attention helps the long-term memory to store only useful
7:17 information from the current context. The final output is determined based on the attention block
7:23 output and the output from the neural memory. The next Titan architecture version is called
7:28 Memory as a Gate, and it also has a great illustration from the paper. In this version,
7:33 we also have 3 branches that represent persistent memory, core, and contextual memory. A difference
7:39 from the previous version, is that the sequence is not chunked. The input sequence here is the full
7:45 input sequence. This is made possible by utilizing sliding window attention in the attention block.
7:50 The persistent memory learnable weights are again added to the beginning of the sequence. But unlike
7:55 before, the neural memory does not contribute data into the context for the attention block. Instead,
8:01 the neural memory is updated from the input sequence and its output is combined with the core
8:06 branch using a gating mechanism. The third variant of Titan architecture is called Memory as a Layer.
8:12 We can learn about it using the following figure from the paper. Similarly to the previous version,
8:17 Memory as a Gate, the sequence is not chunked, and we use sliding window attention. In this version,
8:23 we use the neural memory as a model layer, where the input sequence, together with the learnable
8:29 weights, first pass via the neural memory, and afterwards via the attention block. This
8:34 design allows stacking layers of multiple neural memory modules and attention blocks,
8:40 similar to how Transformer layers are usually stacked. However, the sequential design limits
8:45 the power of the model by the power of each of the layers. This is again a similar observation
8:50 to the Hymba paper where Nvidia placed different components in parallel, rather than sequential,
8:56 for this exact same reason. Another last variant is called LMM, which represents a version without
9:02 an attention block, solely relying on the memory module. Let's now move on to see how Titan models
9:08 perform comparing to other models. In the following table from the paper, we can see
9:12 comparison of the 4 Titan versions with baselines on language modeling and commonsense reasoning
9:17 tasks. The best results are marked in blue for hybrid models, that utilize both recurrent and
9:23 attention mechanisms, and in yellow the best results for non-hybrid models. The non-hybrid
9:29 Titan version, LMM, which is the fourth variant without the attention block, achieves the best
9:35 results comparing to other non-hybrid models, showcasing the power of the neural long-term
9:39 memory module. Among the hybrid models, Memory as a Context Titan achieves the overall best results,
9:46 where Memory as a Gate Titan is slightly behind it. Another interesting comparison is for the
9:51 needle in a haystack task, where we can see the result in the following table from the paper.
9:55 In this task, the models need to retrieve a piece of information from a very long text,
10:00 thus measuring the actual effective context length of models. The numbers in the title
10:05 show the length of the evaluated sequences. We can see a clear win for Titans comparing to baselines
10:11 as the sequence length is increased on all three benchmarks. Another very interesting result can be
10:16 seen in the following figure from the paper, that shows comparison of Titans with top models on the
10:21 BABILong benchmark. This is a harder benchmark for long sequences, in which the model needs
10:26 to reason across facts distributed in extremely long documents. On the x axis we see the sequence
10:32 length and on the y axis we measure the accuracy of each model. The results of Memory as a Context
10:38 Titan are shown in the red line, significantly outperforms other models on very long sequences.
10:44 very impressive. Thank you for watching and stay tuned for more reviews of AI papers
0:05 2017년, 구글은 "Attention is All You Need"라는 기념비적인 논문을 발표하면서 오늘날 우리가 겪고 있는 AI 혁명의 불을 지폈습니다. 이 논문에서 트랜스포머가 처음 소개되었는데, 현재 최고 수준의 대규모 언어 모델들의 근간이 되었죠. 트랜스포머의 강력함은 바로 어텐션 메커니즘에서 비롯됩니다.
0:25 트랜스포머는 토큰 시퀀스가 주어지면 전체 시퀀스를 한 번에 처리하고, 어텐션 메커니즘을 통해 시퀀스 전체의 의존성을 파악하여 고품질 결과물을 만들어냅니다. 하지만 이 엄청난 능력에는 입력 시퀀스 길이에 따른 이차 종속성이라는 대가가 따릅니다.
0:39 이 비용 때문에 트랜스포머가 더 긴 시퀀스를 처리하는 데 제약이 생기죠. 반면에 순환 모델이라는 다른 아키텍처는 이런 이차 종속성 문제를 겪지 않습니다. 순환 모델은 전체 시퀀스를 한 번에 처리하는 대신, 점진적으로 처리하면서 시퀀스의 데이터를 압축된 메모리, 즉 'hidden state'라고 불리는 형태로 압축합니다.
1:03 이러한 선형 종속성 덕분에 순환 모델은 확장성이 뛰어나지만, 성능 면에서는 트랜스포머만큼 좋지 못하다는 것이 밝혀졌습니다. 이번 영상에서는 구글 리서치의 새로운 논문, "Titans: Learning to Memorize at Test Time"을 살펴보겠습니다. 이 논문은 트랜스포머의 이차 비용 문제를 완화하면서도 매우 유망한 결과를 보여주는 Titans라는 새로운 모델 아키텍처를 소개합니다.
1:25 Titan 모델은 인간 두뇌의 기억 작동 방식에서 영감을 받아 설계되었습니다. 논문에서 흥미로운 점은 "기억은 기본적인 정신 과정이며, 인간 학습에 있어 필수적인 요소"라고 언급한 부분입니다. 제대로 작동하는 기억 시스템이 없다면 인간과 동물은 기본적인 반사 작용과 정형화된 행동에만 의존하게 될 겁니다.
1:45 좀 더 구체적으로 말하자면, 이 논문은 테스트 시간에 효과적으로 기억하는 방법을 학습할 수 있는 새로운 심층 신경 장기 기억 모듈을 제시합니다. 먼저 심층 신경 장기 기억 모듈이 무엇인지 알아보고, 이것이 Titans 모델에 어떻게 통합되는지 살펴보겠습니다.
2:01 메모리가 고정된 벡터로 인코딩되는 순환 신경망과는 달리, 신경 장기 기억 모듈은 과거 이력의 추상화를 해당 파라미터에 인코딩하는 모델, 즉 여러 계층으로 이루어진 신경망입니다. 이러한 모델을 훈련시키는 한 가지 방법은 모델이 훈련 데이터를 기억하도록 학습시키는 것입니다.
2:24 하지만 암기는 모델의 일반화 능력을 제한하고 성능 저하를 초래할 수 있다는 것이 잘 알려져 있습니다. 연구자들은 암기는 가능하지만 훈련 데이터에 과적합되지 않는 모델을 만드는 흥미로운 접근 방식을 고안했습니다. 이 접근 방식은 인간 기억의 비유에서 영감을 얻었습니다.
2:41 우리는 예상치 못한 놀라운 사건을 접하면 그 사건을 더 잘 기억하는 경향이 있습니다. 신경 장기 기억 모듈의 학습 과정은 이를 반영하도록 설계되었습니다. 논문에 나오는 다음 정의를 통해 자세히 알아보겠습니다.
2:56 Mt는 시간 t에서의 신경 장기 기억 모듈을 나타냅니다. 이는 이전 시간 단계의 파라미터와 기울기로 모델링된 '놀라움' 요소를 사용하여 업데이트됩니다. 기울기가 클수록 모델은 입력에 더 크게 놀라게 되고, 모델 가중치가 더 크게 업데이트됩니다.
3:13 하지만 이 정의는 아직 완벽하지 않습니다. 인간의 관점에서 볼 때, 놀라운 사건은 기억에 남을지라도 오랜 기간 동안 우리를 계속 놀라게 하지는 않습니다. 우리는 일반적으로 놀라운 사건에 적응하죠.
3:28 그럼에도 불구하고 그 사건은 오랜 기간 동안 우리의 관심을 끌 만큼 놀라웠을 수 있으며, 우리는 전체 기간을 기억하게 될 수 있습니다. 과거의 놀라움을 모델링하는 것을 포함하는 논문의 다음 정의에서 개선된 모델링에 대해 알아볼 수 있습니다.
3:44 이제 이전 가중치의 상태와 St로 표시된 놀라움 구성 요소를 사용하여 신경 장기 기억의 가중치를 업데이트합니다. 놀라움 구성 요소는 이제 시간이 지남에 따라 측정되며, 감쇠 계수가 있는 이전 놀라움과 이미 논의한 동일한 순간적인 놀라움으로 구성됩니다.
3:59 여기에 아직 모델링되지 않은 또 다른 요소는 바로 '망각'입니다. 수백만 개의 토큰과 같은 매우 큰 시퀀스를 처리할 때는 어떤 과거 정보를 잊어야 하는지 관리하는 것이 중요합니다. 논문의 다음 정의에서 최종 모델링을 확인할 수 있습니다.
4:10 이는 적응형 망각 메커니즘(알파로 표시되며 게이팅 메커니즘이라고도 함)을 추가했다는 점을 제외하고는 이전 정의와 동일합니다. 이를 통해 메모리는 더 이상 필요하지 않은 정보를 잊을 수 있습니다. 손실 함수는 다음 방정식으로 정의됩니다.
4:31 손실은 과거 데이터를 키-값 쌍으로 저장하여 연관 메모리를 모델링하고, 모델이 키와 값 사이를 매핑하도록 가르치는 것을 목표로 합니다. 트랜스포머와 유사하게 선형 레이어는 입력을 키와 값으로 투영합니다. 그런 다음 손실은 메모리 모듈이 키와 값 간의 연관성을 얼마나 잘 학습하는지 측정합니다.
4:49 다시 한번 강조하지만, 모델은 전체 시퀀스를 한 번에 처리하는 것이 아니라 점진적으로 처리하면서 가중치에 임베딩 메모리 정보를 축적합니다. 이제 이 심층 신경 장기 기억 모듈이 Titans 모델에 어떻게 통합되는지 살펴보겠습니다. 그 전에, 이 콘텐츠가 유용하다고 생각되시면 채널 구독과 좋아요 버튼을 눌러 채널을 응원해주세요!
5:09 또한 여기서 다루는 논문에 대한 1분 요약본을 이메일로 보내드립니다. 영상 설명란에서 가입 링크를 확인하실 수 있습니다. [설명 링크]
5:19 이제 Titan 모델의 아키텍처를 살펴보겠습니다. 이 논문에서는 몇 가지 다른 아키텍처를 제안합니다. 첫 번째는 '컨텍스트로서의 메모리'라고 불립니다. 논문의 다음 그림을 통해 자세히 알아보겠습니다. 이 모델은 영구 메모리, 코어, 컨텍스트 메모리의 세 가지 구성 요소로 구성됩니다. 긴 입력이 주어지면,
5:36 시퀀스를 더 작은 시퀀스로 분할합니다. 코어 구성 요소에 표시된 시퀀스가 바로 분할된 시퀀스입니다. 먼저 데이터와 독립적인 학습 가능한 가중치를 시퀀스 시작 부분에 추가하여 영구 메모리를 통합합니다. 이는 입력의 영향을 받지 않는 전역 정보를 저장하는 학습 가능한 토큰입니다.
5:53 시퀀스는 어텐션 블록을 통과하게 되는데, 시퀀스 시작 부분에 학습 가능한 토큰을 추가하면 편향으로 인해 어텐션 가중치가 초기 토큰에 과도하게 활성화되는 '어텐션 드레인'을 방지하는 데 도움이 됩니다. 학습 가능한 메타 토큰을 추가하는 것은 Nvidia의 Hymba에서도 성공적인 것으로 입증되었으며, 이 내용은 얼마 전에 저희 채널에서 다룬 적이 있습니다.
6:14 다음으로 컨텍스트 메모리를 통합합니다. 컨텍스트 메모리는 컨텍스트에 따라 달라지기 때문에 심층 신경 장기 기억 모듈로 구성됩니다. 입력으로 분할된 시퀀스를 사용하여 신경 장기 기억 모듈의 순방향 패스를 통해 장기 기억에서 메모리 토큰을 검색합니다.
6:30 신경 메모리는 테스트 시간에도 계속 업데이트되므로, 긴 시퀀스의 청크를 처리할 때 신경 메모리는 이미 동일한 시퀀스의 이전 청크에서 가져온 정보로 업데이트됩니다. 검색된 메모리 토큰은 영구 메모리 토큰 뒤에 입력 시퀀스에 추가됩니다.
6:52 코어 구성 요소는 영구 메모리, 컨텍스트 메모리, 입력 자체에서 가져온 정보가 포함된 확장된 시퀀스를 입력으로 받아 어텐션 블록을 사용하여 모든 것을 종합합니다. 이러한 방식으로 모델은 다양한 유형의 메모리를 활용할 수 있습니다. 어텐션 블록의 출력은 신경 메모리를 업데이트하는 데 사용됩니다.
7:07 어텐션 메커니즘은 주어진 입력에 대해 장기 메모리를 사용해야 하는지 여부를 결정하는 데 도움이 됩니다. 또한 어텐션은 장기 메모리가 현재 컨텍스트에서 유용한 정보만 저장하도록 돕습니다. 최종 출력은 어텐션 블록 출력과 신경 메모리 출력에 따라 결정됩니다.
7:23 다음 Titan 아키텍처 버전은 '게이트로서의 메모리'라고 불리며, 논문에서 훌륭한 그림을 제공합니다. 이 버전에서는 영구 메모리, 코어, 컨텍스트 메모리를 나타내는 세 개의 분기가 있습니다. 이전 버전과의 차이점은 시퀀스가 청크로 분할되지 않는다는 것입니다.
7:45 여기서는 입력 시퀀스가 전체 입력 시퀀스입니다. 이는 어텐션 블록에서 슬라이딩 윈도우 어텐션을 활용하여 가능합니다. 영구 메모리 학습 가능한 가중치는 다시 시퀀스 시작 부분에 추가됩니다. 하지만 이전과는 달리 신경 메모리는 어텐션 블록에 컨텍스트 데이터를 제공하지 않습니다. 대신 신경 메모리는 입력 시퀀스에서 업데이트되고, 해당 출력은 게이팅 메커니즘을 사용하여 코어 분기와 결합됩니다.
8:06 Titan 아키텍처의 세 번째 변형은 '레이어로서의 메모리'라고 합니다. 논문의 다음 그림을 통해 자세히 알아보겠습니다. 이전 버전인 '게이트로서의 메모리'와 유사하게 시퀀스는 청크로 분할되지 않으며 슬라이딩 윈도우 어텐션을 사용합니다.
8:23 이 버전에서는 신경 메모리를 모델 레이어로 사용합니다. 여기서 학습 가능한 가중치와 함께 입력 시퀀스는 먼저 신경 메모리를 통과한 다음 어텐션 블록을 통과합니다. 이 설계를 통해 트랜스포머 레이어가 일반적으로 스택되는 방식과 유사하게 여러 신경 메모리 모듈과 어텐션 블록의 레이어를 스택할 수 있습니다.
8:40 하지만 순차적 설계는 각 레이어의 성능에 따라 모델의 성능이 제한될 수 있습니다. 이는 Nvidia가 동일한 이유로 다른 구성 요소를 순차적이 아닌 병렬로 배치한 Hymba 논문과 다시 유사한 관찰입니다.
8:56 또 다른 마지막 변형은 LMM이라고 하며, 이는 어텐션 블록이 없는 버전으로 메모리 모듈에만 의존합니다. 이제 Titan 모델이 다른 모델과 비교하여 어떻게 작동하는지 살펴보겠습니다.
9:08 논문의 다음 표에서 언어 모델링 및 상식 추론 작업에서 4가지 Titan 버전과 기준선 비교를 볼 수 있습니다. 가장 좋은 결과는 순환 및 어텐션 메커니즘을 모두 활용하는 하이브리드 모델의 경우 파란색으로 표시되고, 비하이브리드 모델의 경우 가장 좋은 결과는 노란색으로 표시됩니다.
9:29 어텐션 블록이 없는 네 번째 변형인 비하이브리드 Titan 버전인 LMM은 다른 비하이브리드 모델과 비교하여 가장 좋은 결과를 얻어 신경 장기 기억 모듈의 성능을 보여줍니다. 하이브리드 모델 중에서 '컨텍스트로서의 메모리' Titan이 전체적으로 가장 좋은 결과를 얻고, '게이트로서의 메모리' Titan이 약간 뒤쳐져 있습니다.
9:51 또 다른 흥미로운 비교는 '건초 더미에서 바늘 찾기' 작업으로, 논문의 다음 표에서 결과를 볼 수 있습니다. 이 작업에서 모델은 매우 긴 텍스트에서 정보를 검색해야 하므로 모델의 실제 유효 컨텍스트 길이를 측정합니다.
10:05 제목의 숫자는 평가된 시퀀스의 길이를 나타냅니다. 세 가지 벤치마크 모두에서 시퀀스 길이가 증가함에 따라 Titan이 기준선과 비교하여 월등히 뛰어난 성능을 보이는 것을 확인할 수 있습니다. 또 다른 매우 흥미로운 결과는 논문의 다음 그림에서 볼 수 있으며, 이는 BABILong 벤치마크에서 Titan과 최고 모델의 비교를 보여줍니다.
10:21 이는 모델이 매우 긴 문서에 분산된 사실을 추론해야 하는 긴 시퀀스에 대한 더 어려운 벤치마크입니다. x축에는 시퀀스 길이가 표시되고 y축에는 각 모델의 정확도가 측정됩니다.
10:32 '컨텍스트로서의 메모리' Titan의 결과는 빨간색 선으로 표시되며, 매우 긴 시퀀스에서 다른 모델보다 훨씬 뛰어난 성능을 보입니다. 정말 인상적이네요! 시청해주셔서 감사합니다. 앞으로도 AI 논문에 대한 더 많은 리뷰를 기대해주세요.
번역된 시간: 2025-03-02T03:32:36Z
번역 버전: 3.1 Improved translation step with full context