mlsanityData to 7 Oct 2026

Can We Trust Large Language Models Generated Code? A Framework for In-Context Learning, Security Patterns, and Code Evaluations Across Diverse LLMs

arXiv 2406.12513 ↗First posted 18 Jun 2024cs.CRcited by 17

Not on the map. Why?

Abstract (arXiv)

Large Language Models (LLMs) such as ChatGPT and GitHub Copilot have revolutionized automated code generation in software engineering. However, as these models are increasingly utilized for software development, concerns have arisen regarding the security and quality of the generated code. These concerns stem from LLMs being primarily trained on publicly available code repositories and internet-based textual data, which may contain insecure code. This presents a significant risk of perpetuating vulnerabilities in the generated code, creating potential attack vectors for exploitation by malicious actors. Our research aims to tackle these issues by introducing a framework for secure behavioral learning of LLMs through In-Content Learning (ICL) patterns during the code generation process, followed by rigorous security evaluations. To achieve this, we have selected four diverse LLMs for experimentation. We have evaluated these coding LLMs across three programming languages and identified security vulnerabilities and code smells. The code is generated through ICL with curated problem sets and undergoes rigorous security testing to evaluate the overall quality and trustworthiness of the generated code. Our research indicates that ICL-driven one-shot and few-shot learning patterns can enhance code security, reducing vulnerabilities in various programming scenarios. Developers and researchers should know that LLMs have a limited understanding of security principles. This may lead to security breaches when the generated code is deployed in production systems. Our research highlights LLMs are a potential source of new vulnerabilities to the software supply chain. It is important to consider this when using LLMs for code generation. This research article offers insights into improving LLM security and encourages proactive use of LLMs for code generation to ensure software system safety.

Key facts. Cited by 17 papers in the map (data through 7 Oct 2026). First posted on arXiv 18 Jun 2024.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 3; 2025: 11; 2026: 3.

17 papers.

Sort:

By area:

  1. 2025Vibe Coding vs. Agentic Coding: Fundamentals and Practical Implications of Agentic AIcited by 39
  2. 2025A Study of LLMs' Preferences for Libraries and Programming Languagescited by 20
  3. 2025Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineeringcited by 15
  4. 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 13
  5. 2024Towards More Trustworthy and Interpretable LLMs for Code through Syntax-Grounded Explanationscited by 10
  6. 2025The Invisible Hand: Unveiling Provider Bias in Large Language Models for Code Generationcited by 10
  7. 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Securitycited by 9
  8. 2024How Propense Are Large Language Models at Producing Code Smells? A Benchmarking Studycited by 6
  9. 2025Curiosity by Design: An LLM-based Coding Assistant Asking Clarification Questionscited by 3
  10. 2025SOK: Exploring Hallucinations and Security Risks in AI-Assisted Software Development with Insights for LLM Deploymentcited by 2
  11. 2026DeepGuard: Secure Code Generation via Multi-Layer Semantic Aggregationcited by 2
  12. 2025EVALOOOP: A Self-Consistency-Centered Framework for Assessing Large Language Model Robustness in Programmingcited by 1
5 more
  1. 2025HiLDe: Intentional Code Generation via Human-in-the-Loop Decodingcited by 1
  2. 2026Precise Debugging Benchmark: Is Your Model Debugging or Regenerating?cited by 1
  3. 2025Mapping the Trust Terrain: LLMs in Software Engineering -- Insights and Perspectivescited by 0
  4. 2025Holistic Evaluation of State-of-the-Art LLMs for Code Generationcited by 0
  5. 2026Do Influence Tactics Matter? Investigating Prompt Framing Effects in LLM Code Generationcited by 0