TechNewsReel
Live

JetBrains Open-Sources KotlinLLM to Bridge LLM Flexibility and Compiled Stability

The research prototype uses 'Smart macros' to generate persistent Kotlin source code at runtime, reducing reliance on live LLM API calls.

TechNewsReel Newsroom · August 4, 2026

JetBrains Research has open-sourced KotlinLLM, a research prototype that allows Kotlin/JVM projects to delegate runtime logic to a large language model. The tool aims to combine the adaptability of LLMs with the performance and safety of statically typed, compiled code.

Implemented as an IntelliJ IDEA plugin, KotlinLLM introduces "Smart macros" that synthesize plain Kotlin source code during application execution. According to JetBrains Research, this allows developers to write explicit Kotlin calls whose bodies are generated as source code and updated as the application encounters new runtime scenarios. Once the code is generated and persisted, it remains portable and runs without the plugin, meaning the logic can be committed to version control, reviewed by humans, and distributed as standard code.

The Mechanics of Smart Macros

The tool provides two primary Smart macros to handle common runtime challenges. The `asLlm<F, T>(from, hint)` macro is designed to parse unstructured data into typed values, while `mockLlm<T>()` generates stateful interface implementations.

In practical testing using an adapted Spring Petclinic project, JetBrains reported that KotlinLLM achieved a 100% hot-reload success rate across 24 different application scenarios. The project has been released under the Apache License 2.0, making it available for broader community experimentation.

Shifting the Runtime Paradigm

Traditionally, LLMs are integrated into software as development assistants or as runtime dependencies via direct API calls. However, direct runtime delegation is often plagued by high latency, significant costs, and non-deterministic outputs. While runtime code generation has been explored for interpreted languages like Python, applying this to a compiled language like Kotlin presents unique challenges regarding type safety and stability.

KotlinLLM proposes a hybrid "bootstrapping" approach. By using an LLM to generate permanent, typed code rather than calling an API on every request, the system eliminates the recurring overhead of LLM inference. This allows an application to evolve its behavior based on real-world usage while maintaining the rigor of standard software engineering workflows, including CI/CD pipelines and Git-based peer reviews.

Future Implications

This shift could allow developers to deploy applications that are more resilient to unexpected data formats or evolving requirements without sacrificing the execution speed of the JVM. By converting non-deterministic LLM outputs into deterministic source code, JetBrains is testing a path toward "self-evolving" software that remains auditable.

As the project moves from a research prototype to a community-driven tool, the industry will be watching to see how these Smart macros handle more complex, large-scale production environments beyond the initial Petclinic benchmarks.

Sources

Get a notification when a big story breaks. A few a day at most — no spam.