LLM-Defined BlackBoxFunction in JavaScript/TypeScript : A Prompt-Driven Framework for Automated Validation and Iterative Improvement

This thesis explores the reliability of code generated by large language models (LLMs) in dynamically typed programming environments, with a focus on JavaScript and TypeScript. While LLMs are increasingly used to automate coding tasks, their outputs often lack robustness and fail to handle edge cases, especially in one-shot generation scenarios. To address this problem, we propose and implement a framework called BlackBoxFunction, which integrates prompt-driven code generation with automated validation and iterative self-healing. The framework constructs functions via GPT-4.1, validates them using schema-based tests, and automatically regenerates invalid outputs until they pass or reach a retry limit. A controlled experiment was conducted across 20 diverse programming tasks grouped into algorithms, data transformations, and text processing. The results show that self-healing significantly improves functional correctness, raising accuracy from an average of 63% to nearly 100% across all categories, while also reducing the need for manual intervention. These findings highlight the potential of lightweight feedback loops to improve LLM reliability in real-world development workflows.

Publication Details

Journal
DiVA (Linnaeus University)
Published
2025-01-01
Primary Topic
Gene expression and cancer classification
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

LLM-Defined BlackBoxFunction in JavaScript/TypeScript : A Prompt-Driven Framework for Automated Validation and Iterative Improvement

DiVA (Linnaeus University)
Gene expression and cancer classification
article

LLM-Defined BlackBoxFunction in JavaScript/TypeScript : A Prompt-Driven Framework for Automated Validation and Iterative Improvement

article en

Abstract

This thesis explores the reliability of code generated by large language models (LLMs) in dynamically typed programming environments, with a focus on JavaScript and TypeScript. While LLMs are increasingly used to automate coding tasks, their outputs often lack robustness and fail to handle edge cases, especially in one-shot generation scenarios. To address this problem, we propose and implement a framework called BlackBoxFunction, which integrates prompt-driven code generation with automated validation and iterative self-healing. The framework constructs functions via GPT-4.1, validates them using schema-based tests, and automatically regenerates invalid outputs until they pass or reach a retry limit. A controlled experiment was conducted across 20 diverse programming tasks grouped into algorithms, data transformations, and text processing. The results show that self-healing significantly improves functional correctness, raising accuracy from an average of 63% to nearly 100% across all categories, while also reducing the need for manual intervention. These findings highlight the potential of lightweight feedback loops to improve LLM reliability in real-world development workflows.

DiVA (Linnaeus University)
Industry, innovation and infrastructure
Openalex Percentile: Top 50%
Gene expression and cancer classification
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

LLM-Defined BlackBoxFunction in JavaScript/TypeScript : A Prompt-Driven Framework for Automated Validation and Iterative Improvement · DiVA (Linnaeus University) (2025) | TGRS Research Map | TGRS