HackerPapers

arXiv:2510.11151cs.CL

TypePilot: Leveraging the Scala Type System for Secure LLM-generated Code

Alexander Sternfeld, Andrei Kucharavy, Ljiljana Dolamic

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

Large language Models (LLMs) have shown remarkable proficiency in code generation tasks across various programming languages. However, their outputs often contain subtle but critical vulnerabilities, posing significant risks when deployed in security-sensitive or mission-critical systems. This paper introduces TypePilot, an agentic AI framework designed to enhance the security and robustness of LLM-generated code by leveraging strongly typed and verifiable languages, using Scala as a representative example. We evaluate the effectiveness of our approach in two settings: formal verification with the Stainless framework and general-purpose secure code generation. Our experiments with leading open-source LLMs reveal that while direct code generation often fails to enforce safety constraints, just as naive prompting for more secure code, our type-focused agentic pipeline substantially mitigates input validation and injection vulnerabilities. The results demonstrate the potential of structured, type-guided LLM workflows to improve the SotA of the trustworthiness of automated code generation in high-assurance domains.

arXiv comments
Journal reference
DOI
Subjects
cs.CLComputation and Language cs.CRCryptography and Security

On Hacker News

Linked by 1 identifiable commenter in 2 comments across 1 thread, from Apr 2026 to Apr 2026.

Comments linking this paper, per year.

Discussed in comments1 thread

    • Why would anybody use a vibe-coded and vibe-desinged language which effectively does not exist yet instead of an established one with such features, like Scala? https://arxiv.org/html/2510.11151v1

      still_grokkingView on HNParent context

    • That's in large parts Scala. It doesn't have Hindley-Milner type inference, but it has very strong type inference. We will get linearity soon thanks to and as part of the Capybara[1] effort. Refinement types are already long a reality. The whole new effect tracking thing is…

      still_grokkingView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.