LLM Fine-tuning Use Case

Generate Code Documentation

Code needs good documentation—it improves comprehension and enables programmers to collaborate efficiently. However, manual docstring creation is time-consuming and often neglected due to tight deadlines. Learn how to fine-tune an open-source LLM to automatically generate high-quality documentation.

The Predibase Solution

Generate accurate docstrings with LLMs

  • Fine-tune CodeLlama with <6,000 data points to improve the accuracy of docstring generation
  • Instantly deploy and query your fine-tuned LLM on serverless endpoints
  • Save developers hours of time by automating the creation of documentation

Unestructured Text

Sample code
Sample code
Generate Code Documentation with LLMs

Business Value

Reduce the time and effort of writing docs
Reduce the time and effort of writing docs
Improve code comprehension and collaboration
Improve code comprehension and collaboration
Enable developers to focus on higher value activities
Enable developers to focus on higher value activities

Fine-tune and serve your own LLM for Document generation

Easily and efficiently fine-tune open-source CodeLLama with built-in optimizations such as quantization and LoRA to generate high-quality docstrings. Instantly serve and prompt your fine-tuned LLM with cost-efficient serverless endpoints built on top of open-source LoRAX. Read the full tutorial and follow along with this Colab notebook.

# Kick off the fine-tuning job

llm = pc.LLM("hf://codellama")

fine_tuning_prompt = """
	Write an appropriate docstring for the following Python function. Return the
	entire function with the in-line docstring.

	### Function: {raw_code}

	### Function with docstring:

job = llm.finetune(

# Dynamically load fine-tuned adapter for serverless inference

fine_tuned_result = adapter_deployment.prompt(

Example code in Predibase for illustrative purposes only

Resources to Get Started

Ready to efficiently fine-tune and serve your own LLM?