[Paper Review] LLaMA: Open and Efficient Foundation Language Models

2023. 11. 20. 21:15Paper Review

Abstract

이번 논문에서는 LLaMA(=6B부터 65B까지의 파리미터를 가진 언어 모델 컬렉션)를 소개할 것이다. LLaMA는 공개 데이터셋만으로 만들어진 조 단위의 토큰을 학습하여, SOTA를 달성했다.

특히, LLaMA-13B는 GPT-3 (175B)을 능가했고, LLaMA-65B는 Chinchilla-70B와 PaLM-540B와 비등한 성능을 보였다.

 

더보기
We introduce LLaMA, a collection of foundation language models ranging from 7B to 65B parameters. We train our models on trillions of tokens, and show that it is possible to train state-of-the-art models using publicly available datasets exclusively.
In particular, LLaMA-13B outperforms GPT-3 (175B) on most benchmarks, and LLaMA-65B is competitive with the best models, Chinchilla-70B and PaLM-540B.

1. Introduction

최근 Hoffmann(Chinchilla 논문)은 "한정된 컴퓨팅 자원(=학습 비용)으로 최고 성능을 내기 위해선, 파라미터 개수 증가보다 토큰 개수 증가가 더 중요하다"는 것을 발견했다. 그리고, 한정된 컴퓨터 자원에 따른 최적의 파라미터 개수와 토큰 개수가 무엇인지 알려주었다.

하지만, Hoffmann은 언어 모델을 서빙할 때 중요한 추론 비용을 고려하지 않았다.

 

이번 논문에서는, 목표 성능을 만족하는 최저 학습 비용 모델보다 최저 추론 비용 모델을 목표로 연구를 진행할 것이다.

Hoffmann은 10B 모델을 200B 토큰 개수로 학습시키는 것을 권장했지만, 저자는 7B 모델의 1T토큰 학습 이후에도 꾸준한 성능 향상을 관찰했다. 즉, 기존보다 더 많은 토큰 개수로 성능 향상을 노릴 수 있음을 확인했다. 

목표 성능을 도달하기 위해, 큰 모델을 학습시키는 것이 더 빠를 수 있지만, 최종적으로 오랫동안(=더 많은 토큰 개수로) 학습한 작은 모델이 추론 시에 더 저렴할 것이다.  

 

위 방식으로 만들어진 모델 LLaMA(=6B부터 65B까지의 파리미터를 가진 언어 모델 컬렉션)는 비공개 데이터셋을 사용한 Chincilla, PaLM, GPT-3와 다르게 공개 데이터만 사용했음에도 불구하고, 현존하는 최고 LLMs과 대등한 성능을 가지고 있다.

 

저자는 LLaMA는 단일 GPU에서 실행할 수 있기 때문에,LLM의 접근성과 연구가 보편화될 것이라고 믿는다.

 

더보기
recent work from Hoffmann shows that, for given compute budget, the best performances are not achieved by the largest models, but smaller models trained on more data.
The objective of the scaling laws from Hoffmann is to determine how to best scale the dataset and model sizes for a particular training compute budget. However, this objective disregards the inference budget, which becomes critical when serving a language model at scale.
In this context, given a target level of performance, the perferred model is not the fastest to train but the fastest at inference, and although it may be cheaper to train a large model to reach a certain level of performance, a smaller one trained longer will ultimately be cheaper at inference. For instance, although Hoffmann recommends training a 10B model on 200B tokens, we find that the performance of a 7B model continues to improve even after 1T tokens.
The resulting models, called LLaMA, ranges from 7B to 65B parameters with competitive performance compared to the best existing LLMs.
We believe that this model will help democratize the access and study of LLMs, since it can be run on a single GPU.
Unlike Chinchilla, PaLM, or GPT-3, we only use publicly available data, making our work compatible with open-sourcing, while most existing models rely on data which is either not publicly available or undocumented.

2. Approach

대규모 언어 모델은 대량의 텍스트 데이터셋과 표준 최적화 함수를 이용해 학습을 진행했다.

2.1. Pre-training Dataset

다양한 분야를 학습하기 위해, 다양한 공개 데이터셋으로 학습 데이터셋을 구성했다. 이때, 여러 LLMs이 사용한 공개 데이터셋들 위주로 학습 데이터셋을 구성했다.

 

English CommonCrawl [67%]

2017년부터 2020년까지의 다섯 개 CommonCrawl dump를 CCNet pipeline으로 전처리했다. 전처리 과정은 다음과 같다.

1). 문장 수준의 중복 제거를 수행한다. 2). fastText 분류 모델로 비영어권 언어 페이지를 제거한다. 3). n-gram 언어 모델로 품질 낮은 텍스트를 제거한다. 4). 위키피디아 참조 페이지와 미참조 페이지를 분류하는 모델을 만들어, 미참조로 분류된 페이지를 제거한다.

 

C4 [15%]

전처리된 CommonCrawl 데이터셋이 성능 향상에 많은 도움이 됐기 때문에, C4 데이터셋도 전처리해 사용하기로 결정했다. C4의 전처리도 중복 제거와 언어 분류(비영어권 언어 제거)를 포함한다. CommonCrawl 전처리와 차이점은 저품질 텍스트 분류 방법이다. 구두점 존재, 단어 또는 문장 개수 등 규칙 기반으로 저품질 텍스트를 분류한다.

 

Github [4.5%]

구글 BigQuery에서 수집할 수 있는 GitHub 공개 데이터셋을 수집했다. 전처리 과정은 다음과 같다.

1). 문장 길이, 영숫자 비율 등 규칙 기반으로 저품질 코드 파일을 분류한다. 2). 정규표현식으로 헤더 등 반복 사용 코드를 제거한다. 3). 코드 파일 수준에서 중복 제거를 수행한다.

 

Wikipedia [4.5%]

2022년 6월~8월의 Wikipedia dumps를 수집했다. 이는 20가지의 언어를 포함하고 있다. 하이퍼링크, 주석 그리고 반복 사용 문구 제거 등의 전처리 과정을 거쳤다.

 

Gutenberg and Book3 [4.5%]

2가지 책 데이터셋(Gutenberg Project & Books3)을 사용했다. 90%이상의 내용이 겹치면 중복 제거하는 전처리를 거쳤다.

 

ArXiv [2.5%]

arXiv Latex 파일을 다음과 같이 전처리해 과학 데이터를 학습 데이터셋에 추가했다.

1). 첫번째 절 이전 내용, 참고 문헌 그리고 주석을 모두 제거한다. 2). 논문 간의 일관성을 유지하기 위해, 논문 저자가 만든 용어와 매크로를 인라인으로 확장했다. 즉, 용어를 정의로 직접 대체한다. (인라인 함수)

 

Stack Exchange [2%]

다양한 분야의 QnA 웹사이트(e.g., stackoverflow)를 소유하고 있는 Stack Exchange에서 규모가 가장 큰 28개 QnA 웹사이트에서 QA데이터를 수집했다.

텍스트에서 HTML 테크를 제거하고 답변을 점수순으로 정렬하는 전처리 과정을 거쳤다.

 

Tokenizer

SentencePiece의 BPE 알고리즘으로 토큰화를 진행한 결과, 학습 데이터셋에서 1.4T 토큰 개수가 나왔다.

 

 

2.2. Architecture

LLaMA는 transformer의 기본 구조를 기반으로 하지만,  그 후 여러 LLM 모델(PaLM, GPT-3, GPT-Neo)에서 제안한 개선 사항들을 활용할 것이다.

 

1). Pre-normalization [GPT-3] - 학습 안정성을 향상시키기 위해, 각 레이어의 출력값 대신 입력값을 정규화한다. 이때, RMSNorm을 사용한다.

 

2). SwiGLU activation function [PaLM] - ReLU 대신 SwiGLU를 사용한다.

 

3). RoPE Embeddings [GPTNeo] - 절대적 위치 임베딩 대신 RoPE 임베딩을 사용한다.

2.3. Optimizer

1). AdamW optimizer($\beta_1 = 0.9$, $\beta_2 = 0.95$)를 사용해 LLaMA를 학습시킬 것이다.

 

2). cosine learning rate schedule을 사용해, 최종 학습률이 최대 학습률의 10%가 되도록 조정할 것이다.

 

3). threshold가 1.0인 gradient clipping을 사용할 뿐만 아니라, $\lambda = 0.1$인 weight decay를 사용할 것이다.

 

4). 2k 스탭까지 warm-up을 할 것이며, learning rate와 batch size는 모델 크기에 따라 조정할 것이다.

2.4. Efficient implementation

1). 마스킹된 key/query weight와 score를 저장 및 계산하지 않는 방식으로, causal mutli-head attention을 효율적으로 구현했다. 이로써, 메모리 사용량과 실행 시간을 감소시켰다.

 

2). 역전파 도중 다시 계산될 activation 양을 채크포인트로 줄였다. 자세히 말하자면, 계산 비용이 높은 activation을 주로 저장했다.

 

3). 모델 병렬 기법을 통해, 메모리 사용량을 줄였다. 더 나아가, GPU 간의 통신하는 동시에 activation 계산을 하는 방식을 사용했다.

 

더보기
We train large transformers on a large quantity of textual data using a standard optimizer.
our training dataset is a mixture of serveral sources, that cover a diverse set of domains. For the most part, we reuse data sources that have been leveraged to train other LLMs, with the restriction of only using data that is publicly available.
English CommonCrawl[67%]
We preprocess five CommonCrawl dumps, ranging from 2017 to 2020, with the CCNet pipeline.
This process deduplicates the data at the line level, performs language identification with a fastText linear classifier to remove non-English pages and filters low quality content with an n-gram language model. 
In addition, we trained a linear model to classify pages used as references in Wikipedia v.s. randomly sampled pages, and discarded pages not classified as references.
C4 [15%]
we observed that using diverse pre-processed CommonCrawl datasets improves performance. We thus included the publicly available C4 dataset. The preprocessing of C4 also contains deduplication and language identification steps: the main difference with CCNet is the quality filtering, which mostly relies on heuristics such as presence of punctuation marks or the number of words and sentences in a webpage.
GitHub [4.5%]
We use the public GitHub dataset available on Google BigQuery. 
Additionally, we filtered low quality files with heuristics based on the line length or proportion of alphanumeric characters, and removed boilarplate, such as headers, with regular expresiions. Finally, we deduplicate the resulting dataset at the file level, with exact matches.
Wikipedia [4.5%]
We add Wikipedia dumps from the June-August 2022 period, covering 20 languages 
We process the data to remove hyperlinks, comments and other formatting boilerplate.
Gutenberg and Book3 [4.5%]
We include two book corpora in our training dataset: Gutenberg Project and Book3
We perform deduplication at the book level, removing books with more than 90% content overlap.
ArXiv [2.5%]
We process arXiv Latex files to add scientific data to our dataset.
we removed everything before the first section, as well as the bibliography.
We also removed the comments from the .tex files, and inline-expanded definitions and macros written by users to increase consistency across papers.
Stack Exchange [2%]
We include a dump of Stack Exchange, a website of high quality questions and answers that covers a diverse set of domains, ranging from computer science to chemistry. We kept the data from the 28 largest websites, removed the HTML tags from text and sorted the answers by score.
Tokenizer
We tokenize the data with the byte-pair encoding (BPE) algorithm from Sentence-Piece.
Overall, our entire training dataset contains roughly 1.4T tokens after tokenization.
our network is based on the transformer architecture.
We leverage various improvements that were subsequently proposed, and used in different models such as PaLM.
Pre-normalization [GPT-3]
To improve the training stability, we normalize the input of each transformer sub-layer, instead of normalizing the output. we use RMSnorm normalizing function.
SwiGLU activation function [PaLM]
We replace the ReLU non-linearity by the SwiGLU activation function. we use a dimension of 2/3 4d instead of 4d as in PaLM.
Rotary Embeddings [GPTNeo]
We remove the absolute positional embeddings, and instead, add rotary positional embeddings (RoPE).
Our models are trained using the AdamW optimizer, with the following hyper-parameters: $\beta_1 = 0.9$, $\beta_2 = 0.95$.
We use a cosine learning rate schedule, such that the final learning rate is equal to 10% of the maximal learning rate.
We use a weight decay of 0.1 and gradient clipping of 1.0.
We use 2000 warmup steps, and vary the learning rate and batch size with the size of the model.
we use an efficient implementation of the causal multi-head attention to reduce memory usage and runtime.
This is achieved by not storing the attention weights and not computing the key/query scores that are masked.

To further improve training efficiency, we reduced the amount of activations that are recomputed during the backward pass with checkpointing. More precisely, we save the activations that are expensive to compute.

To fully benefit from this optimization, we need to reduce the memory usage of the model by using model and sequence parallelism. Moreover, we also overlap the computation of activations and the communication between GPUs over the network.

3. Main results

20가지의 벤치마크로 LLaMA의 zero-, few-shot을 평가해볼 것이다.

그리고, LLaMA를 공개되지 않은 LLMs(GPT-3, Gopher, Chinchilla, PaLM)과 비교해볼 것이다. 

 

각 벤치마크는 주관식 혹은 객관식이다. 객관식 형태의 벤치마크는 제공된 선지 중 정답을 찾는 문제다. 모델은 문맥(문제 + 선지)이 주어졌을 때, 가장 확률이 높은 선지를 정답으로 선정한다. 이때, 두 가지 정규화 기법을 사용한다. 1). 선지 길이에 대한 정규화, 2). $P(\text{completion|"Answer: "})$에 대한 정규화 즉, $P(\text{completion|context})/P(\text{completion|"Answer: "})$

3.1. Common Sense Reasoning

8가지 벤치마크(BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC easy & challenge, OpenBookQA)로 추론 성능을 평가했다.

그 결과, 1). LLaMA-65B가 BoolQ를 제외한 모든 벤치마크에서 Chinchilla-70B를 능가했다. 2). 비슷하게 LLaMA-65B가 BoolQ와 WinoGrande를 제외한 모든 벤치마크에서 PaLM-540B를 능가했다. 3). LLaMA-13B가 대부부의 벤치마크에서 GPT-3를 능가했다. 

3.2. Closed-book Question Answering

Natural Questions, TriviaQA로 상식 성능을 평가했다.

그 결과, LLaMA-65B이 두 벤치마크에서 SOTA를 달성했다.

더 중요한 것은, LLaMA-13B가 10배 작은 GPT-3, 5배 작은 Chinchilla와 비슷한 성능을 보였다는 것이다.

3.3. Reading Comprehension

RACE로 독해력을 평가했다. 참고로, RACE는 중국 중고등학생을 위한 독해 시험이다.

그 결과, LLaMA-65B는 PaLM-540B과 대등한 성능을 보였고, LLaMA-13B는 GPT-3보다 높은 성능을 보였다.

3.4. Mathematical reasoning

중고등 수준의 수학 문제로 구성된 MATH와 GSM8k 벤치마크로 수학적 추론 성능을 측정해볼 것이다.

뿐만 아니라, PaLM, Minerva와 성능 비교를 해볼 것이다. 참고로, Minerva는  (ArXiv와 수학 웹페이지에서 추출한) 38.5B 토큰을 사용해 PaLM을 파인튜닝한 모델이다.

참고로, maj1@k 기법으로 사용한 성능 측정도 해볼 것이다. maj1@k은 각 문제에 대해 k개의 후보 답변을 생성한 후, 가장 많이 중복되는 후보 답변을 최종 답변으로 선정하는 기법이다.

 

측정 결과, GSM8k에서 LLaMA-65B는 파인튜닝을 하지 않았음에도 불구하고 Minerva-62B의 성능을 능가했다. 

3.5. Code generation

HumanEval, MBPP 벤치마크로 코드 생성 능력을 평가할 것이다. 두 벤치마크 모두, 프로그램에 대한 간단한 설명과 입출력 예시를 제공하며, 모델은 해당 설명에 부합하고 테스트 케이스를 충족하는 파이썬 코드를 짤 것이다.

 

측정 결과, LLaMA가 LaMDA와 PaLM의 성능을 능가했다. 뿐만 아니라, 두 벤치마크에서 LLaMA-13B이 LaMDA-137B의 성능을 능가했다.

 

참고로, pass@1의 성능을 측정할 때는 temperature 0.1을 사용했고, pass@100과 pass@80의 성능을 측정할 때는 temperature 0.8을 사용했다.

 

코딩 테스크로 LLaMA를 파인튜닝할 시 높은 성능 향상이 기대된다.

3.6. MMLU

MMLU 벤치마크는 인문학, STEM, 사회 과학 등 다양한 분야를 다루는 객관식 문제들로 구성되어 있다.

5-shot으로 평가해본 결과, LLaMA-65B는 대부분의 영역에서 평균적으로 Chinchilla-70B, PaLM-540B에 비해 몇 퍼센트 낮은 점수를 보여줬다.

저는 상대적으로 적은 양의 책과 학술 논문을 학습했기 때문에 낮은 점수가 나왔다고 생각한다.

LLaMA이 학습한 책과 학술 논문은 177GB인 반면, 비교 모델들은 최대 2TB의 책을 학습했다.

3.7. Evolution of performance during training

학습 도중, QA와 상식 벤치마크로 모델 성능을 지속적으로 측정을 했다.

대부분의 벤치마크에서는 꾸준한 성능 향상을 보였고, 성능과 loss값간의 관계가 뚜렷하게 보였다.

예외로, SIQA와 WinoGrande가 있었다. SIQA는 많은 변동성을 보였다. 이는 신뢰할만한 벤치마크가 아님을 시사한다.

WinoGrande는 성능과 loss값 간의 관계가 뚜렷하게 보이지 않았다. 대표적으로 LLaMA-33B와 LLaMA-65B의 성능이 비슷했다.

 

더보기
we consider zero-shot and few-shot tasks, and report results on a total of 20 benchmarks.

We compare LLaMA with other foundation model, namely the non-publicly available language models GPT-3, Gopher, Chinchilla and PaLM.

We evaluate LLaMA on free-form generation tasks and multiple choice tasks. In the multiple choice tasks, the objective is to select the most appropriate completion among a set of given options, based on a provided context. We select the completion with the highest likelihood given the provided context. We follow and use the likelihood normalized by the number of characters in the completion, except for certain dataset (OpenBookQA, BoolQ), and select a completion based on the likelihood normalized by the likelihood of the completion given "Answer:" as context;
We consider eight standard common sense reasoning benchmarks: BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC easy and challenge and OpenBookQA.
LLaMA-65B outperforms Chinchilla-70B on all reported benchmarks but BoolQ. 
Similarly, this model surpasses PaLM-540B everywhere but on BoolQ and WinoGrande.
LLaMA-13B model also outperforms GPT-3 on most benchmarks despite being 10x smaller.
We compared LLaMA to existing large language models on two closed-book question answering benchmarks: Natural Questions and TriviaQA.
LLaMA-65B achieve state-of-the-arts performance in the zero-shot and few-shot settings. More importantly, the LLaMA-13B is also competitive on these benchmarks with GPT-3 and Chinchilla, despite 5-10x smaller.
We evaluate our models on the RACE reading comprehension benchmark. English reading comprehension exams designed for middle and high school Chinese students.
LLaMA-65B is competitive with PaLM-540B, and, LLaMA-13B outperforms GPT-3 by a few percents.
We evaluate our models on two mathematical reasoning benchmarks: MATH and GSM8k.
we compare with PaLM and Minerva. Minerva is a series of PaLM models finetuned on 38.5B tokens extracted from ArXiv and Math Web Pages.
we compare with and without maj1@k. maj1@k denotes evaluations where we generate k samples for each problem and perform a majority voting.
On GSM8k, we observe that LLaMA-65B outperforms Minerva-62B.
We evaluate the ability of our models to write code from a natural language description on two benchmark: HumanEval and MBPP. For both tasks, the model receives a description of the program in a few sentences, as well as a few input-output examples. 
The model needs to generate a Python program that fits the description and satisfies the test cases.
LLaMA outperforms other general models such as LaMDA and PaLM, which are not trained or finetuned specifically for code. LLaMA with 13B parameters and more outperforms LaMDA 137B on both HumanEval and MBPP.
The pass@1 results reported in this table was obtained by sampling with temperature 0.1. The pass@100 and pass@80 metrics were obtained with temperature 0.8.
It is possible to improve the performance on code by finetuning on code-specific tokens.
MMLU consists of multiple choice questions covering various domains of knowledge, including humanities, STEM and social sciences.
We evaluate our models in the 5-shot setting.
On this benchmark, we observe that the LLaMA-65B is behind both Chinchilla-70B and PaLM-540B by a few percent in average, and across most domains. A potential explanation is that we have used a limited amount of books and academic papers in our pre-training data, i.e., ArXiv, Gutenberg and Books3, that sums up to only 177GB, while these models were trained on up to 2TB of books.
During training, we tracked the performance of our models on a few question answering and common sense benchmarks.
On most benchmarks, the performance improves steadily, and correlates with the training perplexity of the model.
The exceptions are SIQA and WinoGrande. Most notably, on SIQA, we observe a lot of variance in performance, that may indicate that this benchmark is not reliable. On WinoGrande, the performance does not correlate as well with training perplexity: the LLaMA-33B and LLaMA-65B have similar performance during the training.

4. Instruction Finetuning

instruction-finetuning을 조금만해도 MMLU의 성능과 지시사항 수행 능력이 향상되었다.

참고로, "Scaling Instruciton-Finetuned Language Models" 논문과 동일한 방식으로 파인튜닝을 진행했다.

비록, 사용한 instruction-finetuning 방식은 간단했지만, LLaMA-I (65B)가 MMLU에서 68.9%의 성능을 보여줘,

instruction-finetuning한 중간 크기의 모델(OPT-IML, FLam-PaLM series)을 모두 능가했다.

더보기
In this section, we show that briefly finetuning on instructions data rapidly leads to improvements on MMLU.
we observe that a very small amount of finetuning improves the performance on MMLU, and further improves the ability of the model to follow instructions. 
we only conducted a single experiment following the same protocol as Scaling Instruction-Finetuned Language Models paper.
Despite the simplicity of the instruction finetuning approach used here, we reach 68.9% on MMLU. LLaMA-I (65B) outperforms on MMLU existing instruction finetuned model of moderate sizes.

5. Bias, Toxicity and Misinformation

LLM은 학습 데이터에 존재하는 편견을 재생성하고 강화하는 경향이 있다. 뿐만 아니라, 유해하고 공격적인 발화도 생성한다.

LLaMA-65B의 잠재적 위험을 파악하기 위해, 다양한 벤치마크로 유해성 발화 생성 및 고정관념 정도를 측정할 것이다.

하지만 안타깝게도, 이때 사용한 벤치마크만으로는 위험성을 완전히 피악할 수 없다.

5.1. RealToxicityPrompts

모델이 생성할 수 있는 유해성 발화는 매우 광범위하기 때문에, 모델의 유해성 정도를 정확히 평가하는 것은 매우 어렵다.

모델의 유해성 정도를 평가해주는 대표적인 벤치마크 RealToxicityPrompt는 100k 프롬프트로 구성되어 있으며, PerspectiveAPI로 각 프롬프트를 기반으로 생성한 텍스트의 유해성 정도를 평가할 것이다.

측정 결과, 유해성 정도는 모델 크기에 비례했다. 특히, Respectful 프롬프트에서 그 경향이 강하게 보였다.

반면, Chinchilla 논문에서는 Chinchilla가 Gopher보다 모델 크기가 작음에도 불구하고 높은 유해성을 보였다.

이는 같은 모델 계열에만 해당 특성(=크기 ∝ 유해성)이 적용된다는 것을 시사한다.

5.2. CrowS-Pairs

crowS-pair는 9가지 관점에서 편향의 정도를 평가해주는 벤치마크다. (성별, 종교, 인종, 성적 취향, 나이, 지역, 장애, 외모, 사회적 위치)

각 예시에는 고정관념 문장과 고정관념과 대조되는 문장로 구성되어 있으며, 각 문장의 perplexity로 고정관념 문장의 선호도를 측정하여, 편향의 정도를 평가하는 방식이다. 즉, 고정관념의 perplexity가 높을수록 점수가 높아지며, 이는 편향 정도가 높은 것을 의미한다.

 

측정 결과, LLaMA는 평균적으로 두 모델(GPT-3, OPT)보다 낮은 평향 정도를 보였다.

5.2. WinoGender

Winogender 벤치마크에서는, 대명사 별 상호참조문제 성능을 측정하여 성별 편견 정도를 판단할 것이다.

궁극적으로는, 직업과 성별 간의 편견이 모델에 얼마나 반영되었는지를 확인하는게 Winogender 벤치마크의 목표이다.

예를 들어, "성별 간의 성능 차이" 혹은 "성별 대명사와 단수 대명사 간의 성능 차이"로 편견 정도를 판단할 수 있다.

 

측정 결과, "their/them/someone" 대명사가 "her/her/she", "his/him/he" 대명사보다 높은 정확도를 보였다.

이전 연구들에도 이와 비슷한 현상을 관측했다. 그리고, 문맥이 아닌 고정관념으로 테스크를 수행한 것으로 추측된다.

위 가설을 확인하기 위해, 고정관념과 대조되는 gotcha 데이터를 사용해봤다.

그 결과, 남여 모두에서 기존 stereotype 데이터보다 더 낮은 성능을 보였다. 즉, 위 가설은 성별과 무관하게 참이다.

5.3. TruthfulQA

TruthfulQA는 모델의 진실성 정도를 측정하기 위해 만들어졌다. 즉, 모델의 hallucinate 현상을 파악하는데 사용되는 벤치마크다.

저자는 Truthful과 Truthful*Inf 두 가지 관점에서 모델을 평가했다. 측정 결과, 두 관점 모두에서 GPT-3보다 높은 점수를 받았지만, 절대적인 점수는 낮은 수준이다. 이는 LLaMA에 "hallucinate"현상이 있음을 시사한다.

 

더보기
Large language models have been showed to reproduce and amplify biases that are existing in the training data, and to generate toxic or offensive content.
To understand the potential harm of LLaMA-65B, we evaluate on different benchmarks that measure toxic content production and stereotypes detection.
These evaluations are not sufficient to fully understand the risks associated with these models.
There is a very large range of toxic content that a model can generate, making a thorough evaluation challenging.
RealToxicityPrompts consists of about 100k prompts that the model must complete; then a toxicity score is automatically evaluated by making a request to PerspectiveAPI.
For each of the 100k prompts, we greedily generate with out models, and measure their toxicity score.
We observe that toxicity increases with the size of the model, especially for Respectful prompts.
the fact that the larger model, Gopher, has worse performance than Chinchilla, suggesting that the relation between toxicity and model size may only apply within a model family.
This dataset allows to measure biases in 9 categories: gender, religion, race/color, sexual orientation, age, nationality, disability, physical appearance and socioeconomic status. Each example is composed of a stereotype and anti-stereotype, we measure the model preference for the stereotypical sentence using the perplexity of both sentences in zero-shot setting. Higher scores thus indicate higher bias.
LLaMA compares slightly favorably to both models on average.
biases are evaluated by determining if a model co-reference resolution performance is impacted by the gender of the pronoun.
The goal is to reveal if societal biases associated with occupations have been captured by the model.
we observe that our model is significantly better at performing co-reference resolutions for the "their/them/someone" pronouns than for the "her/her/she" and "his/him/he" pronouns.
A similar observation was made in previous work, and is likely indicative of gender bias.
the model is probably using the majority gender of the occupation to perform co-reference resolution, instead of using the evidence of the sentence.
we observe that our model, LLaMA-65B, makes more errors on the gotcha examples, clearly showing that it capture societal biases related to gender and occupation.
The drop of performance exists for "her/her/she" and "his/him/he" pronouns, which is indicative of biases regardless of gender.
TruthfulQA aims to measure the truthfulness of a model. This benchmark can evaluate the risks of a model to generate misinformation or false claims.
we report the performance of our models on both questions to measure truthful models and the intersection of truthful and informative.
Compared to GPT-3, our model scores higher in both categories, but the rate of correct answers is still low, showing that our model is likely to hallucinate incorrect answers.

7. Related Work

언어 모델(=language model)은 단어 리스트(=문장)의 확률 분포다. 

다음 토큰을 예측하는 테스크는 오랫동안 자연어 처리의 핵심 문제로 여겨져 왔다.

Alen Turing 이 인공지능의 성능을 측정하기 위해 제안한 Turing Test 때문에, 언어 모델링(=다음 토큰 예측)이 성능 측정 기준이 되었다.

Architecture 

예전에는, 언어 모델은 "n-gram 출현 빈도 통계"를 기반으로 만들어졌으며, "출현 빈도수가 낮은 n-gram" 추정을 개선하기 위한 여러 smoothing 기법들이 제안되었다.

그 후,  FFN, RNN, LSTM을 시작으로 인공신경망이 언어 모델링 테스크를 성공적으로 적용되었다.

가장 최근에는, self-attention을 기반으로한 transformer는 장거리 의존성 소멸 문제를 해결하는 등의 중요한 개선을 가져왔다.

Scaling

Brants (2007)는 2T 토큰과 Stupid Backoff smoothing 기법으로 , 300B n-grams의 언어 모델을 만들었고, 이로 기계번역 성능을 향상시켰다.

Heafield (2013)는 CommonCrawl의 975B 토큰과 Kneser-Ney smoothing 기법으로 500B n-grams 언어 모델을 만들었다.

Chelba (2013)은 One Billion Word 벤치마크를 공개했다. 이는 거대한 학습 데이터로 언어 모델링 테스크를 평가를 위해 만들어졌다.

(모델 구조를 평가하는데 사용된거 같다. "One Billion Word의 학습 데이터로 모델을 학습시켰을 때, 언어 모델링 성능이 얼마나 나오는지 One Billion Word held-out 데이터로 평가"하는 방식인거 같다.)

인공 신경망을 사용한 언어 모델 영역에서는, Jozefowicz (2016)는 1B LSTM으로 Billion Word 벤치마크에서 SOTA를 달성했다.

이후, transformer의 확장(BERT, GPT-2, Megatron-LM, T5) 그 중 특히 175B의 GPT-3가 수 많은 NLP 테스크 성능을 크게 향상시켰다. 이는 LLM 시대를 열었다. (Gopher, Chinchilla, PaLM)

Hestness (2017)과 Rosenfeld (2019)는 인공 신경망 모델 확장이 성능에 미치는 영향에 대해 연구했다. 그 결과, 모델 및 데이터셋 크기와 성능 간의 power-law 관계가 있음을 보였다.

Kaplan (2020)은 transformer 기반 언어 모델의 power-law 관계를 보였으며,이후 Hoffmann (2022)이 토큰 개수와 학습률 조정으로 더욱 정밀하게 개선했다.

Wei (2022)는 LLM의 능력에 대한 스케일링 효과를 연구했다. (여러 능력을 추가할 때 생기는 효과?)

 

더보기
Language models are probability distributions over sequences of words, tokens or characters.
This task, often framed as next token prediction, has long been considered a core problem in natural language processing.
Because Alen Turing proposed to measure machine intelligence by using language through the "imitation game" language modeling has been proposed as a benchmark to measure progress toward artificial intelligence.
Architecture. Traditionally, language models were based on n-gram count statistics, and various smoothing techniques were proposed to improve the estimation of rare events. In past decades, neural networks have been successfully applied to the language modelling task, starting from feed forward models, recurrent neural networks and LSTMs. More recently, transformer networks, based on self-attention, have led to important improvements, especially for capturing long range dependencies.
Scaling 
Brants et al. (2007) showed the benefits of using language models trained on 2 trillion tokens, resulting in 300 billion n-grams, on the quality of machine translation. While this work relied on a simple smoothing technique, called Stupid Backoff.
Heafield et al. (2013) later showed how to scale Kneser-Ney smoothing to Web-scale data. This allowed to train a 5-gram model on 975 billion tokens from CommonCrawl, resulting in a model with 500 billion n-grams.
Chelba et al. (2013) introduced the One Billion Word benchmark, a large scaling training dataset to measure the progress of language models.
In the context of neural language models, Jozefowicz et al. (2016) obtained state-of-the-art results on the Billion Word benchmark by scaling LSTMs to 1 billion parameters. Later, scaling transformers lead to improvement on many NLP tasks. 
A significant breakthrough was obtained with GPT-3, a model with 175 billion parameters. This lead a series of Large Language Models.
Hestness et al. (2017) and Rosenfeld et al. (2019) studied the impact of scaling on the performance of deep learning models, showing the existence of power laws between the model and dataset sizes and performance of the system.
Kaplan et al. (2020) derived power laws specifically for transformer based language models, which were later refined by Hoffmann et al. (2022), by adapting the learning rate schedule when scaling datasets.
Finally, Wei et al. (2022) studied the effect of scaling on abilities of large language models.

8. Conclusion

이번 논문에서는, SOTA LLM과 견줄만한 LLaMA 언어 모델을 발표했다.

놀랍게도, LLaMA-13B는 10x 큰 GPT-3 보다 높은 성능을 보이고, LLaMA-65B는 Chinchilla-70B, PaLM-540B와 비등한 성능을 보인다.

저자는 공개 데이터만으로 SOTA 성능을 달성할 수 있음을 보여줬다. 추가로, instruction-finetuning을 진행하면, 보다 높은 성능 향상을 나타남을 보였다.

더보기
In this paper, we presented a series of language models that are released openly, and completitive with state-of-the-art foundation models.
LLaMA-13B outperforms GPT-3 while being more than 10x smaller, and LLaMA-65B is competitive with Chinchilla-70B and PaLM-540B.
we show that it is possible to achieve state-of-the-art performance by training exclusively on publicly available  data, without resorting to proprietary datasets.
Additionally, we observed that finetuning these models on instructions lead to promising results