DDPT: Diffusion-Driven Prompt Tuning for Large Language Model Code Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Li, Jinyang, Hyun, Sangwon, Babar, M. Ali
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913780011630592
author Li, Jinyang
Hyun, Sangwon
Babar, M. Ali
author_facet Li, Jinyang
Hyun, Sangwon
Babar, M. Ali
contents Large Language Models (LLMs) have demonstrated remarkable capabilities in code generation. However, the quality of the generated code is heavily dependent on the structure and composition of the prompts used. Crafting high-quality prompts is a challenging task that requires significant knowledge and skills of prompt engineering. To advance the automation support for the prompt engineering for LLM-based code generation, we propose a novel solution Diffusion-Driven Prompt Tuning (DDPT) that learns how to generate optimal prompt embedding from Gaussian Noise to automate the prompt engineering for code generation. We evaluate the feasibility of diffusion-based optimization and abstract the optimal prompt embedding as a directional vector toward the optimal embedding. We use the code generation loss given by the LLMs to help the diffusion model capture the distribution of optimal prompt embedding during training. The trained diffusion model can build a path from the noise distribution to the optimal distribution at the sampling phrase, the evaluation result demonstrates that DDPT helps improve the prompt optimization for code generation.
format Preprint
id arxiv_https___arxiv_org_abs_2504_04351
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle DDPT: Diffusion-Driven Prompt Tuning for Large Language Model Code Generation
Li, Jinyang
Hyun, Sangwon
Babar, M. Ali
Software Engineering
Artificial Intelligence
Computation and Language
Machine Learning
Large Language Models (LLMs) have demonstrated remarkable capabilities in code generation. However, the quality of the generated code is heavily dependent on the structure and composition of the prompts used. Crafting high-quality prompts is a challenging task that requires significant knowledge and skills of prompt engineering. To advance the automation support for the prompt engineering for LLM-based code generation, we propose a novel solution Diffusion-Driven Prompt Tuning (DDPT) that learns how to generate optimal prompt embedding from Gaussian Noise to automate the prompt engineering for code generation. We evaluate the feasibility of diffusion-based optimization and abstract the optimal prompt embedding as a directional vector toward the optimal embedding. We use the code generation loss given by the LLMs to help the diffusion model capture the distribution of optimal prompt embedding during training. The trained diffusion model can build a path from the noise distribution to the optimal distribution at the sampling phrase, the evaluation result demonstrates that DDPT helps improve the prompt optimization for code generation.
title DDPT: Diffusion-Driven Prompt Tuning for Large Language Model Code Generation
topic Software Engineering
Artificial Intelligence
Computation and Language
Machine Learning
url https://arxiv.org/abs/2504.04351