The nextAI Solution to the NeurIPS 2023 LLM Efficiency Challenge
Organizations: Department of Computer Science and Engineering, UNIST · CJ Corporation
Abstract
The rapid evolution of Large Language Models (LLMs) has significantly impacted the field of natural language processing, but their growing complexity raises concerns about resource usage and transparency. Addressing these challenges, we participated in the NeurIPS LLM Efficiency Challenge, aiming to fine-tune a foundation model within stringent constraints. Our focus was the LLaMa2 70 billion model, optimized on a single A100 40GB GPU within a 24-hour limit. Our methodology hinged on a custom dataset, carefully assembled from diverse open-source resources and benchmark tests, aligned with the challenge's open-source ethos. Our approach leveraged Quantized-Low Rank Adaptation (QLoRA) Fine tuning, integrated with advanced attention mechanisms like Flash Attention 2. We experimented with various configurations of the LoRA technique, optimizing the balance between computational efficiency and model accuracy. Our fine-tuning strategy was underpinned by the creation and iterative testing of multiple dataset compositions, leading to the selection of a version that demonstrated robust performance across diverse tasks and benchmarks. The culmination of our efforts was an efficiently fine-tuned LLaMa2 70B model that operated within the constraints of a single GPU, showcasing not only a significant reduction in resource utilization but also high accuracy across a range of QA benchmarks. Our study serves as a testament to the feasibility of optimizing large-scale models in resource-constrained environments, emphasizing the potential of LLMs in real-world applications.
Figures & tables
| Dataset Name | Task | # Size | License Type |
|---|---|---|---|
| PRM800K: A Process Supervision Dataset [ 21 ] | Math QA | 13k | MIT |
| ScienceQA: Science Question Answering [ 26 ] | Science QA | 1.3k | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 |
| ReClor: A Reading Comprehension Dataset Requiring Logical Reasoning [ 47 ] | Logical reasoning QA | 4.5k | Non-commercial |
| TheoremQA: A Theorem-driven Question Answering Dataset [ 2 ] | STEM QA | 0.5k | MIT |
| tigerbot-kaggle-leetcodesolutions-en-2k [ 40 ] | Coding problem solving | 0.4k | Apache-2.0 |
| ARB: Advanced Reasoning Benchmark for Large Language Models [ 36 ] | STEM QA | 0.7k | MIT |
| Configuration Parameter | Value |
|---|---|
| quantization method | bitsandbytes |
| load in 8bit | False |
| load in 4bit | True |
| llm int8 threshold | 6.0 |
| llm int8 skip modules | None |
| llm int8 enable fp32 cpu offload | False |
| Hyperparameters | Llama2-70B |
|---|---|
| batch size | 4 |
| micro batch size | 1 |
| num epochs | 1 |
| learning rate | 3e-4 |
| cutoff len | 1024 |
| lora r | 4 |
| LoRA r | 4 | 8 | 16 | 64 |
|---|---|---|---|---|
| GPU Usage | 46.49 | 46.95 | 47.43 | 51.27 |
| Train loss | 0.822 | 0.824 | 0.825 | 0.825 |
| LoRA Layer Combination | GPU Usage | Train loss | Time |
|---|---|---|---|
| key+query | 41.39 | 0.830 | 22m 12s |
| all attention layers | 41.57 | 0.801 | 22m 43s |
| all FFN layers | 41.72 | 0.798 | 23m 30s |
| all layers | 42.09 | 0.794 | 24m 4s |
| attention + FFN output layers | 41.46 | 0.798 | 22m 30s |
| Method | QLoRA + Flash Attention 2 | QLoRA Only |
|---|---|---|
| GPU Usage | 46.95 | 68.13 |
| Train loss | 0.824 | 0.820 |
| Time | 19m 18s | 36m 12s |
| Dataset Combination | |
|---|---|
| Version 1 | Filtering Platypus |
| Version 2 | Dolly(100%) + Filtering Platypus + Codegen(10%) + Faithdial(20%) + Multi-News(10%) |
| Version 3 | Dolly(100%) + Filtering Platypus + Codegen(10%) + Faithdial(20%) + Multi-News(10%) |
| Version 4 | Dolly(100%) + Filtering Platypus + Codegen(10%) + Faithdial(40%) + Multi-News(20%) |
| Version 5 | Dolly(100%) + Filtering Platypus + Codegen(10%) + Faithdial(20%) + Multi-News(10%) + Lima(100%) |
| Version 6 | Dolly(100%) + Filtering Platypus + Codegen(10%) + Lima(100%) |
| Model | MMLU | BBQ | TruthfulQA | CNN/DailyMail |
|---|---|---|---|---|
| Version 1 | 0.70 | 0.92 | 0.74 | 0.14, 0.67, 0.42, 0.38, 0.31 |
| Version 2 | 0.71 | 0.92 | 0.76 | 0.16, 0.67, 0.45, 0.67, 0.19 |
| Version 3 | 0.71 | 0.96 | 0.54 | 0.15, 0.67, 0.45, 0.44, 0.15 |
| Version 4 | 0.72 | 0.84 | 0.72 | 0.17, 0.67, 0.45, 0.52, 0.19 |
| Version 5 | 0.73 | 0.90 | 0.76 | 0.17, 0.67, 0.44, 0.42, 0.17 |
| Version 6 | 0.69 | 0.96 | 0.7 | 0.15, 0.56, 0.36, 0.44, 0.22 |
| Model | Dataset | GPU Usage | Trainable Parameter | Training Time |
| LLaMA2 70B | Version 5 | 39.56 | 0.0247% (17M) | 17h |
LLM Fine-Tuning
LLM fine-tuning adapts pretrained large language models to tasks, domains, languages, and behaviors through additional training.
See all 754 papers