Credit Intermediation and Related Activities2023Generative AIB2C
Nubank

Nubank refactors 6M lines of ETL code 8x faster and at 20x lower cost using AI agent Devin

Brazil's Nubank used Cognition's Devin AI agent to migrate a monolithic, 6-million-line ETL system to sub-modules — compressing an 18-month, 1,000-engineer project into weeks for individual business units and delivering 8x engineering efficiency gains and over 20x cost savings.

Engineering Time Efficiency Gain8x
Cost Savings20x+
Task Speed Improvement (after fine-tuning)4x
Lines of Code (ETL monolith)6M+
5 min read

Background

Nubank's 8-year-old ETL monolith had become a bottleneck. With 6M+ lines of code and dependency chains reaching 70 levels deep, the architecture could no longer support the company's growth across three countries. A manual migration involving 1,000+ engineers and 18 months was the only available option before Devin offered an alternative.

What Was Implemented

  • Deployed Cognition's Devin AI software engineer to handle autonomous ETL sub-module migrations
  • Taught Devin the migration pattern through examples of previously manual migrations (fine-tuning)
  • Ran multiple parallel Devin agents on individual data class migration sub-tasks (~100,000 total)
  • Maintained human oversight: a project manager reviewed and approved Devin's pull requests
  • Devin built its own helper scripts to automate the most repetitive mechanical components
  • Benchmark evaluation set confirmed fine-tuning results (2x task completion score, 4x task speed)

Results

Individual business units (Data, Collections, Risk) completed migrations in weeks instead of months or years . Across the migration scope delegated to Devin, the project achieved an 8–12x engineering efficiency gain and over 20x cost savings . After fine-tuning, Devin's task speed improved 4x (from ~40 minutes to ~10 minutes per sub-task) and task completion scores doubled.

Lessons

  • Large-scale, repetitive refactoring tasks with high variation (many edge cases) are well-suited to AI agents: human expertise is needed once to define the pattern, then the agent scales it
  • Fine-tuning an AI agent on domain-specific examples significantly improves performance beyond generic capability — Nubank observed 2x completion scores and 4x speed after fine-tuning
  • Human-in-the-loop review (approving PRs) provides a quality gate without negating efficiency gains
  • AI-agent cost economics are most compelling for tasks combining high volume, high repetition, and scarce human resources

Ready to implement AI in your commerce operations?

McFadyen Digital helps teams move from case study to live implementation.

Talk to an expert →