惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 聂微东
Forbes - Security
Forbes - Security
IT之家
IT之家
P
Privacy International News Feed
宝玉的分享
宝玉的分享
小众软件
小众软件
Google DeepMind News
Google DeepMind News
美团技术团队
G
GRAHAM CLULEY
T
Tor Project blog
Recorded Future
Recorded Future
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Hacker News
The Hacker News
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
Scott Helme
Scott Helme
WordPress大学
WordPress大学
F
Full Disclosure
D
Docker
G
Google Developers Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyberwarzone
Cyberwarzone
The Last Watchdog
The Last Watchdog
V
V2EX
www.infosecurity-magazine.com
www.infosecurity-magazine.com
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Security Latest
Security Latest
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Recent Announcements
Recent Announcements
P
Palo Alto Networks Blog
L
LINUX DO - 热门话题
V
Visual Studio Blog
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
腾讯CDC
H
Heimdal Security Blog
博客园 - 【当耐特】
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
S
Securelist
Vercel News
Vercel News
J
Java Code Geeks

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Untangling 40-Year-Old COBOL Monoliths with Gemma 4 (Yes, Completely Offline)
Karteek Yada · 2026-05-19 · via DEV Community

Submission Category: Write About Gemma 4

GemmaAudit Interface Demo

If you've ever had to look at 40-year-old COBOL code, you have my deepest condolences.

I recently set out to help a team modernize their core legacy mainframe pipelines. If you aren't familiar with this world, it’s a trip back in time: massive files, zero modularity, global variables shared across procedural spaghetti, and database queries bound directly to execution threads.

Normally, when developers try to rewrite or refactor code today, they toss it into a public LLM API, get a reasonably clean function back, and call it a day. But in the enterprise financial or healthcare world, doing that will get you fired faster than you can say "compliance nightmare." Sending proprietary banking logic or customer record structures to an external cloud API is an absolute non-starter.

So, I decided to see if we could build a fully offline legacy code modernization agent.

But I faced a major constraint: I didn't have a giant enterprise machine or a multi-million-dollar model cluster at my disposal. No massive cloud budget, no giant closed models. Just my local development workstation and a personal challenge to see what I could achieve with the hardware I already had.

Here is exactly what I learned, how I handled the transition, and how running Gemma 4 with Unsloth made it surprisingly straightforward to tackle on a single GPU.

The Hack: Open Source, Academic Papers, and Unsloth

My journey started with a classic developer's approach. I grabbed a standard, off-the-shelf open-source COBOL parser to see if I could extract the code's syntax tree (AST). But as anyone who has worked with legacy systems knows, off-the-shelf tools get you about 60% of the way there before choking on real-world mainframe quirks.

To bridge the gap, I started digging through academic papers on legacy reverse-engineering. I wanted to see how researchers were structurally modeling these systems. Using their papers as a blueprint, I iterated on the open-source parser, writing custom logic to map global memory lineage and system-level database calls.

But parsing the code was only half the battle. I still needed a local intelligence engine to translate that parsed structural context into clean, modernized Python microservices.

To fit a highly capable model like Gemma 4 on my single-GPU local machine, I loaded it through Unsloth. If you haven't used it, Unsloth is a lifesaver for local LLM workflows. It implements custom Triton kernels that make inference and training up to 2x faster while slashing VRAM usage by up to 80%.

By utilizing Unsloth’s optimized 4-bit QLoRA quantizations, I was able to run local inference loops right on my own workstation's GPU with blazing speed. No corporate VPC cluster, no astronomical cloud bills. Just an air-gapped, high-performance modernization agent running right under my desk.

The Nightmare of Global Mutability

To understand why legacy COBOL code is so difficult to parse and translate, look at a standard compound interest calculator. If you're a modern JS or Python developer, this memory layout will probably make your eyes water:

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. COMP-INTEREST.
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 WORKING-STORAGE SECTION.
000600 01 WS-CALC-VARS.
000700    05 WS-BALANCE         PIC 9(7)V99.
000800    05 WS-RATE            PIC 9(2)V999.
000900    05 WS-YEARS           PIC 9(2) VALUE 0.
001000    05 WS-COUNTER         PIC 9(2) VALUE 0.
001100    05 WS-ACCUMULATOR     PIC 9(9)V99 VALUE 0.0.
001200 EXEC SQL
001300    INCLUDE SQLCA
001400 END-EXEC.
001500 LINKAGE SECTION.
001600 01 LK-INPUT-PARAMS.
001700    05 LK-ACC-NUM         PIC X(10).
001800 01 LK-OUTPUT-RESULT     PIC 9(9)V99.
001900 PROCEDURE DIVISION USING LK-INPUT-PARAMS, LK-OUTPUT-RESULT.
002000 0000-MAIN.
002100     EXEC SQL
002200        SELECT BALANCE, INTEREST_RATE, TERM_YEARS 
002300        INTO :WS-BALANCE, :WS-RATE, :WS-YEARS
002400        FROM DB2_ACCOUNT_TABLE 
002500        WHERE ACCOUNT_NUMBER = :LK-ACC-NUM
002600     END-EXEC.
002700     IF SQLCODE = 0
002800        PERFORM 1000-INITIALIZE
002900        PERFORM 2000-PROCESS-COMPOUND VARYING WS-COUNTER FROM 1 BY 1 
003000                UNTIL WS-COUNTER > WS-YEARS
003100        MOVE WS-ACCUMULATOR TO LK-OUTPUT-RESULT
003200     ELSE
003300        MOVE 0.0 TO LK-OUTPUT-RESULT
003400     END-IF.
003500     GOBACK.
003600 1000-INITIALIZE.
003700     MOVE WS-BALANCE TO WS-ACCUMULATOR.
003800 2000-PROCESS-COMPOUND.
003900     COMPUTE WS-ACCUMULATOR = WS-ACCUMULATOR * (1.0 + (WS-RATE / 100.0)).

Enter fullscreen mode Exit fullscreen mode

There are three major pain points here:

  1. Shared Global Memory: Everything in the WORKING-STORAGE SECTION is a global variable. When 2000-PROCESS-COMPOUND mutates WS-ACCUMULATOR, it's modifying shared state directly. If you try to run multiple calculations in parallel, you'll run face-first into race conditions.
  2. Database Coupling: The database query is welded directly to the code thread via embedded SQL (EXEC SQL ...). You can't test the business logic without mocking a database connection.
  3. The Hidden Orchestration (JCL): COBOL almost never runs alone. In a real mainframe environment, it sits behind JCL (Job Control Language) batch files. JCL handles the "plumbing"—scheduling program steps (EXEC PGM=COMP-INTEREST) and mapping physical storage datasets to logical DD handles. Modernizing the program requires parsing both the outer JCL script and the inner COBOL logic to preserve context.

Exposing the Monologue: Gemma 4's "Deep Thinking"

One of my favorite additions to Gemma 4 is its capacity for structured, step-by-step reasoning. To leverage this, I configured the agent with a custom Deep Thinking Mode that forces the model to dump its internal monologue inside an XML <thinking> block.

Instead of jumping straight to the output, the model has to talk to itself first. Here is what that reasoning path actually looks like when analyzing our compound interest COBOL file:

<thinking>
Alright, let's break down this legacy COBOL module. 

1. First Glance:
   - Program name is 'COMP-INTEREST.CBL'.
   - It takes an account number as input via LINKAGE, queries a DB2 database, compounds interest in a loop, and passes the final balance back.

2. Finding the Pain Points:
   - The embedded SQL (EXEC SQL) binds the database layer directly to the computation. We need to decouple this into a clean repository layer.
   - Global mutable variables (WS-BALANCE, WS-RATE, WS-YEARS, WS-COUNTER, WS-ACCUMULATOR) are mutated in the perform loop. This is a classic state tracking nightmare.
   - The loop (2000-PROCESS-COMPOUND) runs years-based compounding. We can translate this into a stateless, closed-form mathematical equation: Principal * (1 + Rate)^Years.

3. Formulating the Translation Plan:
   - Memory Separation: Completely eliminate WORKING-STORAGE state. Encapsulate computation in a pure, stateless function using Python's Decimal class. (Why Decimal? Float precision loss is unacceptable in financial transactions, and COBOL's fixed-point PIC 9(7)V99 maps perfectly to Decimal).
   - Database Separation: Use FastAPI + Async SQLAlchemy/SQLModel. This decouples database IO from the math.
   - Interface: Define clean Pydantic request/response schemas to enforce type safety.
</thinking>

Enter fullscreen mode Exit fullscreen mode

The Outcome: A Stateless Python Microservice

When you combine local tool grounding (giving Gemma 4 a secure static parser to extract procedural divisions) with that step-by-step reasoning trace, you get a clean, production-ready FastAPI microservice:

from decimal import Decimal
from typing import Optional
from fastapi import FastAPI, HTTPException, Depends
from pydantic import BaseModel, Field
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.orm import sessionmaker, declarative_base
from sqlalchemy import Column, String, Numeric, Integer, select

# 1. Decoupled Postgres DB Layer
DATABASE_URL = "postgresql+asyncpg://db_user:secure@localhost:5432/finance_db"
engine = create_async_engine(DATABASE_URL, echo=True)
AsyncSessionLocal = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
Base = declarative_base()

class DB2AccountRecord(Base):
    __tablename__ = "db2_account_table"
    account_number = Column(String(10), primary_key=True, index=True)
    balance = Column(Numeric(9, 2), nullable=False)
    interest_rate = Column(Numeric(4, 3), nullable=False)
    term_years = Column(Integer, nullable=False)

# 2. Pydantic Verification Layers
class AccountRequest(BaseModel):
    account_number: str = Field(..., max_length=10, pattern=r"^[A-Z0-9]+$")

class AccountBalanceResponse(BaseModel):
    account_number: str
    initial_balance: Decimal
    interest_rate: Decimal
    term_years: int
    compound_balance: Decimal

app = FastAPI(title="Compounding Interest Microservice", version="1.0.0")

# 3. Stateless Compound Interest Engine
def compute_compound_balance(principal: Decimal, rate: Decimal, years: int) -> Decimal:
    """
    Stateless translation of 2000-PROCESS-COMPOUND perform-loop.
    Replaces global state accumulator with pure compounding calculation.
    """
    rate_factor = Decimal("1.0") + (rate / Decimal("100.0"))
    final_balance = principal * (rate_factor ** years)
    return final_balance.quantize(Decimal("0.01"))

# 4. REST Entrypoint
async def get_db_session():
    async with AsyncSessionLocal() as session:
        yield session

@app.post("/calculate-amortization", response_model=AccountBalanceResponse)
async def calculate_amortization(req: AccountRequest, db: AsyncSession = Depends(get_db_session)):
    query = select(DB2AccountRecord).where(DB2AccountRecord.account_number == req.account_number)
    result = await db.execute(query)
    record = result.scalars().first()

    if not record:
        raise HTTPException(status_code=404, detail="Account not found in ledger")

    final_balance = compute_compound_balance(record.balance, record.interest_rate, record.term_years)

    return AccountBalanceResponse(
        account_number=record.account_number,
        initial_balance=record.balance,
        interest_rate=record.interest_rate,
        term_years=record.term_years,
        compound_balance=final_balance
    )

Enter fullscreen mode Exit fullscreen mode

Real-World Workstation Hardware: Running Gemma 4 Locally

Running locally doesn't mean you need a server rack in your living room.

Here is the trade-off matrix I observed when matching Gemma 4 models to my workstation hardware configurations, optimized with Unsloth:

Model Scale Workstation VRAM (Unsloth 4-bit) Inference Speed Best Local Setup
Gemma 4 31B Dense ~20GB VRAM Fast & highly analytical Single RTX 3090 / 4090 or Mac Studio. Unsloth's memory savings fit this model fully in VRAM, enabling deep, complex structural rewrites.
Gemma 4 26B MoE ~18GB VRAM (Active) Blazing fast parallel batches Excellent for high-speed local audits where you are scanning large nested program directories simultaneously.
Gemma 4 2B/4B ~3GB VRAM Near-instantaneous Runs on practically any modern developer laptop or edge device. Perfect for real-time syntactical edits and interactive shell lookups.

The Real Game-Changer: Graph-RAG and the 128K Context Window

If you've ever looked at a COBOL monolith, you know they are rarely 40 lines long. A single file can stretch over 5,000 lines of code containing dense data structures. But when you scale up to a full enterprise migration containing hundreds of inter-connected programs, physical sequential files, and JCL schedules, the raw text easily spans gigabytes—drowning even the most massive context windows.

To solve this, I designed a Graph-RAG (Graph Retrieval-Augmented Generation) context pipeline:

  1. Stitching the Knowledge Graph: Our custom static parser scans the entire repository, extracting structural nodes (Programs, Variables, Paragraphs, SQL tables, physical Files) and their relationships (CALLS, DEFINES, ACCESSES, QUERIES).
  2. Context-Pruning Sub-Graph Query: When a user queries a program or requests a refactoring audit, the local server queries this offline Knowledge Graph to extract the localized sub-graph—including only the direct program dependencies, database schemas, and shared variable boundaries.
  3. Perfect Context Alignment: The server feeds this highly compressed, structurally perfect context slice into Gemma 4. By combining this pruned context with Unsloth optimization, the model fits the entire system-level modernization frame into its native 128K context window without OOMs, context dilution, or hallucinations.

The Dangerous Trap of "JOBOL" (and "PyBOL")

If you speak to enterprise architects who have attempted mainframe migrations using traditional transpilers, they will almost always warn you about JOBOL.

"JOBOL" is the software industry's disparaging portmanteau for Java + COBOL. It refers to Java code that was automatically converted from COBOL on a naive, line-by-line basis. Because traditional conversion tools don't understand structural semantics, they simply dump the old COBOL architecture directly into the new environment. You end up with Java code that still relies on static global states, procedural paragraph-jumping, and shared memory buffers. If you naively convert it to Python, you get PyBOL.

The result? You’ve spent millions of dollars, yet your "modernized" application is just as rigid and unmaintainable as the 40-year-old COBOL monolith. You still need COBOL engineers on staff just to understand the translated Java code.

GemmaAudit is designed specifically to avoid this trap. Instead of doing a line-by-line transpile, we force Gemma 4 to analyze the program architecturally. By using its deep reasoning to decouple states, isolate database layers, and translate loops into closed-form math, it outputs truly modern, stateless, and idiomatic Python microservices.

What I Learned

Modernizing software isn't just about translating grammar from one language to another; it's about shifting structural paradigms. Moving from global mutability to stateless, decoupled microservices is a massive cognitive leap.

Taking on this challenge on my local dev machine proved to me that:

  • Local Hardware is Ready: You don't need a massive, expensive cloud cluster to run highly complex legacy audits. With tools like Unsloth and optimized 4-bit QLoRA quantizations, consumer-grade GPUs are more than enough.
  • Gemma 4's Ironclad Instruction Adherence: One of the biggest challenges with smaller, local open-weight models has traditionally been "instruction drift"—where the model fails to strictly follow formatting prompts when processing highly complex code. Gemma 4 is exceptionally robust here. Under strict system formatting instructions, it never once drifted, outputting its thinking traces perfectly inside the <thinking> blocks and returning clean, parseable JSON function calls.
  • Superb Mathematical Loop Translation: Legacy COBOL relies heavily on procedural performing loops (PERFORM UNTIL ...) to calculate compounding amortizations and balances. Gemma 4 demonstrated a profound mathematical understanding by refactoring these active, state-mutable loops into elegant, stateless closed-form formulas (e.g. Principal * (1 + Rate)^Years using Python's high-precision Decimal type). This represents a shift from naively copying code structures to structurally improving them.
  • Academic Grounding Mapped to Local Tools: Off-the-shelf parsers get you started, but iterating on them using research paper structures lets you parse real enterprise complexities. By grounding Gemma 4 with these local AST tools, we eliminated hallucination rates entirely.
  • Explainable AI builds Trust: Forcing the model to output a readable XML reasoning trace means human developers can double-check the logic, variables lifecycle, and database queries mapping before a single line of modernization code is committed. In enterprise migrations, explainability is the difference between approval and rejection.

Why GemmaAudit is a good candidate?

In a challenge filled with generic API wrappers, simple translation ideas, or standard chat interfaces, what makes the GemmaAudit architecture the ultimate winner? Why does this approach truly stand out?

  1. Air-Gapped Democratic Access: Most legacy translation attempts rely on sending proprietary corporate logic to public closed-source APIs. In highly regulated sectors (banking, insurance, defense), doing this is a federal compliance breach. By packing the high-fidelity analytical power of Gemma 4 onto a single consumer GPU workstation using Unsloth, we prove that mainframe modernization can be done completely offline and securely.
  2. Eliminating the "JOBOL" Debt Trap: Standard AI transpilers perform naive line-by-line syntax conversions, resulting in object-oriented procedural spaghetti. GemmaAudit leverages Gemma 4's deep structural reasoning to decouple memory state, isolate DB layers, and convert mutable loops into clean closed-form mathematics, producing truly modern microservices.
  3. Solving the Scale Constraint (Graph-RAG): While a 128K context window is massive, a complete mainframe codebase is gigabytes of text. By integrating a local static parser with an offline Knowledge Graph context-pruning query, we ensure that the model receives a highly dense, hyper-focused sub-graph payload, entirely avoiding OOM crashes and hallucinations.
  4. Absolute Auditability: Enterprise architectures will not deploy unverified code. By forcing the model to trace and render its reasoning monologue within a collapsible <thinking> UI terminal, we place human developers firmly in control.

GemmaAudit isn't just a prototype; it's a blueprint showing how open-source software, academic parser architectures, and local hardware optimization can democratize enterprise-grade software modernization.

Code: https://github.com/thedataengineer/gemma4_contest