Our reply model writes friendly messages. There's no single correct answer, so exact match won't work. And people are slow, and expensive. So, can another model do the grading?
This is called LLM as a judge. We give a strong model a rubric. A rubric is a short set of rules for scoring. Then we show it the customer's message, and the reply. And it returns a score.
Here's a judge, using Qwen. The rubric says, polite and answers the question scores five. Rude, or off topic, scores one. We grade three replies to the same message. Run it. The good reply scores four. The rude one scores one. But the off-topic reply also scores four! This judge is too small, to be trusted.
app.pypython
from transformers import AutoTokenizer, AutoModelForCausalLMJUDGE = "Qwen/Qwen2.5-0.5B-Instruct"tok = AutoTokenizer.from_pretrained(JUDGE)judge = AutoModelForCausalLM.from_pretrained(JUDGE).eval()RUBRIC = ("You grade replies from a bookshop to a customer. Score 1 to 5. " "5 = polite and answers the question. 1 = rude or off-topic. " "Answer with the number only.")def grade(message, reply): task = f"Customer: {message}\nReply: {reply}\nScore:" ids = tok.apply_chat_template([{"role": "system", "content": RUBRIC}, {"role": "user", "content": task}], add_generation_prompt=True, return_dict=True, return_tensors="pt") out = judge.generate(**ids, max_new_tokens=3, do_sample=False) return tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True).strip()msg = "Hi, my copy of Circe still hasn't arrived."for reply in ["Sorry for the wait! Your copy of Circe is on its way.", "Not our problem.", "We sell books, pens and maps."]: print(grade(msg, reply), "|", reply)
Output
4 | Sorry for the wait! Your copy of Circe is on its way.
1 | Not our problem.
4 | We sell books, pens and maps.
So, a few rules. Use the strongest judge you can, usually a large model. Write a clear rubric, with examples. Check the judge against people's scores, on a small sample. And never let a model judge its own answers, because it tends to like them.
Let's recap. LLM as a judge scores open text with a rubric. Small judges make mistakes, like ours did. Use a strong judge, and check it against people. Next, does fine-tuning make a model forget?