Abstract
Maintaining accurate software documentation remains a persistent challenge in software engineering, often resulting in significant documentation debt. Although large language models show strong coding capabilities, general-purpose models frequently generate verbose or stylistically inconsistent docstrings, which limits their use in automated workflows.
This thesis investigates parameter-efficient specialisation of the open-source StarCoder2-7B model for Python function-level docstring generation. Low-Rank Adaptation (LoRA) was applied using the DocuMint dataset, with a systematic comparison of five fine-tuning configurations to analyse the trade-offs between parameter efficiency, training stability and documentation quality.
Evaluation
The evaluation uses a multi-dimensional framework tailored to documentation:
- Semantic alignment: BERTScore (F1)
- Lexical overlap: ROUGE-L and smoothed BLEU
- Readability: Flesch–Kincaid
- Verbosity: length ratio relative to the reference docstrings
Experiments ran on a 10,000-sample internal test set and two external benchmarks, MBPP and HumanEval.
Findings
The selected LoRA-adapted model improved semantic alignment and structural correspondence. Most notably, it substantially reduced verbosity compared with the zero-shot base model and with open-weight competitors. Overall, parameter-efficient fine-tuning of mid-sized code models yields practical improvements for automated Python docstring generation.
Supervised by Prof. Dr.-Ing. Munir Georges and Prof. Dr. Sören Gröttrup.