Multi-Hunk Bug Fix Using LLaDA-8B with LoRA Fine-tuning
This project trains and evaluates a multi-hop debug language model (MDLM) for automated multi-hunk Java bug repair. It uses LLaDA-8B-Instruct with LoRA fine-tuning to generate patches for code bugs across multiple file hunks.
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
.
├── model.py # Training script (LoRA fine-tuning)
├── inference.py # Inference & evaluation on test set
├── evaluation.py # Evaluation metrics (exact match, BLEU, etc.)
├── data_preprocess.py # Data preprocessing utilities
├── baseline_reconstruction_eval.py # Baseline evaluation (zero-shot LLaDA-8B)
├── run_all_benchmarks.sh # End-to-end benchmark pipeline
├── benchmarks/ # Benchmark scripts
│ ├── run_bigcodebench.py
│ ├── run_evalplus.py
│ ├── run_java_swebench.py
│ └── run_ablations.py
├── k8s/ # Kubernetes job manifests
├── runs/ # Output directory (ignored in git)
├── processed_train.jsonl.gz # training data (large, ignored in git)
└── report/ # Evaluation results & reports
python model.py \
--use-bf16 \
--max-records 1000 \
--output-dir runs/llada_lora
Options:
--use-bf16: Use bfloat16 precision (requires A100/H100 GPUs)--max-records: Limit training records (None = full dataset)--output-dir: Output directory for fine-tuned modelpython inference.py \
--model GSAI-ML/LLaDA-8B-Instruct \
--adapter runs/llada_lora/checkpoint-500 \
--max-records 200
Output: Evaluation metrics (exact match %, BLEU, edit distance, etc.)
python baseline_reconstruction_eval.py \
--model GSAI-ML/LLaDA-8B-Instruct \
--num-records 200
bash run_all_benchmarks.sh
This runs:
Submit jobs using manifests in k8s/:
kubectl apply -f k8s/train-job.yaml
kubectl apply -f k8s/benchmark-job.yaml
kubectl apply -f k8s/swe_benchmark.yaml
See evaluation.py for implementation details.
Training data: processed_train.jsonl.gz (gzipped JSONL)
{
"record_id": "swe-bench-123",
"buggy_code": "...",
"fixed_code": "...",
"hunks": [{"start": 10, "end": 20, "fixed": "..."}, ...],
"repo": "django/django",
"commit": "abc123..."
}
Edit constants in model.py:
MODEL_NAME = "GSAI-ML/LLaDA-8B-Instruct"
TRAIN_GZ = Path(__file__).parent / "processed_train.jsonl.gz"
DEFAULT_FALLBACK_MAX_LEN = 1024
TEST_FRACTION = 0.1 # 10% test split (deterministic hash-based)
model.py and inference.py use same split logic for consistencyruns/ directory with timestampBuilt with LLaDA-8B and inspired by SWE-Bench evaluation framework.
31 commits
24 commits
Python
95.7%
Shell
4.3%
Multi-Hunk Bug Fix Using LLaDA-8B with LoRA Fine-tuning
This project trains and evaluates a multi-hop debug language model (MDLM) for automated multi-hunk Java bug repair. It uses LLaDA-8B-Instruct with LoRA fine-tuning to generate patches for code bugs across multiple file hunks.
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
.
├── model.py # Training script (LoRA fine-tuning)
├── inference.py # Inference & evaluation on test set
├── evaluation.py # Evaluation metrics (exact match, BLEU, etc.)
├── data_preprocess.py # Data preprocessing utilities
├── baseline_reconstruction_eval.py # Baseline evaluation (zero-shot LLaDA-8B)
├── run_all_benchmarks.sh # End-to-end benchmark pipeline
├── benchmarks/ # Benchmark scripts
│ ├── run_bigcodebench.py
│ ├── run_evalplus.py
│ ├── run_java_swebench.py
│ └── run_ablations.py
├── k8s/ # Kubernetes job manifests
├── runs/ # Output directory (ignored in git)
├── processed_train.jsonl.gz # training data (large, ignored in git)
└── report/ # Evaluation results & reports
python model.py \
--use-bf16 \
--max-records 1000 \
--output-dir runs/llada_lora
Options:
--use-bf16: Use bfloat16 precision (requires A100/H100 GPUs)--max-records: Limit training records (None = full dataset)--output-dir: Output directory for fine-tuned modelpython inference.py \
--model GSAI-ML/LLaDA-8B-Instruct \
--adapter runs/llada_lora/checkpoint-500 \
--max-records 200
Output: Evaluation metrics (exact match %, BLEU, edit distance, etc.)
python baseline_reconstruction_eval.py \
--model GSAI-ML/LLaDA-8B-Instruct \
--num-records 200
bash run_all_benchmarks.sh
This runs:
Submit jobs using manifests in k8s/:
kubectl apply -f k8s/train-job.yaml
kubectl apply -f k8s/benchmark-job.yaml
kubectl apply -f k8s/swe_benchmark.yaml
See evaluation.py for implementation details.
Training data: processed_train.jsonl.gz (gzipped JSONL)
{
"record_id": "swe-bench-123",
"buggy_code": "...",
"fixed_code": "...",
"hunks": [{"start": 10, "end": 20, "fixed": "..."}, ...],
"repo": "django/django",
"commit": "abc123..."
}
Edit constants in model.py:
MODEL_NAME = "GSAI-ML/LLaDA-8B-Instruct"
TRAIN_GZ = Path(__file__).parent / "processed_train.jsonl.gz"
DEFAULT_FALLBACK_MAX_LEN = 1024
TEST_FRACTION = 0.1 # 10% test split (deterministic hash-based)
model.py and inference.py use same split logic for consistencyruns/ directory with timestampBuilt with LLaDA-8B and inspired by SWE-Bench evaluation framework.
31 commits
24 commits
Python
95.7%
Shell
4.3%