This replication package contains supplementary material for the paper "ACRCoder: Adaptive Context Retrieval through Reinforcement Learning for Repository-level Code Completion".
- Download the original dataset from https://huggingface.co/datasets/nov3630/Data4RLCoder
- Use
DataProcess/PreProcessData.pyto construct the FIM dataset - Use
DataProcess/analyzer.pyto calculate the PPL sequence of context combinations - Use
DataProcess/GenerateTrainData.pyto generate reinforcement learning training data based on RRL
- Use
Trainer/trainReranker.pyto train the reranker model - Reference training command:
deepspeed --include localhost:0,1,2,3 trainRetrieve.py \
--deepspeed ZeRO_2.json --base_model /nvme1n1/LLM/Qwen3-Reranker-0.6B \
--cutoff_len 8000 --per_device_train_batch_size 1 --gradient_accumulation_steps 64 \
--warmup_steps 100 --num_train_epochs 5 --learning_rate 1e-7 --logging_steps 5 \
--val_set_size 0 --output_dir ./Models \
--data_path Data/processed_train_datasetV4_deepseek-coder-1.3b-base_balance_min_ppl3.parquet
--sft_loss_rate 1.0 --scorer_loss_rate 1.0 --log_scorer_loss False- Use
Evaluate/RetriveCCEval.pyto retrieve context combinations - Use
Evaluate/evalCCEvalScoreVllm.pyto evaluate EM and ES performance
- The implementation of RQ1 is based on RLCoder, with the repository at: https://github.com/DeepSoftwareAnalytics/RLCoder
- Use
RRLPerformance/InferCCEval.pyto generate completion results - Use
RRLPerformance/inferRRLandPPL.pyto calculate PPL and RRL - Use
RRLPerformance/calculateCorrelation.pyto compute point biserial correlation and Spearman rank-order correlation