Scripts, benchmarks, and other artifacts of the analysis framework
Python
3
147 commits
updated Oct 17, 2026
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 in results/.prompts.py: Defines the English reasoning prompt used by the benchmark.model_configs/: Per-model inference settings.benchmarks/LEET_Arg_Questions_cleaned_and_rationale_by_statement.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.python3 -m venv .venv
source .venv/bin/activate
pip install torch transformers accelerate pyvene transformer-lens pydantic
hf command is included with the Hugging Face Hub package:pip install -U huggingface_hub
hf --help
hf auth login
When 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 torchvision
If 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-Instruct
Public models can be downloaded in the same way. For example:
hf download microsoft/Phi-4-mini-instruct \
--local-dir models/Phi-4-mini-instruct
You 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-Instruct
or use a previously downloaded local directory:
python run_benchmark.py --model models/Llama-3.2-1B-Instruct
For 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:
prompts.py.benchmarks/LEET_Arg_Questions_cleaned_and_rationale_by_statement.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 results/.
Run all questions with Llama 3.2 1B Instruct:
python3 run_benchmark.py
Run only questions whose IDs start with 2021_:
python3 run_benchmark.py --model meta-llama/Llama-3.2-1B-Instruct --year 2021
Results are written to 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 --overwrite
Each 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 readability purposes, storing it directly in the file.
See issue #24 for details on testing, in particular, the comment on the testing procedure.
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.json
The 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.json
Evaluate saved model responses and create the comparison CSV:
python3 results/evaluate_results.py
The 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.
Scripts, benchmarks, and other artifacts of the analysis framework
Python
3
147 commits
updated Oct 17, 2026
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 in results/.prompts.py: Defines the English reasoning prompt used by the benchmark.model_configs/: Per-model inference settings.benchmarks/LEET_Arg_Questions_cleaned_and_rationale_by_statement.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.python3 -m venv .venv
source .venv/bin/activate
pip install torch transformers accelerate pyvene transformer-lens pydantic
hf command is included with the Hugging Face Hub package:pip install -U huggingface_hub
hf --help
hf auth login
When 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 torchvision
If 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-Instruct
Public models can be downloaded in the same way. For example:
hf download microsoft/Phi-4-mini-instruct \
--local-dir models/Phi-4-mini-instruct
You 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-Instruct
or use a previously downloaded local directory:
python run_benchmark.py --model models/Llama-3.2-1B-Instruct
For 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:
prompts.py.benchmarks/LEET_Arg_Questions_cleaned_and_rationale_by_statement.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 results/.
Run all questions with Llama 3.2 1B Instruct:
python3 run_benchmark.py
Run only questions whose IDs start with 2021_:
python3 run_benchmark.py --model meta-llama/Llama-3.2-1B-Instruct --year 2021
Results are written to 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 --overwrite
Each 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 readability purposes, storing it directly in the file.
See issue #24 for details on testing, in particular, the comment on the testing procedure.
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.json
The 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.json
Evaluate saved model responses and create the comparison CSV:
python3 results/evaluate_results.py
The 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.