This repository evaluates the LEET-Arg benchmark dataset, which contains statement-level legal reasoning questions, expert rationales, model responses, and evaluator scores.
run_benchmark.py: Runs the LEET-Arg questions against a Hugging Face causal language model and stores parsed responses inslm_results/.prompts.py: Defines the English reasoning prompt used by the benchmark.model_configs/: Per-model inference settings.benchmarks/LEET_Arg_Questions_cleaned.json: The current cleaned LEET-Arg question set: 93 questions and 301 statement units.benchmarks/LEET_Arg_Model_Responses.json: Responses and LLM-as-a-Judge evaluations for seven models across the LEET-Arg questions.tools/clean_leet_arg.py: Rebuilds statements for known segmentation issues in a source dataset.tools/validate_leet_arg.py: Validates statement structure, source consistency, punctuation, and suspicious content.docs/: Research notes and evaluation reports.
- Install Python 3.10 or newer and create a virtual environment:
python3 -m venv .venv
source .venv/bin/activate- Install the runtime dependencies:
pip install torch transformers accelerate pyvene transformer-lens pydantic- Install the Hugging Face command-line tools. The
hfcommand is included with the Hugging Face Hub package:
pip install -U huggingface_hub
hf --help- Create or sign in to a Hugging Face account, then authenticate locally:
hf auth loginWhen prompted, paste a Hugging Face access token with permission to read models. Keep the token out of source files and shell history where possible.
The repository supports Linux and macOS. Use the activation command appropriate for your shell, for example source .venv/bin/activate.fish for Fish.
This benchmark uses text-only models. If Transformers reports Could not import module 'LlamaConfig' and the traceback ends with torchvision::nms, remove the unused incompatible vision package from the active environment:
pip uninstall -y torchvisionIf you want to clean up models in your disk since we are testing one model at a time, use the hf CLI. For listing all saved models in the cache, use hf cache list and hf rm <model> to remove any of them.
The default model is meta-llama/Llama-3.2-1B-Instruct. It is gated, so first visit the model page, accept its license, and wait for access to be approved. Then download it into a local directory:
hf download meta-llama/Llama-3.2-1B-Instruct \
--local-dir models/Llama-3.2-1B-InstructPublic models can be downloaded in the same way. For example:
hf download microsoft/Phi-4-mini-instruct \
--local-dir models/Phi-4-mini-instructYou can either let Transformers download and cache a model automatically by passing its Hugging Face ID:
python run_benchmark.py --model meta-llama/Llama-3.2-1B-Instructor use a previously downloaded local directory:
python run_benchmark.py --model models/Llama-3.2-1B-InstructFor local directories, the model configuration lookup falls back to the default Llama settings unless a matching entry exists in model_configs/. Copy and adapt an existing file there if the model requires different dtype, trust, seed, or generation settings. Model downloads can be several gigabytes, so ensure sufficient disk space and use a GPU or other supported accelerator when available.
For each benchmark question, the model receives only:
- The base system prompt defined in
prompts.py. - The individual LEET-Arg question from
benchmarks/LEET_Arg_Questions_cleaned.json.
The model is not given the dataset answer, the expert rationale, other model
responses, or demonstrations from other questions. The generated response is
parsed for its answer and saved with the question in slm_results/.
Run all questions with Llama 3.2 1B Instruct:
python3 run_benchmark.pyRun only questions whose IDs start with 2021_:
python3 run_benchmark.py --model meta-llama/Llama-3.2-1B-Instruct --year 2021Results are written to slm_results/<model-signature>.json. Existing results are retained and new responses are appended by default. Use --overwrite to clear that model's result file before running:
python3 run_benchmark.py --model microsoft/Phi-4-mini-instruct --year 2021 --overwriteEach stored record retains the source question and includes model_answer and model_rationale, parsed from the model's Answer-<choice>. response. The output terminal will not display the rationale for readibility purposes, storing it directly in the file.
The cleaned question file contains 93 questions from 2021-2025 and 301 statement-level tasks. The response file contains entries for the same question IDs and includes these models:
claude_opus4, claude_sonnet4, deepseek_r1, gemini-2.5-pro, o3, o3-pro, and o4-mini.
Validate the current cleaned dataset:
python tools/validate_leet_arg.py \
--input benchmarks/LEET_Arg_Questions_cleaned.jsonThe validator checks sequential statement keys, missing statements, suspiciously short or leaked instruction text, punctuation, and relaxed source consistency. The source-cleaning utility is intended for rebuilding a cleaned file from an original dataset:
python tools/clean_leet_arg.py \
--input path/to/LEET_Arg_Questions.json \
--output benchmarks/LEET_Arg_Questions_cleaned.jsonEvaluate saved model responses and create the comparison CSV:
python3 slm_results/evaluate_results.pyThe LEET-Arg files contain model-generated answers and evaluator judgments, which should be treated as benchmark data rather than verified legal advice. Model availability, hardware, Hugging Face permissions, and model-specific settings can affect reproducibility.
See docs/ for LEET-Arg research context and evaluation notes.