Aiedu is a research codebase for medical education model training and evaluation.
The public repository contains code only. Datasets, model weights, generated outputs, experiment results, local resources, and private data extraction scripts are intentionally excluded.
The typical workflow is:
compare_experiments.py.aggregate_anchor_compare.py.The main training workflow uses the VERL-related environment:
pip install -r requirements_verl.txt
requirements_gpu.txt is kept as a fallback dependency file for GPU-only utilities or evaluation workflows.
The DPO module has separate dependency files:
pip install -r dpo/requirements_gpu.txt
For NPU environments:
pip install -r dpo/requirements_npu.txt
DPO training expects a JSONL file with one preference pair per line:
{
"prompt": "instruction or context",
"chosen": "preferred answer",
"rejected": "less preferred answer",
"meta": {
"sample_id": "optional-id",
"question_type": "optional-task-type"
}
}
The dataset path is supplied at runtime and is not part of this repository.
The DPO entry point is dpo/main.py.
python dpo/main.py \
--dataset <path-to-dpo-pairs.jsonl> \
--model-name <base-model-or-local-path> \
--output-dir <output-model-dir>
Common options:
python dpo/main.py \
--dataset <path-to-dpo-pairs.jsonl> \
--model-name <base-model-or-local-path> \
--output-dir <output-model-dir> \
--num-epochs 1 \
--batch-size 1 \
--gradient-accumulation-steps 8 \
--learning-rate 5e-6 \
--beta 0.1 \
--max-length 4096 \
--max-prompt-length 3072
By default, training uses LoRA. Use full fine-tuning when needed:
--full-finetune
Enable QLoRA on supported CUDA environments:
--use-qlora
Use generate_output.py to generate outputs for the evaluation tasks.
python generate_output.py \
--backend vllm \
--data-dir <case-input-dir> \
--base-model-path <base-model-path> \
--model-path <candidate-adapter-or-model-dir> \
--output-dir <candidate-output-dir> \
--tasks 1,2,3,4
Generate base model outputs separately:
python generate_output.py \
--backend vllm \
--data-dir <case-input-dir> \
--base-model-path <base-model-path> \
--use-base-model \
--output-dir <base-output-dir> \
--tasks 1,2,3,4
Task IDs:
1: medical record standardization2: question generation3: clinical reasoning4: comprehensive scoringThe comparison scripts expect one output directory per model under a shared result root:
<result-root>/
<base-model-name>/
<candidate-model-a>/
<candidate-model-b>/
compare_experiments.py runs LLM Judge comparisons and writes task-level rankings, significance files, checkpoints, and plots.
Recommended evaluation design:
Example:
python compare_experiments.py \
--results-dir <result-root> \
--select picked \
--tasks auto \
--anchor-models <base-model-name> \
--judge-backend api \
--judge-model <judge-model-name> \
--judge-api-base <openai-compatible-api-base> \
--output-dir <pairwise-run-output-dir>
During interactive model selection, choose exactly:
<base-model-name>
<candidate-model-name>
Each pairwise run produces files such as:
<pairwise-run-output-dir>/
checkpoints/
_meta.json
<task>_checkpoint.csv
judge_stats/
<task>_ranking.csv
<task>_significance.csv
Repeat this process for every candidate model.
aggregate_anchor_compare.py aggregates multiple candidate-vs-base comparison runs into a single Anchor Score report.
python aggregate_anchor_compare.py \
--input-dir <pairwise-runs-root> \
--output-dir <aggregate-output-dir> \
--anchor-model <base-model-name> \
--order-task <task-name> \
--bootstrap 10000
Aggregation logic:
--input-dir.checkpoints/_meta.json.checkpoints/<task>_checkpoint.csv.Typical aggregate output:
<aggregate-output-dir>/
<judge-name>/
all_tasks_anchor_summary.csv
manifest.csv
<task>_anchor_ranking.csv
judge_stats/
The following are intentionally excluded from version control:
This keeps the public repository focused on reusable training, generation, comparison, and aggregation code.
3 commits
Python
100.0%
Aiedu is a research codebase for medical education model training and evaluation.
The public repository contains code only. Datasets, model weights, generated outputs, experiment results, local resources, and private data extraction scripts are intentionally excluded.
The typical workflow is:
compare_experiments.py.aggregate_anchor_compare.py.The main training workflow uses the VERL-related environment:
pip install -r requirements_verl.txt
requirements_gpu.txt is kept as a fallback dependency file for GPU-only utilities or evaluation workflows.
The DPO module has separate dependency files:
pip install -r dpo/requirements_gpu.txt
For NPU environments:
pip install -r dpo/requirements_npu.txt
DPO training expects a JSONL file with one preference pair per line:
{
"prompt": "instruction or context",
"chosen": "preferred answer",
"rejected": "less preferred answer",
"meta": {
"sample_id": "optional-id",
"question_type": "optional-task-type"
}
}
The dataset path is supplied at runtime and is not part of this repository.
The DPO entry point is dpo/main.py.
python dpo/main.py \
--dataset <path-to-dpo-pairs.jsonl> \
--model-name <base-model-or-local-path> \
--output-dir <output-model-dir>
Common options:
python dpo/main.py \
--dataset <path-to-dpo-pairs.jsonl> \
--model-name <base-model-or-local-path> \
--output-dir <output-model-dir> \
--num-epochs 1 \
--batch-size 1 \
--gradient-accumulation-steps 8 \
--learning-rate 5e-6 \
--beta 0.1 \
--max-length 4096 \
--max-prompt-length 3072
By default, training uses LoRA. Use full fine-tuning when needed:
--full-finetune
Enable QLoRA on supported CUDA environments:
--use-qlora
Use generate_output.py to generate outputs for the evaluation tasks.
python generate_output.py \
--backend vllm \
--data-dir <case-input-dir> \
--base-model-path <base-model-path> \
--model-path <candidate-adapter-or-model-dir> \
--output-dir <candidate-output-dir> \
--tasks 1,2,3,4
Generate base model outputs separately:
python generate_output.py \
--backend vllm \
--data-dir <case-input-dir> \
--base-model-path <base-model-path> \
--use-base-model \
--output-dir <base-output-dir> \
--tasks 1,2,3,4
Task IDs:
1: medical record standardization2: question generation3: clinical reasoning4: comprehensive scoringThe comparison scripts expect one output directory per model under a shared result root:
<result-root>/
<base-model-name>/
<candidate-model-a>/
<candidate-model-b>/
compare_experiments.py runs LLM Judge comparisons and writes task-level rankings, significance files, checkpoints, and plots.
Recommended evaluation design:
Example:
python compare_experiments.py \
--results-dir <result-root> \
--select picked \
--tasks auto \
--anchor-models <base-model-name> \
--judge-backend api \
--judge-model <judge-model-name> \
--judge-api-base <openai-compatible-api-base> \
--output-dir <pairwise-run-output-dir>
During interactive model selection, choose exactly:
<base-model-name>
<candidate-model-name>
Each pairwise run produces files such as:
<pairwise-run-output-dir>/
checkpoints/
_meta.json
<task>_checkpoint.csv
judge_stats/
<task>_ranking.csv
<task>_significance.csv
Repeat this process for every candidate model.
aggregate_anchor_compare.py aggregates multiple candidate-vs-base comparison runs into a single Anchor Score report.
python aggregate_anchor_compare.py \
--input-dir <pairwise-runs-root> \
--output-dir <aggregate-output-dir> \
--anchor-model <base-model-name> \
--order-task <task-name> \
--bootstrap 10000
Aggregation logic:
--input-dir.checkpoints/_meta.json.checkpoints/<task>_checkpoint.csv.Typical aggregate output:
<aggregate-output-dir>/
<judge-name>/
all_tasks_anchor_summary.csv
manifest.csv
<task>_anchor_ranking.csv
judge_stats/
The following are intentionally excluded from version control:
This keeps the public repository focused on reusable training, generation, comparison, and aggregation code.
3 commits
Python
100.0%