AI grading that checks its own legal citations
How we built AI grading for Lexopo's practice cases: a rubric written with experts, tests against graded answers, and every legal citation checked.
By Ernesto Martínez, Founder, eMarDevPublished Updated 3 min read
Lexopo helps candidates prepare for Spain’s public-sector exams, the oposiciones. A big part of those exams is written: practice cases and essay topics where a candidate has to apply the law to a situation and cite it correctly. Getting feedback on that kind of answer has always been slow and expensive, because it needs an expert to read every one.
AI looked like the obvious fix. It is, with one problem: general-purpose models invent legal references. They cite articles that don’t exist, mix up laws, or quote a version that was repealed years ago. For an exam candidate, a confident wrong citation is worse than no feedback at all, because they’ll memorize it.
Here’s the approach behind Lexopo’s grading, and what we’d tell anyone adding AI grading to their own product.
Start from the rubric, not the model
Lexopo grades every answer against a rubric, and that’s the first thing to get right. Write it with people who prepare candidates for the exam: what a strong answer contains, which legal bases it should cite, how points are awarded and what loses them.
The rubric is what makes grading consistent. Without one, a model grades the way it happens to feel that day. With one, every answer is measured against the same criteria, and the feedback can point to exactly what was missing.
Grade against the rubric, and explain every point
A score on its own doesn’t teach much. Good feedback goes through the rubric criterion by criterion: what the answer did well, what it missed and which part of the law applies. That turns a grade into something a candidate can study from.
It also makes a grader easier to check. When a score looks wrong, you can see which criterion it came from and fix the rubric or the instructions, instead of guessing.
Never show a citation nobody has checked
This is the part that matters most. In Lexopo, every legal citation in a grade is checked against the consolidated text of the BOE, Spain’s official gazette, before the candidate sees it.
The idea is simple: the model is good at reading an answer and explaining it, but it is not a source of law. The official text is. So the system treats every reference the model produces as a claim to verify, not a fact to display. A candidate should never study from a citation that doesn’t exist.
The laws themselves change, too. Lexopo alerts candidates when a law they’re studying changes, and the grading has to keep up with the same updates.
Test against answers experts have already graded
You can’t tell whether an AI grader works by reading a few of its outputs. You need a set of real answers that experts have already graded, and you need to run the grader against all of them every time you change the rubric, the instructions or the model.
That test set is the most valuable thing in the project. It’s what lets you upgrade a model or tweak a prompt without wondering what you broke.
What we’d tell anyone adding AI grading
- Keep the task narrow. “Grade this answer against this rubric” works. “Be a tutor” doesn’t, at least not reliably.
- Ground it in sources. If your domain has an authoritative text, check against it. If it doesn’t, make the AI show where each claim comes from.
- Build the test set before you launch. And keep adding to it every time a user reports a bad grade.
- Plan for running costs. Every grade is a request to a model. Limits per plan keep the bill predictable.
- Be clear with users. Say what the AI grades, what it checks, and how to report a mistake.
Where this applies beyond exam prep
The same pattern works anywhere AI has to be right rather than just fluent: checking contracts against a template, reviewing forms against regulations, answering support questions from your own documentation. If you’re thinking about something similar, our AI integration page explains how we work, and the exam prep platform cost guide shows what a product like Lexopo takes to build.