chanyong's notepad

In-context Learning 및 관련 논문(수정 예정) 본문

논문 리뷰/Computation and language

In-context Learning 및 관련 논문(수정 예정)

chanyongp 2024. 3. 4. 00:03

0. Background

chatgpt와 같은 딥러닝 모델은 아래와 같은 한계점을 지니고 있습니다.
1. 정보 접근 제한 
2. 토큰 제한 
3. 환각 현상 

 

이들을 해결하기 위해 아래와 같은 학습 기법들이 활용됩니다.
1. Fine-tuning : 기존 딥러닝 모델의 weight를 조정하여 원하는 용도의 모델로 업데이트
2. N-shot learning : 0~n개의 출력 예시를 제시하여 딥러닝이 용도에 알맞은 출력을 하도록 조정
3. In-context learning : 문맥을 제시하고, 이 문맥 기반으로 모델이 출력하도록 조정

1. In-context Learning(ICL)

 

문맥을 제시하고, 이 문맥 기반으로 모델이 출력하도록 조정하는 학습 방법입니다.

zero-shot learning, few-shot learning이라고도 불리며, 이는 모델을 건드리지 않고 프롬프트만을 보강해서 원하는 출력을 얻어내는 깁버이기에 다음과 같이 불립니다. 

cf) 타 학습 방법으로는 weight 자체를 변화시키는 fine-tuning, 출력 예시를 제시하는 N-shot learning이 있습니다.

 

2. Language models secretly preform gradient descent as meta-optimizers

모델을 학습할 때의 역전파 연산에 사용되는 gradient descent와 추론 과정에서의 LLM 내에서의 transformer의 attention layer에서 수행하는 행렬 연산이 수학적으로 서로 닮은 꼴임을 알려줍니다.

즉, 실제 문장을 출력하기 위해 기존에 주어진 prompt를 모델이 입력받아 임베딩하는 과정에서의 행렬 연산이 모델이 training dataset을 통해 weight을 업데이트하는 연산과 유사하다는 것입니다.

즉, 충분한 크기의 LLM은 prompt 입력 시 즉석으로 모델을 학습할 수 있는 능력을 갖춘다는 것입니다.

 

3. A framework for understanding the differences from traditional supervised learning

ICL은 모델이 단어를 뽑아내는 추론을 진행하는 과정에서 bayesian inference를 하게 된다는 해설을 제시합니다.

 

4. Rethinking the role of demonstrations

ICL의 원리와 한계, 특징을 확인하기 위해 다양한 데이터셋으로 연구를 진행한 논문입니다.

연구에서는 ICL을 위한 prompt 상의 예제문을 줄 때 그 예제의 정답 여부가 추론 능력에 영향을 주지 않는다는 점을 제시합니다.

 

제목 그대로 모델이 ICL을 통해 학습하는 방법과 프롬프트의 어떤 측면이 분류 및 객관식 문제와 같은 최종 작업 수행에 기여하는지에 대해 설명합니다. 그리고 입력 및 출력 공간에 대한 정답 여부는 중요하지 않으며, 적절한 출력을 얻기 위해서는 라벨 공간, 입력 텍스트의 분포, 순서의 전체 형식(label space, distribution of input text, and overall format of sequence)과 같은 특징이 중요하다고 말합니다.

 

위 그래프는 적절한 레이블을 사용한 경우와 오답과 같은 임의의 레이블을 사용한 경우의 결과를 보여주고 있습니다. 따라서 입력에 대한 정답 증명이 필요하지 않다는 결론을 내립니다. 

 

다른 그래프에서는 각 측면을 조절하는 실험 결과, 입력 텍스트의 분포, 형식, 레이블 공간에서 측면을 식별하고 입력-라벨 매핑에 가중치를 적게 부여하기 때문에 ICL이 작동한다고 말합니다.

 

또한, 저자들은 ICL은 형식, 레이블 공간, 입력-라벨 매핑 순으로, 즉 쉬운 순서대로 가중치를 갖기 때문에 모델이 입력의 단순한 측면만 활용하고 다른 측면은 무시하도록 유도한다는 가설을 세웁니다.

5. An explanation of In-context Learning as implicit bayesian inference

ICL을 위한 prompt 상의 예제문을 줄 때 어떻게 bayesian inference를 하게 되는지를 수학적으로 분석한 논문입니다. 

중요한 것은 정답 여부보다는, 각 단어가 어떤 의미공간에 속하는지에 관한 패턴을 주는 것입니다.

 

6. Dissecting recall of factual associations in auto-regressive language models

Transformer 기반 LLM에서 어떻게 사실을 추론해나가는지에 관해 분석한 논문입니다.

 

---

7. Few-shot Fine-tuning vs. In-context Learning

few show dataset을 기반으로 finetuning하는 것과 in-context learning을 하는 것을 비교한 논문으로, 결론적으로 둘 다 유사한 일반화 성능을 가지고 있으나 fine-tuning이 일반화에 관해서는 더 나은 성능을 보여줌을 제시합니다.

 

8. Learning To Retrieve Prompts for In-Context Learning

 

References :

https://arca.live/b/alpaca/75432756?target=all&keyword=in-context&p=1

 

In-context Learning 에 대해 알아보자 (Feat. 논문 읽는 tip) - Ai 언어모델 로컬 채널

In-Context Learning (aka. few-shot learning)대형 언어 생성 모델에는 정말 신기한 점이 많다. 처음에 Causal Model, 또는 AutoRegressive 모델이라고 불리는, 이

arca.live

https://arxiv.org/abs/2212.10559

 

Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizers

Large pretrained language models have shown surprising in-context learning (ICL) ability. With a few demonstration input-label pairs, they can predict the label for an unseen input without parameter updates. Despite the great success in performance, its wo

arxiv.org

http://ai.stanford.edu/blog/understanding-incontext/

 

How does in-context learning work? A framework for understanding the differences from traditional supervised learning

The official Stanford AI Lab blog

ai.stanford.edu

https://arxiv.org/abs/2202.12837

 

Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?

Large language models (LMs) are able to in-context learn -- perform a new task via inference alone by conditioning on a few input-label pairs (demonstrations) and making predictions for new inputs. However, there has been little understanding of how the mo

arxiv.org

https://arxiv.org/abs/2111.02080

 

An Explanation of In-context Learning as Implicit Bayesian Inference

Large language models (LMs) such as GPT-3 have the surprising ability to do in-context learning, where the model learns to do a downstream task simply by conditioning on a prompt consisting of input-output examples. The LM learns from these examples withou

arxiv.org

https://arxiv.org/abs/2304.14767

 

Dissecting Recall of Factual Associations in Auto-Regressive Language Models

Transformer-based language models (LMs) are known to capture factual knowledge in their parameters. While previous work looked into where factual associations are stored, only little is known about how they are retrieved internally during inference. We inv

arxiv.org

https://arxiv.org/abs/2305.16938

 

Few-shot Fine-tuning vs. In-context Learning: A Fair Comparison and Evaluation

Few-shot fine-tuning and in-context learning are two alternative strategies for task adaptation of pre-trained language models. Recently, in-context learning has gained popularity over fine-tuning due to its simplicity and improved out-of-domain generaliza

arxiv.org

https://www.semanticscholar.org/paper/Learning-To-Retrieve-Prompts-for-In-Context-Rubin-Herzig/f9838a3be5c94bb2674a0e224de349b50e18f3c4

 

https://www.semanticscholar.org/paper/Learning-To-Retrieve-Prompts-for-In-Context-Rubin-Herzig/f9838a3be5c94bb2674a0e224de349b50e18f3c4

 

www.semanticscholar.org

 

반응형