The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
LexPilot Benchmark
This repository adapts the ARR May evaluation code to the multi-turn consultation histories in the revised LexPilot paper. The benchmark contains 432 cases / 864 consultation histories, covering 36 causes of action. Each case has a complete history and an underspecified history with the same number of messages.
Repository structure
LexPilot_release_multiturn.json: the multi-turn benchmark; replacesLexPilot_release.json.LexAwN_gen.py: generates LexAwN responses, evaluates LCA, and continues underspecified consultations for Interaction-Based LJP.eval_LCA.py: classifies the newly generated responses as direct judgment or clarification.eval_DCG.py: generates and evaluates two rounds of forced detail-completion guidance.eval_LJP_direct.py: predicts from underspecified histories without clarification and extracts claim-level verdicts.eval_LJP_gold.py: generates direct predictions from complete histories and extracts claim-level verdicts.eval_LJP_interaction.py: extracts verdicts from the final LexAwN interaction response.eval_LJP.py: convenience entry point for all three LJP setups: Direct, Gold-Standard, and Interaction-Based.show_results.py: prints per-run and per-cause-class metrics, plus means and sample standard deviations for comparable repeated runs.common.py: shared configuration, history formatting, API adapter, dataset validation, and checked checkpoints.categories.py: the six cause-of-action classes from Appendix D.requirements.txt: runtime dependency; Python 3.10 or later is required.tests/test_pipeline.py: offline regression tests using simulated API responses.
Dataset and history handling
Each case retains case_number, cause_of_action, plaintiff_type,
focal_point, key_details, and result_dict. Both consultation fields are now
ordered arrays of messages, for example:
[
{"role": "user", "content": "Initial case description..."},
{"role": "assistant", "content": "An existing clarification question..."},
{"role": "user", "content": "Additional information..."}
]
Histories alternate user and assistant, start and end with user, and may
contain additional pairs of messages. The code validates this structure and
preserves every message and its order. It renders the complete history as
User: ... / Assistant: ... in the paper's <对话历史>{history}</对话历史>
prompt slot. The API receives this filled prompt as one user message, following
the original prompt-based implementation; the consultation is not converted into
a Python list representation or reduced to its last user message. Saved histories
remain structured message arrays.
Only the User Model and the DCG judge receive hidden key_details; evaluated
models receive the conversation and the task prompt. All focal points and their
corresponding details are retained. Gold verdict values are used only to compute
metrics. The LJP extraction judge receives claim text in result_dict insertion
order and the final model response, without ground-truth verdicts.
Evaluation protocol
The main protocols follow Sections 4–6 and Appendices D–F of the revised paper:
- LCA: generate one new LexAwN response after each complete and underspecified
history. The judge classifies only that response, not earlier assistant turns.
Report
Macro-F1, the unweighted mean of the F1 scores for complete and underspecified consultations, replacing the previous positive-classF1. With underspecified as positive, computeF1_U = 2TP / (2TP + FP + FN)andF1_C = 2TN / (2TN + FP + FN), thenMacro-F1 = (F1_U + F1_C) / 2. Always asking and always answering each score1/3on the paired benchmark. Also reportAcc_CandAcc_U, as in Appendix E. Compute Macro-F1 separately for each run and cause class before averaging runs. Existing LCA labels can be rescored withshow_results.pywithout new API calls. - DCG: independently generate two forced clarification questions, with a
grounded User Model reply between them. The second question sees the original
history plus the first question and reply. Evaluate each new question against
the focal point(s) and key details; a case succeeds if either round is
labeled
是. The denominator includes all underspecified cases. Existing questions in the benchmark history never count as DCG successes. Unlike the old one-round implementation, this uses the paper's forced-clarification prompt for the controlled DCG task, independently of the LCA decision. - Direct LJP: use the underspecified history and the direct-prediction prompt from Appendix F, without clarification or access to hidden facts. Generate a dedicated response and extract its claim-level verdicts.
- Gold-Standard LJP: use the complete history and the same direct-prediction prompt from Appendix F. Generate a dedicated response, without reusing an LCA response.
- Interaction-Based LJP: continue the underspecified history with LexAwN and the Standard User Model for up to three clarification rounds, each followed by a User Model reply. An earlier judgment ends the interaction immediately. If the third assistant response still asks for clarification, obtain the third User Model reply, then apply the same direct-prediction prompt to the accumulated history. This permits at most four new assistant responses: three questions and one final prediction. All pre-existing history turns are outside this budget. Extract verdicts from the final new response only.
Direct, Gold-Standard, and the forced final interaction prediction share
force_judge_prompt in eval_LJP_gold.py, matching Appendix F. All three setups
also share its extract_verdicts function. The prompt uses only currently supplied
facts and does not assert that an underspecified consultation is complete.
LJP reports claim-level Quadratic Weighted Kappa (QWK), with the fixed ordinal
labels 支持 = 0, 部分支持 = 1, 驳回 = 2; accuracy is also printed. If the
expected disagreement is zero, QWK is reported as undefined. All tasks report
overall metrics and metrics for the represented six cause-of-action classes.
The supplied histories are preserved during evaluation.
Setup
Run commands from this directory. Default dataset/output paths are resolved relative to the scripts, so invoking an entry point from another working directory also works.
python -m pip install -r requirements.txt
Set the API endpoint and credentials for your OpenAI-compatible serving provider. PowerShell example:
$env:OPENAI_BASE_URL = "https://YOUR_PROVIDER/v1"
$env:OPENAI_API_KEY = "YOUR_API_KEY"
$env:LEXPILOT_MODEL = "YOUR_EVALUATED_MODEL_ID"
$env:LEXPILOT_USER_MODEL = "YOUR_USER_MODEL_ID"
$env:LEXPILOT_JUDGE_MODEL = "YOUR_JUDGE_MODEL_ID"
On Bash, use export NAME="value" for the same variables. If models are hosted by
different providers, configure role-specific endpoints and keys:
LEXPILOT_EVAL_BASE_URL,LEXPILOT_EVAL_API_KEYLEXPILOT_USER_BASE_URL,LEXPILOT_USER_API_KEYLEXPILOT_JUDGE_BASE_URL,LEXPILOT_JUDGE_API_KEY
Each role falls back to OPENAI_BASE_URL and OPENAI_API_KEY. If no base URL is
set, the API adapter defaults to https://api.openai.com/v1. Credentials are never
written into result files or run manifests.
The default User Model and judge names are DeepSeek-V4.1-Flash and DeepSeek-R1,
following the manuscript. Use the actual model identifiers accepted by your
provider via environment variables or --user-model / --judge-model. No
evaluated model is selected automatically. The provider must support chat
completions with temperature, max_tokens, and n=1.
Default generation/User Model temperature is 0.7; judge temperature is 0.1,
retaining the May implementation's settings. --max-tokens defaults to 8192,
--timeout to 120 seconds, and --retries to 3. Structured judge outputs are
validated and retried up to three times. Empty or truncated generation outputs
are rejected instead of silently scored.
Run an evaluation
With the environment variables above configured:
python LexAwN_gen.py --run-id run1
python eval_DCG.py --run-id run1
python eval_LJP_direct.py --run-id run1
python eval_LJP_gold.py --run-id run1
python eval_LJP_interaction.py --run-id run1
python show_results.py --run-id run1
LexAwN_gen.py already invokes LCA evaluation. eval_LCA.py can rerun that
stage after AwN_gen/.../a1.jsonl exists. eval_LJP.py can replace the three LJP
commands; Interaction-Based LJP still requires LexAwN_gen.py first. DCG, Direct,
and Gold-Standard LJP can run independently of LexAwN generation.
All generation/evaluation entry points accept --model, --user-model,
--judge-model, --dataset, --output-root, --run-id, --limit,
--temperature, --judge-temperature, --max-tokens, --timeout, and
--retries. Run python SCRIPT.py --help for the options. Use the same settings
for every stage of a run. For a small real-API smoke run, pass --limit 2 --run-id smoke to every evaluation command; use a different run ID for the full benchmark.
Each run creates its output directories and writes the following files, where
<model> is a filesystem-safe model name with a short hash:
runs/<run-id>/<model>/manifest.json
AwN_gen/<run-id>/<model>/a1.jsonl
AwN_gen/<run-id>/<model>/interaction.jsonl
Force_ask_gen/<run-id>/<model>/force_ask.jsonl
Force_judge_gen/<run-id>/<model>/a1_direct.jsonl
Force_judge_gen/<run-id>/<model>/a1_force_judge.jsonl
eval_results/<run-id>/<model>/LCA_results.jsonl
eval_results/<run-id>/<model>/DCG_results.jsonl
eval_results/<run-id>/<model>/LJP_direct.jsonl
eval_results/<run-id>/<model>/LJP_gold.jsonl
eval_results/<run-id>/<model>/LJP_interaction.jsonl
Records include case_number, structured input histories, generated responses,
and the relevant round labels or verdicts. interaction.jsonl additionally saves
the full continued history, per-round messages, stop reason, and final response.
DCG_results.jsonl saves both per-round decisions and the any-round success label.
Repeated runs and resuming
The paper reports five independent runs. Use different run IDs so checkpoints are not reused between repetitions. For example, in PowerShell:
1..5 | ForEach-Object {
$runName = "run$_"
foreach ($scriptName in @("LexAwN_gen.py", "eval_DCG.py", "eval_LJP.py")) {
python $scriptName --run-id $runName
if ($LASTEXITCODE -ne 0) { throw "Failed: $scriptName / $runName" }
}
}
python show_results.py
The reporting script computes metrics within each run before averaging. It prints
the number and IDs of available repetitions and sample SD (ddof=1), and groups
only runs with identical dataset, selected cases, code, models, and generation
settings. --model and --run-id filter displayed results.
Rerunning a command with the same run ID resumes completed cases. Checkpoints
validate case IDs, schema, input hashes, and upstream inputs. The run manifest
also checks the dataset hash, code/prompt hash, selected cases, models, endpoints,
and generation settings. Changed experimental settings require a new run ID.
Runs created with the previous two-clarification budget or older prompts must
use a new --run-id with this version; their existing outputs are not overwritten.
An API failure stops the current stage without skipping the case. Completed
cases remain saved; a case interrupted before its record is written is regenerated.
Do not launch concurrent writers for the same model and run ID.
Malformed/truncated JSONL records and incomplete prerequisite stages produce an explicit error instead of being silently ignored. Inspect an interrupted final line before resuming. The results reporter validates task files for completeness and case alignment before computing metrics.
Offline verification
These commands require neither API credentials nor the openai package:
python common.py
python -B -m unittest discover -s tests -v
python show_results.py
Tests cover the released dataset's schema, full-history preservation, model-input isolation, early judgment, the three-clarification budget, DCG success in the second round, independent Direct prediction, all three LJP setups, claim order, malformed judge outputs, case alignment, resuming after failure, per-run aggregation, and the API adapter with a fake client. Tests write to temporary directories.
- Downloads last month
- 884