Previous language models were often prohibitively large, creating significant barriers for researchers in developing countries with limited storage and computing resources. This study aims to assess the performance of a compact natural language model in source code generation. We trained the base model (Phi-3 mini 4K) on the sahil2801/CodeAlpaca-20k dataset, optimizing the training process with techniques such as LoRA, QLoRA, SFTTrainer, 4-bit quantization, and FlashAttention. The evaluation involved comparing the trained Phi-3-Code model with the base model and other prominent models. Experimental results indicate that the Phi-3-Code model outperforms the alternatives, achieving a ROUGE-L score of 59%, compared to CodeBERT’s 36%, NeutralCodeSum’s 34%, Code2seq’s 33%, and the Phi-3 Mini 4K base model’s 17%. These findings provide a valuable reference for researchers seeking to utilize compact models in source code generation, as well as for developers aiming to implement models on devices constrained by processing and storage capabilities, such as personal devices.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Phi-3-Code: Fine Tuning a Small Size Language Model for Coding Generation

  • Van-Viet Nguyen,
  • Huu-Khanh Nguyen,
  • The-Vinh Nguyen,
  • Duc-Quang Vu

摘要

Previous language models were often prohibitively large, creating significant barriers for researchers in developing countries with limited storage and computing resources. This study aims to assess the performance of a compact natural language model in source code generation. We trained the base model (Phi-3 mini 4K) on the sahil2801/CodeAlpaca-20k dataset, optimizing the training process with techniques such as LoRA, QLoRA, SFTTrainer, 4-bit quantization, and FlashAttention. The evaluation involved comparing the trained Phi-3-Code model with the base model and other prominent models. Experimental results indicate that the Phi-3-Code model outperforms the alternatives, achieving a ROUGE-L score of 59%, compared to CodeBERT’s 36%, NeutralCodeSum’s 34%, Code2seq’s 33%, and the Phi-3 Mini 4K base model’s 17%. These findings provide a valuable reference for researchers seeking to utilize compact models in source code generation, as well as for developers aiming to implement models on devices constrained by processing and storage capabilities, such as personal devices.