Author: Veselin Kolev from Sofia Tech Park
Editors and Reviewers: Codee Team
Why Fortran Modernization Matters
Numerous scientific and engineering codes were first developed decades ago. Their functionality remains valuable, but software ages: bugs emerge, new requirements appear, and compatibility with modern development toolchains is essential.
Fortran developers are particularly familiarized with the challenge of dealing with legacy-style code. Sooner or later, however, even the most reliable software packages must be updated or modernized. This is often unavoidable if the tools are to be integrated into new projects or kept compatible with the latest compiler versions. Modernization turns this necessity into an opportunity, making the code easier to understand and to maintain over time. Three options are typically available in practice:
- Manual modernization, editing the code without assistance.
- Specialized tooling, using solutions like Codee.
- AI-assisted coding, leveraging large language models (LLMs).
This post will focus on code formatting, a natural first step in modernization, before deeper refactorizations. In the following sections, the Codee Formatter will be compared with AI-based approaches for Fortran formatting.
Codee vs. AI Assistants: “It Is” vs. “It Might Be”
A major challenge with AI models is controlling their behavior. First, the output depends heavily on the prompt; a request like “make this Fortran code easier to read” may result in far more than formatting, including code restructuring or unwanted algorithmic changes. And even with careful prompting, LLMs are probabilistic tools. No matter how complex a model is, it may hallucinate content, introducing changes that break the original functionality of the code or even prevent compilation. AI assistants aren’t “wrong” for code modernization, but LLMs are definitely risky without close supervision by an experienced developer who can guide the model and verify the correctness of the outcome. Moreover, LLMs may occasionally fail entirely. During this evaluation, Claude 3.5 Sonet, Gemini 2.5 Pro Max, and GPT-4 all gave up on formatting a 250-line-long, messy Fortran 77 code, highlighting that even the most advanced models struggle with complex or messy legacy code.
By contrast, Codee is a deterministic tool built on compiler technology (LLVM and tree-sitter). Its transformations to the code are predictable and reproducible. When Codee is asked to format Fortran code, it formats the code with no surprises. Additionally, because it parses code structure like a compiler, Codee ensures the correctness of the transformations and avoids unintended side effects. For examples on Fortran modernization, see the Codee Formatter and the Codee Analyzer documentation.
Speed and Cost
LLM inference speed is slow for code formatting standards, especially with larger models often chosen for better reasoning capabilities. While LLM throughput can be measured in how many lines of code are generated per second, the Codee Formatter processes thousands of files in milliseconds.
In other words, where Codee formats Fortran code instantly, Claude 3.5 Sonet, Gemini 2.5 Pro Max, and GPT-4 are 8 to 10 times slower. AI assistants come with verification overhead on the developer side as well, since every suggestion must be reviewed line-by-line for correctness. Meanwhile, Codee’s nature removes that guesswork. Additionally, AI assistants also bring significant operational costs:
- Cloud models require subscription fees, often with usage limits that throttle inference speed and/or model capabilities.
- On-prem deployment of open LLMs demands significant compute power, electricity, and maintenance effort.
By contrast, Codee runs efficiently on the developer’s machine, with the Codee Formatter’s compute requirements being negligible compared to LLM inference.
Privacy Considerations
Lastly, AI assistants are most commonly accessed through cloud services, prioritizing both convenience and the typically higher model quality of closed solutions. As a result, LLMs often require uploading your source code to third-party servers.
In contrast, Codee runs entirely on your machines, retaining full control and privacy over your data.
A real-world comparison: AI assistants vs. Codee Formatter for Fortran modernization.
Conclusions
While AI assistants are excellent companions for software development, LLMs are less suited for Fortran code modernization workflows. In that use case, the Codee Formatter is a perfect complement, as it is:
- Safer: deterministic behavior built on top of compiler technologies.
- Faster: handles large projects in seconds.
- Cheaper: no heavy computational costs.
- Privacy-friendly: fully local execution
I “In most cases, we found that using Codee vs. Cursor.sh to modernize old Fortran 77 code is at least 8 to 10 times faster, on average. If we include the time spent verifying the code’s validity after it was modernized […] the Codee approach for modernization saves 25 times more time overall.”
I “The major problem is that […] AI-driven programming assistants require well-experienced and skilled personnel who can check the outcome of the suggested modernization […]. And that is a must because no matter how good the AI models become, they cannot stop hallucinating”
I “Using Codee for code modernization is faster and more profitable than relying on AI inference. And it is less risky. […] We do not say that using AI-driven programming assistants is wrong, but […] they are not as efficient as we need it to be. Paradoxically, the AI-driven programming assistants help in Fortran code modernization only if they are supervised by a well-experienced programmer.”
— Veselin Kolev from Sofia Tech Park
— Discoverer Supercomputer
🔗 You can download Codee Formatter for free and try it on your own Fortran projects:
https://www.codee.com/codee-formatter/
Build correct, secure, modern and fast Fortran, C and C++ scientific software
This company is capitalized by INNVIERTE, AN INVESTMENT PROGRAM OF CDTI, E.P.E
Leave a Reply