# PandaLM: An Automatic Evaluation Benchmark for LLM Instruction Tuning Optimization

Yidong Wang, Zhuohao Yu, Zhengran Zeng, Linyi Yang, Cunxiang Wang, Hao Chen and 7 more · arXiv · 2023-6-8

- **Problem** Choosing instruction-tuning hyperparameters requires a way to rank the tuned models, but human and API-based judging are costly, hard to reproduce, and blind to subjective quality.
- **Method** Trains a LLaMA-based judge on GPT-3.5 verdicts that are filtered for order consistency, then uses that judge to search 80 hyperparameter configurations per model.
- **Results** With GPT-4 as the judge, five models tuned with PandaLM-selected settings average 47.0 superior and 26.2 inferior responses against their Alpaca-tuned counterparts on 170 instructions.

![Figure 6: The prompt for training PandaLM](https://refivu.com/papers/2832dfcd-bd57-482f-9d55-f5bae8d2c8d2/figures/figure-8ed2bfbe107ed0e82aa7a9a74ff24f52.png?thumb=512)

**Figure 6** : The prompt for training PandaLM.

[Original paper](https://arxiv.org/abs/2306.05087v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Yidong Wang, Zhuohao Yu, Zhengran Zeng, Linyi Yang, Cunxiang Wang, Hao Chen, Chaoya Jiang, Rui Xie, Jindong Wang, Xing Xie, Wei Ye, Shikun Zhang, Yue Zhang · PandaLM: An Automatic Evaluation Benchmark for LLM Instruction Tuning Optimization · Original paper figure · Extracted the figure area from page 16 of the original PDF.

## Why tuning settings are hard to rank

Instruction tuning is run as a loop: a foundation model is tuned, its results are evaluated, and the tuning is repeated with other settings until a good one is found. Each pass pays a training cost and an evaluation cost, so the evaluation step decides how many passes are affordable.

Most follow-up work on instruction-tuned models copied Alpaca's hyperparameters instead of searching over them, even though optimizer, learning rate, epoch count and data quality all change the result. Human annotation is slow and subjective, while API-based judges add cost and a risk of data leakage, so both make repeated ranking hard.

Accuracy and F1 on fixed-answer labels say little about qualities such as conciseness, clarity or adherence to instructions. Similarity metrics such as BERTScore and MAUVE measure closeness to a reference text, so they do not directly tell which of two responses is better.

The authors therefore train a judge that takes two responses to the same context, picks the better one, and can give a rationale based on a reference response. Because the judge runs on open-source weights, the evaluation does not depend on an external API.

## Building judge training data from distilled verdicts

Each training instance pairs an input tuple of instruction, input, response 1 and response 2 with an output tuple of verdict, reason and reference response. The instructions are sampled from the Alpaca 52K dataset, and the responses come from five similarly sized models, LLaMA-7B, Bloom-7B, Cerebras-GPT-6.7B, OPT-7B and Pythia-6.9B, each tuned with Alpaca's data and hyperparameters.

Human labels at this scale would be impractical, so GPT-3.5 produces the verdicts and reasons through a self-instruct style procedure, on the premise that it judges models reasonably well. The verdict is '1', '2' or 'Tie', and the prompts are written to push the judge toward correctness and subjective qualities alike.

GPT-3.5 shows position bias, so each sample is judged again with the two responses swapped, and samples whose verdict changes are removed. Invalid GPT-3.5 outputs are also dropped with hand-written rules, which leaves a filtered training set of 300K samples.

## Training PandaLM as a text-output judge

PandaLM starts from LLaMA and is trained with a cross-entropy loss on next-token prediction, so the verdict is generated as text and no separate classification head is added. Training uses DeepSpeed with ZeRO stage 2 on 8 NVIDIA A100-SXM4-80GB GPUs, with BF16 precision to improve speed and efficiency.

The optimizer is AdamW with a learning rate of 2e-5 and a cosine scheduler, trained for 2 epochs with a warmup ratio of 0.03. Each GPU takes a batch of 2, inputs are truncated to 1024 tokens, and gradients accumulate over 8 steps.

## A human-labelled test set for checking the judges

Each test instance holds one instruction and input and two responses from the five candidate models, all tuned with Alpaca's data and hyperparameters. Three human evaluators label each instance independently, and samples with large disagreement are removed so that each annotator's Inter Annotator Agreement stays above 0.85.

The instructions are drawn from self-instruct's human evaluation data, and the filtering leaves 1K samples from an original 2.5K. Three experts from an annotation company label each point at the same time, and they have no prior relationship with the authors. Samples that demand knowledge that is hard for annotators to obtain were excluded.

Agreement among the three annotators, measured with Cohen's Kappa, averages 0.85, 0.86 and 0.88 for the three of them. The authors use 0.85 as the reference level against which a model's agreement with humans is judged, and they set a target of around 0.90. The final test set contains 105 ties, 422 instances where Response 1 wins and 472 where Response 2 wins.

## Searching the tuning space with PandaLM-7B

Alpaca's protocol trains for three epochs with AdamW at 2e-5 and a cosine scheduler, and uses the final checkpoint. The search widens this to checkpoints from epoch 1 to epoch 5, learning rates of 2e-6, 1e-5, 2e-5 and 2e-4, SGD or AdamW, and cosine or linear schedules, which gives 80 configurations per model.

The 80 configurations form four blocks of 20, and sequential comparisons pick a winner inside each block before the block winners are compared with one another. Each comparison is repeated twice, giving 800 comparisons in total, and conflicting verdicts are changed to 'Tie'. PandaLM-7B serves as the judge for this search because of compute constraints.

The selected settings differ by base model: Bloom-7B with SGD, 2e-5 and a cosine schedule over 5 epochs; Cerebras-GPT-6.7B with SGD, 2e-5 and a linear schedule; LLaMA-7B with AdamW, 1e-5 and a linear schedule over 4 epochs. OPT-6.7B selects AdamW, 2e-5 and a linear schedule over 5 epochs, and Pythia-6.9B selects SGD, 1e-5, a cosine schedule and 5 epochs.

The authors conclude that tuning should be customized per model, since one setting does not fit all base models.

## How closely the judges match human labels

Against the human labels, Accuracy is 0.6687 for PandaLM-70B, 0.6647 for GPT-4, 0.6296 for GPT-3.5, 0.6186 for PandaLM-70B-LoRA and 0.5926 for PandaLM-7B. PandaLM-70B is therefore only slightly above GPT-4 on this measure, and PandaLM-7B is lower than the two larger judges.

For GPT-3.5, GPT-4 and PandaLM, each pair of responses is judged in both orders, and results that conflict between the two orders are revised to Tie.

Table 1 lists the win, lose and tie counts of each base model pair under human, GPT-3.5, GPT-4 and PandaLM-7B judging. The authors observe a similar partial order over the five models across these judges, which they take as evidence that PandaLM-7B follows the same preferences.

## Models tuned with PandaLM-selected settings

The comparison uses 170 instructions from the 1K test set, and five open models tuned with PandaLM-selected settings are set against their Alpaca-tuned versions on the same training data. The judges are GPT-3.5, GPT-4 and human experts, and PandaLM itself is not the judge in these comparisons.

Judged by GPT-4, the five PandaLM-tuned models average 47.0 superior responses and 26.2 inferior responses. Human judges give an average of 79.8 superior and 25.2 inferior responses on the same 170 instructions. Figure 1 omits Tie cases from these counts.

The authors state that all base models do better with PandaLM's selected settings under GPT-3.5, GPT-4 and human judging.

## Transfer to LSAT, PubMedQA and BioASQ

The legal domain is covered by LSAT and the biomedical domain by PubMedQA and BioASQ, with responses from Vicuna and Alpaca. GPT-4 supplies the gold win, tie or lose labels because of time constraints, so these scores measure agreement with GPT-4 rather than with human annotators.

The task has three classes, so a random guess would give about 33% precision, recall and F1. Accuracy is 0.4717 on LSAT for PandaLM-7B and 0.6604 for PandaLM-70B, 0.6154 and 0.7692 on PubMedQA, and 0.5152 and 0.7727 on BioASQ.

On BioASQ, a human check on 30 samples found that PandaLM-7B and GPT-4 both favoured Vicuna over Alpaca.

## Effect of evaluation reasons and reference responses

A variant is trained only on win, tie and lose labels, which resembles a numerical reward model, and is compared with the full PandaLM-7B that also learns reasons and reference responses.

Accuracy falls from 0.5926 to 0.4725 and precision from 0.5728 to 0.4505 without reasons and references. F1 drops from 0.5456 to 0.3152 in the same comparison. The authors attribute the gap to reasons and reference responses helping the model understand the evaluation task.

The comparison covers PandaLM-7B only, so the effect at other model sizes is not shown here.

## Traditional benchmarks with lm-eval

lm-eval runs fine-tuned models across many traditional evaluation tasks, and Table 6 in the appendix reports these results for the tuned models.

Most models improve after PandaLM-selected fine-tuning, while Cerebras drops. The authors argue that this shows the value of subjective evaluation, since human, GPT-4 and GPT-3.5 judges all rate the PandaLM-tuned Cerebras higher.

## Limits of the search, labels and scope

The hyperparameter range follows common practice and prior literature, so it may miss the best settings, and widening it would raise the computational cost. The comparisons use 170 instructions, and the judge used for the search is PandaLM-7B.

The core training data is distilled from GPT-3.5, so it may not fully match human preferences, and the authors note that model architecture and instructions also shape results.

The authors focus on outcome-based evaluation, which is resource-intensive, and propose behaviour prediction through rational analysis as a possible direction that is not tested here. Only supervised training is studied, and imbalanced, unlabeled or noisy data are left as future work.

## Paper info

- **Authors**: Yidong Wang, Zhuohao Yu, Zhengran Zeng, Linyi Yang, Cunxiang Wang, Hao Chen, Chaoya Jiang, Rui Xie, Jindong Wang, Xing Xie, Wei Ye, Shikun Zhang, Yue Zhang
- **Venue**: arXiv · Preprint
- **First published**: 2023-6-8
- **Added**: 2026-11-5
- **Updated**: 2024-5-24
- **Version**: v2
- **arXiv**: 2306.05087
- **Category**: cs.CL · cs.AI
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2306.05087v2) · [PDF ↗](https://arxiv.org/pdf/2306.05087v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Instruction tuning large language models (LLMs) remains a challenging task, owing to the complexity of hyperparameter selection and the difficulty involved in evaluating the tuned models. To determine the optimal hyperparameters, an automatic, robust, and reliable evaluation benchmark is essential. However, establishing such a benchmark is not a trivial task due to the challenges associated with evaluation accuracy and privacy protection. In response to these challenges, we introduce a judge large language model, named PandaLM, which is trained to distinguish the superior model given several LLMs. PandaLM's focus extends beyond just the objective correctness of responses, which is the main focus of traditional evaluation datasets. It addresses vital subjective factors such as relative conciseness, clarity, adherence to instructions, comprehensiveness, and formality. To ensure the reliability of PandaLM, we collect a diverse human-annotated test dataset, where all contexts are generated by humans and labels are aligned with human preferences. Our results indicate that PandaLM-7B achieves 93.75% of GPT-3.5's evaluation ability and 88.28% of GPT-4's in terms of F1-score on our test dataset. PandaLM enables the evaluation of LLM to be fairer but with less cost, evidenced by significant improvements achieved by models tuned through PandaLM compared to their counterparts trained with default Alpaca's hyperparameters. In addition, PandaLM does not depend on API-based evaluations, thus avoiding potential data leakage. All resources of PandaLM are released at https://github.com/WeOpenML/PandaLM.

## Quote from the paper

Yidong Wang, Zhuohao Yu, Zhengran Zeng, Linyi Yang, Cunxiang Wang, Hao Chen, Chaoya Jiang, Rui Xie, Jindong Wang, Xing Xie, Wei Ye, Shikun Zhang, Yue Zhang (2023). PandaLM: An Automatic Evaluation Benchmark for LLM Instruction Tuning Optimization. arXiv:2306.05087v2. https://arxiv.org/abs/2306.05087v2

**BibTeX**

```
@misc{wang2023pandalm,
  title = {{PandaLM: An Automatic Evaluation Benchmark for LLM Instruction Tuning Optimization}},
  author = {Yidong Wang and Zhuohao Yu and Zhengran Zeng and Linyi Yang and Cunxiang Wang and Hao Chen and Chaoya Jiang and Rui Xie and Jindong Wang and Xing Xie and Wei Ye and Shikun Zhang and Yue Zhang},
  year = {2023},
  eprint = {2306.05087},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.05087v2}
}
```

## Other paper commentary

- [Self-Distilled Reasoner: On-Policy Self-Distillation for Large Language Models](https://refivu.com/en/papers/733bb47f-1989-4658-a978-6131bad900ad-self-distilled-reasoner-on-policy-self-distillation-for.md)
- [CAMR: Compatibility-Aware Memory Replay for Continual Learning in Large Language Models](https://refivu.com/en/papers/24445413-cb2e-4d23-a34a-5020794de1e7-camr-compatibility-aware-memory-replay-for-continual.md)
- [PaLM-E: An Embodied Multimodal Language Model](https://refivu.com/en/papers/c14507e3-43e7-434d-adc8-94f0d2c42b5f-palm-e-an-embodied-multimodal-language-model.md)
- [Large Language Models are Zero-Shot Reasoners](https://refivu.com/en/papers/6b8a675c-a686-4e78-8256-301472d5cac2-large-language-models-are-zero-shot-reasoners.md)
- [Generative Agents: Interactive Simulacra of Human Behavior](https://refivu.com/en/papers/3638efc4-db4a-48d9-bc16-5a758d9198fd-generative-agents-interactive-simulacra-of-human-behavior.md)
- [SWE-bench: Can Language Models Resolve Real-World GitHub Issues?](https://refivu.com/en/papers/1cf41e87-39dc-4e23-9d0c-22ab7bc2a24b-swe-bench-can-language-models-resolve-real-world.md)
- [Chain-of-Thought Reasoning Without Prompting](https://refivu.com/en/papers/177d9294-679d-436b-897e-3ec239de41b5-chain-of-thought-reasoning-without-prompting.md)
- [Robotic Control via Embodied Chain-of-Thought Reasoning](https://refivu.com/en/papers/e0916502-601d-428e-90b1-cb59f1252a20-robotic-control-via-embodied-chain-of-thought-reasoning.md)
- [Neural Articulated Radiance Field](https://refivu.com/en/papers/aa604c2f-5450-4fe1-b81c-ff26130ee0b1-neural-articulated-radiance-field.md)
- [MERF: Memory-Efficient Radiance Fields for Real-time View Synthesis in Unbounded Scenes](https://refivu.com/en/papers/b88df5f3-e59a-4fcd-9cfd-d031cf876738-merf-memory-efficient-radiance-fields-for-real-time.md)
- [BARF: Bundle-Adjusting Neural Radiance Fields](https://refivu.com/en/papers/ba143c7e-fe7b-41ec-83ca-c3ecd797e3e8-barf-bundle-adjusting-neural-radiance-fields.md)
- [Robust Dynamic Radiance Fields](https://refivu.com/en/papers/d8eb0f83-33ad-41d7-bc4b-6fc44f723dd8-robust-dynamic-radiance-fields.md)

## Terms in this paper

- [Accuracy](https://refivu.com/en/terms/1995c0cd6282-accuracy)
- [GPT-4](https://refivu.com/en/terms/1e2d0d2cdc44-gpt-4)
- [cross-entropy loss](https://refivu.com/en/terms/14067bdf8b9f-cross-entropy-loss)
- [SGD](https://refivu.com/en/terms/96a2d83e44ca-sgd)
- [GPT-3.5](https://refivu.com/en/terms/30414fb33dba-gpt-3-5)
- [instruction tuning](https://refivu.com/en/terms/0a2a2d11f238-instruction-tuning)
- [Alpaca](https://refivu.com/en/terms/acd615a4ec0a-alpaca)
- [Hyperparameter optimization](https://refivu.com/en/terms/76e40b84635b-hyperparameter-optimization)
- [Cohen's Kappa](https://refivu.com/en/terms/d92996ffadce-cohen-s-kappa)
- [self-instruct](https://refivu.com/en/terms/599304dadef6-self-instruct)
- [Cohen’s Kappa](https://refivu.com/en/terms/25228dabdda8-cohen-s-kappa)
- [position bias](https://refivu.com/en/terms/a70d2454f5a2-position-bias)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/2832dfcd-bd57-482f-9d55-f5bae8d2c8d2-pandalm-an-automatic-evaluation-benchmark-for-llm)
