AI engineering paper · 2023
LLM-as-a-judge
How a strong language model learned to grade chatbot answers about as well as people do, which habits skew it, and what practice has changed since.
You’ll learn to
- Explain how a model can grade two chatbot answers, and the three ways the paper asks it to judge.
- Describe three habits that skew a judge, favouring the first answer, favouring long answers and favouring its own, and the fixes the authors tested.
- Read an agreement score against the score two random voters would get by chance, using the paper’s own tables.
- Compare the paper’s setup with later practice, including how votes become a ranking, length control and checking a judge against human labels.
The idea in short
By 2023, chatbots could hold open conversations, but the usual tests, multiple-choice quizzes with fixed answers, could not tell a helpful chatbot from a poor one. People can, but reading and comparing answers by hand is slow and costly. Zheng and colleagues tried a third route: ask a strong language model, GPT-4, to read two answers to the same question and pick the better one. They call this LLM-as-a-judge.
They checked the judge against people. On the pairs where a person picked a side, GPT-4 agreed with the person 85% of the time, and two people agreed with each other 81% of the time. The judge has habits that need handling: it leans toward whichever answer it sees first, favours long answers and is weak at marking maths. Showing the pair in both orders, and giving the judge a worked solution to compare with, reduce these.
The problem
In 2023, Lianmin Zheng, Wei-Lin Chiang, Ying Sheng and ten co-authors, ending with Joseph Gonzalez and Ion Stoica, published “Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena”. Their problem was how to measure whether a chatbot is any good.
A is a program trained on very large amounts of text that writes text. A chatbot, in this guide, is a language model trained further to follow instructions and hold a conversation. Two training steps matter here. teaches the model from example requests with good answers. then adjusts it using people’s rankings of its answers.
The usual way to compare models is a : a fixed set of tasks with a scoring rule, so every model sits the same test. The best-known one in 2023, MMLU, is a multiple-choice test of knowledge across many school and professional subjects, scored as the percentage of questions answered correctly. Its answers can be marked by a program, which makes it cheap and repeatable.
The authors saw a mismatch. Their own chatbot, Vicuna-13B, was made by training the base model LLaMA-13B on conversations. The “13B” means 13 billion , the numbers a model learns in training, which is a rough measure of its size. Other chat models in this guide are GPT-4 and GPT-3.5 (from OpenAI), Claude-v1 (from Anthropic) and Alpaca-13B (another model built from LLaMA-13B). People strongly preferred Vicuna’s answers. On MMLU, LLaMA-13B scored 47.0 and Vicuna-13B 52.1, a gap of 5.1 points (our arithmetic). Existing tests fell into three groups, and the authors found each lacking for chat:
- Core-knowledge tests, such as MMLU, ask for short answers a program can check. They say little about open conversation.
- Instruction-following tests are somewhat more open-ended, and are used after instruction tuning.
- Conversation tests are closest to chat, but their questions were not hard enough to challenge the newest chatbots.
What people actually prefer is a direct measure of how useful a chatbot is. But asking people to read answers is, in the authors’ words, “exceptionally slow and costly”. A program cannot do it either. Open questions have no single correct answer to match, and scores that count the words an answer shares with a reference answer are ineffective for them.
So the paper asks: can a strong language model stand in for the people? The authors call the idea LLM-as-a-judge: one model reads another model’s output and grades it. Their reason to expect it to work is that models like GPT-4 are themselves trained on human feedback, so they already lean toward human preferences. The paper’s work is to test that, rather than assume it.