Demo-Craft: Using In-Context Learning to Improve Code Generation in Large Language Models

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Kapu, Nirmal Joshua, Sreejith, Mihit
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866917964817629184
author Kapu, Nirmal Joshua
Sreejith, Mihit
author_facet Kapu, Nirmal Joshua
Sreejith, Mihit
contents Generating executable code from natural language instructions using Large Language Models (LLMs) poses challenges such as semantic ambiguity and understanding taskspecific contexts. To address these issues, we propose a system called DemoCraft, which enhances code generation by leveraging in-context learning and demonstration selection, combined with latent concept learning. Latent concept learning introduces additional concept tokens, which are trainable embeddings that capture task-specific knowledge. We then test our system on two major datasets: MBPP and Humaneval. Our experimental results demonstrate that the proposed system achieves an approximate 2x increase in the pass@k metric compared to baseline models. Furthermore, we introduce two novel evaluation metrics: correctness@k and similarity@k. Our empirical studies indicate that our system attains nearly a 3x improvement in these metrics as well.
format Preprint
id arxiv_https___arxiv_org_abs_2411_00865
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Demo-Craft: Using In-Context Learning to Improve Code Generation in Large Language Models
Kapu, Nirmal Joshua
Sreejith, Mihit
Software Engineering
Artificial Intelligence
Computation and Language
Generating executable code from natural language instructions using Large Language Models (LLMs) poses challenges such as semantic ambiguity and understanding taskspecific contexts. To address these issues, we propose a system called DemoCraft, which enhances code generation by leveraging in-context learning and demonstration selection, combined with latent concept learning. Latent concept learning introduces additional concept tokens, which are trainable embeddings that capture task-specific knowledge. We then test our system on two major datasets: MBPP and Humaneval. Our experimental results demonstrate that the proposed system achieves an approximate 2x increase in the pass@k metric compared to baseline models. Furthermore, we introduce two novel evaluation metrics: correctness@k and similarity@k. Our empirical studies indicate that our system attains nearly a 3x improvement in these metrics as well.
title Demo-Craft: Using In-Context Learning to Improve Code Generation in Large Language Models
topic Software Engineering
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2411.00865