-# LLMBoost

## Introduction
LLMBoost is a framework crafted to boost the performance of large language models (LLMs) via a novel boosting approach. It enables fine - tuning and evaluation for individual LLM families (such as LLaMA, Qwen) across diverse task types, including arithmetic reasoning, commonsense reasoning, and general LLM tool utilization tasks, and supports the use of multiple instances of the same LLM.

## Environment

### Prerequisites
- Python 3.11.9
- PyTorch
- Transformers
- Other dependencies specified in `requirements.txt`

### Install dependencies
```bash
pip install -r requirements.txt
```

## Usage
Place the dataset into the ./dataset folder

## Runing
### Training(finetune.py)

We provide fine-tuning scripts for two major LLM families:
- **LLaMA**: Use `finetune_llmboost_llama.py` to fine-tune LLMBoost with LLaMA models.
- **Qwen**: Use `finetune_llmboost_qwen.py` to fine-tune LLMBoost with Qwen models.  

These scripts implement our specialized training loop to integrate the boosting mechanism with the base LLM, ensuring effective adaptation while maintaining accuracy comparable to standard Transformer training workflows. Hyperparameters for training (learning rate, batch size, etc.) are configured within the respective scripts.

### Evaluation
Evaluation scripts are organized by task type and LLM family, totaling six files:
- **Arithmetic Reasoning**:
  - LLaMA: `arithmetic_evaluate_llmtools_llama_llmboost.py`
  - Qwen: `arithmetic_evaluate_llmtools_qwen_llmboost.py`
- **Commonsense Reasoning**:
  - LLaMA: `commonsense_evaluate_llmboost_llama.py`
  - Qwen: `commonsense_evaluate_llmboost_qwen.py`
- **LLM Tool Utilization**:
  - LLaMA: `llmtools_evaluate_llmboost_llama.py`
  - Qwen: `llmtools_evaluate_llmboost_qwen.py`  

These scripts extend and adapt the `peft` and `Transformers` libraries to fit LLMBoost's inference and evaluation regime, allowing comprehensive assessment across tasks. Hyperparameters for evaluation (inference settings, metric calculation, etc.) are defined within each script.

### Getting Started
Launch scripts are located in the `script` folder, organized into subfolders by task: `arithmetic`, `commonsense`, and `llmtools`.  

*Example run (arithmetic reasoning with Llama):*
```bash
bash script/arithmetic/arithmetic_llama_llmboost-8b-8b-8b.sh