cover_v3_1.cropped.mp4 [인공지능 기술] Transformer²: Self-Adaptive LLMs : Transformer²: 자체 적응형 LLM
Transformer²: 자체 적응형 LLM

요약
적응은 자연에서 가장 놀라운 현상 중 하나입니다. 문어가 주변 환경에 어울리도록 피부색을 바꾸는 방식부터 , 인간의 뇌가 부상 후 스스로를 다시 배선하여 개인이 잃어버린 기능을 회복하고 새로운 사고방식이나 움직임에 적응할 수 있도록 하는 방식까지. 살아있는 유기체는 다양하고 끊임없이 변화하는 환경에서 생명이 번성할 수 있도록 하는 적응력을 보여줍니다.
AI 분야에서 적응이라는 개념은 비슷한 매력을 가지고 있습니다. 익숙하지 않은 환경에서 번창하기 위해 동적으로 가중치를 조정할 수 있는 머신 러닝 시스템을 상상해보세요. 본질적으로 학습하면서 진화하는 시스템을 보여줍니다. AI의 자기 적응성은 더 큰 효율성과 현실 세계의 역동적인 본질과 일치하는 평생 모델의 잠재력을 약속합니다.
이러한 자체 적응형 AI 비전은 최신 연구 논문 인 Transformer² ('Transformer-squared') 의 핵심입니다 . 여기서 저희는 다양한 작업에 대한 가중치를 동적으로 조정하는 머신 러닝 시스템을 제안합니다. Transformer² 라는 이름은 2단계 프로세스를 반영합니다. 먼저 모델은 들어오는 작업을 분석하여 요구 사항을 파악한 다음 작업별 적응을 적용하여 최적의 결과를 생성합니다. 모델 가중치의 중요한 구성 요소를 선택적으로 조정함으로써 저희 프레임워크는 LLM이 실시간으로 새로운 작업에 동적으로 적응할 수 있도록 합니다. Transformer²는 다양한 작업(예: 수학, 코딩, 추론 및 시각적 이해)에서 상당한 진전을 보여주며, 훨씬 적은 매개변수를 필요로 하면서도 효율성과 작업별 성능 면에서 LoRA와 같은 기존의 정적 접근 방식을 능가합니다.
저희의 연구는 AI 모델이 더 이상 정적이지 않은 미래를 엿볼 수 있는 기회를 제공합니다. 이러한 시스템은 테스트 시간에 컴퓨팅을 동적으로 확장하여 마주치는 작업의 복잡성에 적응하여 지속적인 변화와 평생 학습이 가능한 살아있는 지능을 구현 합니다. 저희는 자체 적응성이 AI 연구를 혁신할 뿐만 아니라 지능형 시스템과 상호 작용하는 방식을 재정의하여 적응성과 지능이 함께하는 세상을 만들 것이라고 믿습니다.
Transformer² 는 다양한 작업에 대한 가중치를 동적으로 조정하는 머신 러닝 시스템입니다. 적응은 문어가 주변 환경과 색상을 어떻게 섞을 수 있는지, 또는 뇌가 부상 후 어떻게 스스로를 다시 배선하는지와 같은 놀라운 자연 현상입니다. 우리는 새로운 시스템이 새로운 세대의 적응형 AI 모델을 위한 길을 열어, 직면한 작업의 특성에 적응하기 위해 가중치와 아키텍처를 수정하고, 지속적인 변화와 평생 학습이 가능한 살아있는 지능을 구현한다고 믿습니다.
LLM의 뇌를 분석하다
인간의 뇌가 상호 연결된 신경 경로를 통해 지식을 저장하고 정보를 처리하는 것처럼 LLM은 가중치 행렬 내에 지식을 저장합니다. 이러한 행렬은 LLM의 "두뇌"로, 훈련 데이터에서 학습한 내용의 본질을 담고 있습니다.
이 "두뇌"를 이해하고 새로운 작업에 효과적으로 적응할 수 있도록 하려면 뇌의 내부 구조를 자세히 살펴봐야 합니다. 바로 여기서 Singular Value Decomposition( SVD )이 귀중한 통찰력을 제공합니다. SVD를 LLM의 뇌에 대한 세부적인 수술을 수행하는 외과의로 생각해 보세요. 이 외과의는 LLM에 저장된 광대하고 복잡한 지식을 더 작고 의미 있고 독립적인 조각(예: 수학, 언어 이해 등을 위한 다양한 경로 또는 구성 요소)으로 분해합니다.
SVD는 LLM의 가중치 행렬의 주성분을 식별하여 이 목적을 달성합니다. 저희의 연구에서는 이러한 성분의 하위 집합에서 신호를 강화하고 다른 성분은 억제하면 다운스트림 작업에서 LLM의 성능을 개선할 수 있다는 것을 발견했습니다. 이 기반을 바탕으로 Transformer²는 동적이고 작업별 적응을 향한 다음 단계를 밟아 LLM이 다양하고 복잡한 시나리오에서 탁월해질 수 있도록 합니다.
Transformer² 소개
Transformer²는 이러한 강력한 모델이 다양한 작업을 처리하는 방식을 재정의하는 2단계 프로세스를 통해 자체 적응형 LLM 개념을 개척하는 새로운 접근 방식입니다. 핵심은 가중치 행렬의 중요한 구성 요소를 동적으로 조정할 수 있는 기능입니다. 학습 시간에는 다양한 유형의 다운스트림 작업에 대해 다른 "뇌" 구성 요소의 신호를 강화/억제하기 위해 강화 학습(RL)을 사용하는 방법인 Singular Value Finetuning(SVF)을 도입합니다. 추론 시간에는 세 가지 고유한 전략을 사용하여 작업의 정체성을 감지하고 모델의 가중치를 그에 따라 조정합니다. 아래 그림은 방법의 개요를 보여줍니다.
우리 방법의 예시.
왼쪽 : SVD를 사용하여 LLM의 "두뇌"(즉, 가중치 행렬)를 여러 개의 독립적인 구성 요소로 분해합니다.
오른쪽 : RL을 사용하여 다양한 작업에 대한 이러한 구성 요소의 조합을 훈련합니다. 구성 요소는 다른 작업에서 공유될 수 있습니다. 예를 들어, 위 그림에서 보라색 톱니바퀴는 언어 이해 및 추론에서 공유됩니다. 추론 시간에 작업 유형을 식별한 다음 구성 요소의 조합을 동적으로 조정합니다.
SVF 및 RL을 사용한 훈련
훈련 시간에 SVF는 다운스트림 작업마다 하나씩 z-벡터 세트를 학습합니다 . 작업의 전문가로 간주될 수 있는 각 z-벡터는 가중치 행렬의 각 구성 요소의 원하는 강도를 지정하는 컴팩트한 표현으로, 모델의 동작에 대한 다양한 구성 요소의 영향을 조절하는 "증폭기" 또는 "감쇠기" 세트 역할을 합니다.
예를 들어, SVD가 가중치 행렬을 다섯 가지 구성 요소 [A, B, C, D, E]로 분해한다고 가정합니다. 수학 과제의 경우 학습된 z-벡터는 [1, 0.8, 0, 0.3, 0.5]일 수 있으며, 이는 구성 요소 A가 수학에 중요한 반면 구성 요소 C는 성능에 거의 영향을 미치지 않는다는 것을 의미합니다. 언어 이해 과제의 경우 z-벡터는 [0.1, 0.3, 1, 0.7, 0.5]일 수 있으며, 이는 구성 요소 C가 수학에는 덜 유용함에도 불구하고 이 과제에는 필수적임을 강조합니다.
SVF는 RL을 사용하여 미리 정의된 다운스트림 작업 집합에서 이러한 z-벡터를 학습합니다. 학습된 z-벡터를 통해 Transformer²는 최소한의 추가 매개변수(즉, z-벡터)만 도입하면서 다양한 새로운 다운스트림 작업에 적응할 수 있습니다.
자기 적응
추론 시간에 우리는 작업별 z-벡터 세트를 효과적으로 결합하는 프레임워크에 대한 2단계 적응 전략을 고안합니다. 첫 번째 추론 단계에서는 작업이나 개별 입력 프롬프트가 주어지면 Transformer²는 아래 세 가지 적응 방법 중 하나를 사용하여 테스트 시간 조건을 분석합니다. 두 번째 단계에서 Transformer²는 z-벡터를 결합하여 가중치를 적절히 조절하여 새로운 설정에 가장 적합한 최종 응답을 생성합니다.
작업 감지/적응을 위한 세 가지 방법을 요약하면 다음과 같습니다.
-
프롬프트 기반 적응. 특별히 설계된 적응 프롬프트는 작업(예: 수학, 코딩)을 분류하고 사전 훈련된 z-벡터를 선택합니다.
-
분류기 기반 적응. SVF로 훈련된 작업 분류기는 추론 중에 작업을 식별하고 적절한 z-벡터를 선택합니다.
-
Few-shot 적응. 가중 보간을 통해 여러 개의 사전 훈련된 z-벡터를 결합합니다. 간단한 최적화 알고리즘은 few-shot 평가 세트의 성능에 따라 이러한 가중치를 조정합니다.
이 세 가지 방법을 함께 사용하면 Transformer²가 견고하고 효율적인 작업 적응을 달성하여 다양한 시나리오에서 놀라운 성과를 낼 수 있는 길을 열 수 있습니다. 자세한 내용은 논문 을 참조하세요.
주요 결과
우리는 수학(GSM8K, MATH), 코드(MBPP-Pro, HumanEval), 추론(ARC-Easy, ARC-Challenge) 및 시각적 질의응답(TextVQA, OKVQA)을 포함한 광범위한 과제에 걸쳐 Llama와 Mistral LLM에 모두 방법을 적용합니다.
우리는 먼저 이러한 작업에서 SVF로 z-벡터를 얻고 LoRA와 비교했습니다. 아래 표의 결과는 SVF가 텍스트 기반 작업에서 LoRA보다 성능이 뛰어나며, 특히 GSM8K에서 큰 이득을 보였습니다. 이는 LoRA의 미세 조정 방식과 달리 각 질문에 대한 "완벽한 솔루션"이 필요하지 않은 RL 훈련 목표에 기인할 수 있습니다. 오른쪽의 히스토그램은 또한 비전 도메인에서 SVF의 놀라운 용량을 보여줍니다.
광범위한 작업에 대한 SVF 평가.
각 작업을 학습, 검증 및 테스트 세트로 나눕니다. MBPP-Pro의 경우 pass@1을 사용하고 다른 모든 작업의 경우 정확도를 평가 지표로 사용하여 테스트 세트 성능을 보고합니다. 왼쪽 : 언어 작업의 SVF. 정규화된 점수는 괄호 안에 있습니다. 오른쪽 : VQA 작업의 SVF.

그런 다음 우리는 보이지 않는 작업, 특히 MATH, HumanEval, ARC-Challenge에서 LoRA에 대한 적응 프레임워크를 평가합니다. 아래 왼쪽 표는 모든 작업에서 메서드 복잡성이 증가함에 따라 전략이 점점 더 많은 성능 이득을 얻는다는 것을 보여줍니다.
특히 흥미로운 발견은 오른쪽 그림에서 보듯이 few-shot learning이 어떻게 다양한 z-벡터를 결합하여 과제를 해결하는지 분석하는 데서 나왔습니다. 예상과 달리 수학 문제를 풀 때 이 모델은 GSM8K(수학) 전문 z-벡터에만 의존하지 않습니다. 이는 복잡한 수학적 추론이 수학적, 프로그래밍적, 논리적 추론 기능을 결합하는 데 도움이 된다는 것을 시사합니다. 다른 과제와 모델에서도 비슷한 예상치 못한 조합을 관찰하여 프레임워크가 최적의 성능을 위해 다양한 유형의 전문성을 종합하는 능력을 강조합니다.
Transformer² 평가.
보이지 않는 작업에 대한 테스트 세트 성능을 직접 보고합니다. 왼쪽 : 보이지 않는 작업에 대한 자체 적응. 오른쪽 : 학습된 z-벡터 보간 가중치.

마지막으로, 우리는 AI 개발에서 기존의 지혜에 도전하는 흥미로운 질문을 탐구했습니다. 지식을 한 모델에서 다른 모델로 옮길 수 있을까요? 우리의 흥분은, 학습된 z-벡터를 라마에서 미스트랄로 가져갔을 때, 후자가 대부분 작업에서 향상된 성능을 보이는 긍정적인 효과를 관찰했다는 것입니다. 자세한 결과는 아래 표를 참조하세요.
이러한 발견이 유망한 반면, 두 모델 모두 유사한 아키텍처를 공유한다는 점에 유의해야 하며, 이는 호환성을 설명할 수 있습니다. 이러한 지식 공유가 더 다양한 AI 모델 간에 작동하는지는 여전히 미지수입니다. 그럼에도 불구하고 이러한 결과는 더 새롭고 더 큰 모델에 대한 작업별 기술을 풀어내고 재활용할 수 있는 문을 여는 흥미로운 가능성을 시사합니다.
교차 모델 z-벡터 전송.
Llama3-8B-Instruct에서 훈련된 "전문가"를 few-shot 적응을 통해 Mistral-7B-Instruct-v0.3으로 전송한 결과입니다.

미래: 정적 모델에서 살아있는 지능까지
Transformer²는 AI 시스템 진화에서 중요한 이정표를 나타냅니다. 향상된 구성성으로 보이지 않는 작업에 실시간으로 동적으로 적응하는 능력은 자체 적응형 LLM이 AI 연구와 응용 프로그램을 모두 혁신할 수 있는 잠재력을 보여줍니다.
하지만 이것은 시작에 불과합니다. Transformer²는 AI 시스템이 더 이상 고정된 작업을 위해 훈련된 정적 개체가 아닌 미래를 엿볼 수 있는 기회를 제공합니다. 대신, AI는 시간이 지남에 따라 지속적으로 학습하고 진화하며 적응하는 모델인 "살아있는 지능"을 구현할 것입니다. 재교육 없이도 새로운 지식을 원활하게 통합하거나 실제 환경에서 행동을 적응시킬 수 있는 AI를 상상해 보세요. 마치 인간이 새로운 도전에 적응하는 방식과 비슷합니다.
앞으로 나아갈 길은 다른 시스템과 동적으로 적응하고 협업하는 모델을 구축하고, 전문화된 기능을 결합하여 복잡한 다중 도메인 문제를 해결하는 데 있습니다. Transformer²와 같은 자체 적응형 시스템은 정적 AI와 살아있는 지능 간의 격차를 메우고, 산업과 일상 생활 전반에 걸쳐 발전을 이끄는 효율적이고 개인화되고 완벽하게 통합된 AI 도구의 길을 엽니다.

사카나 아이
[출처] https://sakana.ai/transformer-squared/
Transformer²: Self-Adaptive LLMs

Summary
Adaptation is one of the most remarkable phenomena in nature. From the way an octopus can change their skin color to blend into its surroundings, to how the human brain rewires itself after an injury, allowing individuals to recover lost functions and adapt to new ways of thinking or moving. Living organisms exhibit adaptability that allows life to flourish in diverse and ever-changing environments.
In the field of AI, the concept of adaptation holds a similar allure. Imagine a machine learning system that could adjust its own weights dynamically to thrive in unfamiliar settings, essentially illustrating a system that evolves as it learns. Self-adaptiveness in AI promises greater efficiency and the potential for lifelong models ever aligned with the dynamic nature of the real world.
This vision of self-adaptive AI is at the heart of our latest research paper, Transformer² (‘Transformer-squared’), where we propose a machine learning system that dynamically adjusts its weights for various tasks. The name Transformer² reflects its two-step process: first, the model analyzes the incoming task to understand its requirements, and then it applies task-specific adaptations to generate optimal results. By selectively adjusting critical components of the model weights, our framework allows LLMs to dynamically adapt to new tasks in real time. Transformer² demonstrates significant advancements across various tasks (e.g., math, coding, reasoning, and visual understanding), outperforming traditional, static approaches like LoRA in efficiency and task-specific performance while requiring far fewer parameters.
Our research offers a glimpse into a future where AI models are no longer static. These systems will scale their compute dynamically at test-time to adapt to the complexity of tasks they encounter, embodying living intelligence capable of continuous change and lifelong learning. We believe self-adaptivity will not only transform AI research but also redefine how we interact with intelligent systems, creating a world where adaptability and intelligence go hand in hand.
Transformer² is a machine learning system that dynamically adjusts its weights for various tasks. Adaptation is a remarkable natural phenomenon, like how the octopus can blend its color in with its environment, or how the brain rewires itself after injury. We believe our new system paves the way for a new generation of adaptive AI models, modifying their own weights and architecture to adapt to the nature of the tasks they encounter, embodying living intelligence capable of continuous change and lifelong learning.
Dissecting the Brain of LLMs
Just as the human brain stores knowledge and processes information through interconnected neural pathways, LLMs store knowledge within their weight matrices. These matrices are the “brain” of an LLM, holding the essence of what it has learned from its training data.
Understanding this “brain” and ensuring that it can adapt effectively to new tasks requires a closer look at its inner structure. This is where Singular Value Decomposition (SVD) provides invaluable insights. Think of SVD as a surgeon performing a detailed operation on the brain of an LLM. This surgeon breaks down the vast, complex knowledge stored in the LLM into smaller, meaningful, and independent pieces (e.g., the different pathways or components for math, language understanding, etc).
SVD achieves this purpose by identifying the principal components of the LLM’s weight matrices. In our research, we found that enhancing the signal from a subset of these components while suppressing the others could improve an LLM’s performance on downstream tasks. By building on this foundation, Transformer² takes the next step toward dynamic, task-specific adaptation, enabling LLMs to excel in diverse and complex scenarios.
Introducing Transformer²
Transformer² is a novel approach pioneering the concept of self-adaptive LLMs with a two-step process that redefines how these powerful models tackle diverse tasks. At its core is the ability to dynamically adjust critical components of its weight matrices. At training time, we introduce Singular Value Finetuning (SVF), a method that employs reinforcement learning (RL) to enhance/suppress the signals from different “brain” components for various types of downstream tasks. At inference time, we employ three distinct strategies to detect the identity of the task and adapt the model’s weights accordingly. The figure below gives an overview of our method.
Illustration of our method.
Left: We decompose an LLM’s “brain” (i.e., weight matrices) into several independent components using SVD.
Right: We employ RL to train the combination of these components for various tasks. Components may be shared among different tasks. E.g., in the figure above, purple cogs are shared by language understanding and reasoning. At inference time, we identify the task type and then adjust the combination of the components dynamically.
Training with SVF and RL
At training time, SVF learns a set of z-vectors, one for each downstream task. Each z-vector, which can be regarded as an expert on a task, is a compact representation that specifies the desired strength of each component in the weight matrix, acting as a set of “amplifiers” or “dampeners” to modulate the influence of different components on the model’s behavior.
For example, suppose SVD decomposes a weight matrix into five components [A, B, C, D, E]. For a math task, the learned z-vector might be [1, 0.8, 0, 0.3, 0.5], meaning that component A is critical for math while component C hardly affects its performance. For a language understanding task, the z-vector could be [0.1, 0.3, 1, 0.7, 0.5], highlighting that component C is essential for this task despite being less useful for math.
SVF employs RL to learn these z-vectors on a pre-defined set of downstream tasks. The learned z-vectors enable Transformer² to adapt to various new downstream tasks while introducing only a minimal number of additional parameters (i.e., the z-vectors).
Self-Adaptation
At inference time, we devise a two-pass adaptation strategy for our framework that effectively combines the set of task-specific z-vectors. In the first inference pass, given a task or an individual input prompt, Transformer² analyzes its test-time conditions using one of the three adaptation methods below. In the second pass, Transformer² then modulates the weights accordingly by combining the z-vectors, producing a final response most relevant for its new settings.
We summarize the three methods for task detection/adaptation in the following:
-
Prompt-based adaptation. A specifically designed adaptation prompt classifies the task (e.g., math, coding) and selects a pre-trained z-vector.
-
Classifier-based adaptation. A task classifier trained with SVF identifies the task during inference and selects the appropriate z-vector.
-
Few-shot adaptation. Combines multiple pre-trained z-vectors through weighted interpolation. A simple optimization algorithm tunes these weights based on performance on a few-shot evaluation set.
These three methods collectively ensure that Transformer² achieves robust and efficient task adaptation, paving the way for remarkable performance across diverse scenarios. Please refer to our paper for details.
Main Results
We apply our methods to both the Llama and Mistral LLMs across a broad range of tasks, including math (GSM8K, MATH), code (MBPP-Pro, HumanEval), reasoning (ARC-Easy, ARC-Challenge), and visual question answering (TextVQA, OKVQA).
We first set out to obtain the z-vectors by SVF on these tasks, and compare it with LoRA. Our results in the table below show that SVF outperforms LoRA on text-based tasks, with particularly strong gains on GSM8K. This can be attributed to our RL training objective, which does not require “perfect solutions” for each question, unlike LoRA’s fine-tuning approach. The histogram on the right also illustrates SVF’s amazing capacity in the vision domain.
Evaluation of SVF on broad tasks.
We split each task into train, validation, and test sets. We report test set performance using pass@1 for MBPP-Pro and accuracy for all other tasks as evaluation metrics. Left: SVF on language tasks. Normalized scores are in parentheses. Right: SVF on VQA tasks.

We then evaluate our adaptation framework against LoRA on unseen tasks, specifically MATH, HumanEval, and ARC-Challenge. The left table below demonstrates that our strategies achieve increasing performance gains as method complexity increases across all the tasks.
A particularly intriguing finding comes from analyzing how few-shot learning combines different z-vectors to tackle tasks, as shown in the right figure. When solving MATH problems, contrary to expectations, the model does not rely exclusively on its GSM8K (math) specialized z-vectors. This suggests that complex mathematical reasoning benefits from combining mathematical, programmatic, and logical reasoning capabilities. We observe similar unexpected combinations across other tasks and models, highlighting the framework’s ability to synthesize diverse types of expertise for optimal performance.
Evaluation of Transformer².
We directly report the test set performance on the unseen tasks. Left: Self-adaptation on unseen tasks. Right: Learned z-vectors interpolation weights.

Finally, we explored an intriguing question that challenges conventional wisdom in AI development: Can we transfer the knowledge from one model to another? To our excitement, when taking the learned z-vectors from Llama to Mistral, we observe positive effects with the latter showing improved performance on most tasks. See table below for detailed results.
While these findings are promising, we should note that both models share similar architectures, which might explain their compatibility. Whether this knowledge-sharing works between more diverse AI models remains an open question. Still, these results suggest exciting possibilities for opening the doors to disentangling and recycling task-specific skills for newer/larger models.
Cross-model z-vector transfer.
Results from transferring the “experts” trained on Llama3-8B-Instruct to Mistral-7B-Instruct-v0.3 with few-shot adaptation.

The Future: From Static Models to Living Intelligence
Transformer² represents a significant milestone in the evolution of AI systems. Its ability to dynamically adapt to unseen tasks in real-time with enhanced compositionality demonstrates the potential of self-adaptive LLMs to revolutionize AI research and applications alike.
But this is just the beginning. Transformer² offers a glimpse into a future where AI systems are no longer static entities trained for fixed tasks. Instead, they will embody “living intelligence”, models that continually learn, evolve and adapt over time. Imagine an AI capable of seamlessly integrating new knowledge or adapting its behavior in real-world environments without retraining, much like how humans adjust to new challenges.
The path forward lies in building models that dynamically adapt and collaborate with other systems, combining specialized capabilities to solve complex, multi-domain problems. Self-adaptive systems like Transformer² bridge the gap between static AI and living intelligence, paving the way for efficient, personalized, and fully integrated AI tools that drive progress across industries and our daily lives.

Sakana AI
[출처] https://sakana.ai/transformer-squared/
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.

