EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

SPE-ECG: An Ontology-Guided Knowledge Representation Framework for Enhancing LLM-Based Code Generation

Talha Mahmood, Muhammad Tanvir Afzal, Ahmad Sami Al-Shamayleh, Ghulam Mustafa, Isabel De la Torre Díez, Lázaro Javier Hernández Rodríguez, Pablo Herrero García

Computation · 03.11.2026 · 14 (11) · 272

DOI: 10.3390/computation14110272 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Computation, online erschienen am 03.11.2026. Verfasst von Talha Mahmood und 6 weiteren Autor:innen. Die Arbeit nennt 32 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0).

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Large Language Models (LLMs) can translate natural-language instructions into code, but when the input is unstructured clinical protocol text, the generated code may omit doses, monitoring intervals, or safety thresholds that the text states. Such omissions matter because they can propagate into software that supports clinical monitoring. We propose SPE-ECG (Structured Prompt Engineering for Enhanced Code Generation), a transparent, rule-based pipeline that converts unstructured domain text into a JSON prompt using text cleaning, part-of-speech tagging, bigram matching, and hand-built domain dictionaries, without fine-tuning any model. In a case study of 43 rheumatoid arthritis DMARD monitoring protocols, we compared raw and structured prompts on three LLMs (GPT-3.5, LLaMA 2, and Gemma), scoring the generated Python code using version 3.15.1 with BLEU against the raw-prompt code of the other two models. Mean BLEU rose for all three models (relative gains of 55.1%, 32.5%, and 19.9%); the paired differences were significant for GPT-3.5 and LLaMA 2 but not, after correction for multiple comparisons, for Gemma. These results suggest that lightweight input structuring can change how closely different models’ outputs agree, and that it could serve as a low-cost, auditable preparation step for protocol-to-code tools built on free or open models. BLEU does not measure correctness, no ablation or state-of-the-art baseline was run, and clinical validation is required before any use.

Zitieren

APA

Mahmood, T., Afzal, M. T., Al-Shamayleh, A. S., Mustafa, G., Díez, I. D. L. T., Rodríguez, L. J. H., & García, P. H. (2026). SPE-ECG: An Ontology-Guided Knowledge Representation Framework for Enhancing LLM-Based Code Generation. Computation, 14(11), 272. https://doi.org/10.3390/computation14110272

Vancouver

Mahmood T, Afzal MT, Al-Shamayleh AS, Mustafa G, Díez IDLT, Rodríguez LJH, et al. SPE-ECG: An Ontology-Guided Knowledge Representation Framework for Enhancing LLM-Based Code Generation. Computation. 2026;14(11):272. doi:10.3390/computation14110272

BibTeX
@article{Mahmood2026,
  author = {Mahmood, Talha and Afzal, Muhammad Tanvir and Al-Shamayleh, Ahmad Sami and Mustafa, Ghulam and Díez, Isabel De la Torre and Rodríguez, Lázaro Javier Hernández and García, Pablo Herrero},
  title = {SPE-ECG: An Ontology-Guided Knowledge Representation Framework for Enhancing LLM-Based Code Generation},
  journal = {Computation},
  year = {2026},
  volume = {14},
  number = {11},
  pages = {272},
  doi = {10.3390/computation14110272}
}
Kostenlos starten →