# Beyond Prompting: How Algorithmic Evolution Doubled our Training Speed

DevFeed: [Beyond Prompting: How Algorithmic Evolution Doubled our Training Speed](<https://devfeed.tech/articles/beyond-prompting-how-algorithmic-evolution-doubled-our-training-speed-35647.md>)

Original publisher: [Read original article](<https://engineering.klarna.com/beyond-prompting-how-algorithmic-evolution-doubled-our-training-speed-8f874af3080d?source=rss----86090d14ab52---4>)

Author: Rex Lin

Published: 2026-03-30T12:47:12Z

Content type: article

Language: en

Sources: [Klarna Engineering](<https://devfeed.tech/sources/klarna-engineering.md>)

Topics: [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [LLM optimization](<https://devfeed.tech/topics/llm-optimization.md>), [model architecture](<https://devfeed.tech/topics/model-architecture.md>), [Distributed Systems & Parallel Computing](<https://devfeed.tech/topics/distributed-systems-parallel-computing.md>), [gradient\_accumulation](<https://devfeed.tech/topics/gradient-accumulation.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [ai-coding-assistant](<https://devfeed.tech/tags/ai-coding-assistant.md>), [artificial-intelligence](<https://devfeed.tech/tags/artificial-intelligence.md>), [attention](<https://devfeed.tech/tags/attention.md>), [candidate](<https://devfeed.tech/tags/candidate.md>), [chatbot](<https://devfeed.tech/tags/chatbot.md>), [code](<https://devfeed.tech/tags/code.md>), [code-comments](<https://devfeed.tech/tags/code-comments.md>), [coding](<https://devfeed.tech/tags/coding.md>), [coding-assistant](<https://devfeed.tech/tags/coding-assistant.md>), [customer](<https://devfeed.tech/tags/customer.md>), [customer-data](<https://devfeed.tech/tags/customer-data.md>), [data](<https://devfeed.tech/tags/data.md>), [data-pipelines](<https://devfeed.tech/tags/data-pipelines.md>), [engineer](<https://devfeed.tech/tags/engineer.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [error](<https://devfeed.tech/tags/error.md>), [evolution](<https://devfeed.tech/tags/evolution.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [prompting](<https://devfeed.tech/tags/prompting.md>), [software-engineering](<https://devfeed.tech/tags/software-engineering.md>), [speed](<https://devfeed.tech/tags/speed.md>), [training](<https://devfeed.tech/tags/training.md>)

## AI overview

Klarna and Google used AlphaEvolve to search code-level training optimizations for a large transformer, defining editable code, a performance metric, and constraints. Across nearly 6,000 candidate programs over three weeks, the reported pipeline improved from 49 to roughly 97 samples per second under deterministic production requirements, while model predictions also improved. AlphaEvolve explored mixed precision and asynchronous transfers, then deeper rewrites: direct scaled dot-product attention kernels and a preallocated contiguous dataset memory stream. A faster result of 143 samples per second depended on nondeterministic hardware shortcuts and was unsuitable for deployment. The account also reports that PASC, a stability mechanism useful at 10,000 samples, was dropped at 100,000, and that upgrading the underlying language model raised the candidate success rate from about two-thirds to 86-97%. The authors stress that constraint design and early stopping matter; the search itself was computationally expensive.

## Source excerpt

By Rex Lin and Valeria Verzi (Klarna Engineering), with Anant Nawalgaria (Google) We knew our training pipeline could be faster -- significantly faster. At Klarna, one of our largest models (a transformer trained on vast streams of payment events and shared like infrastructure across many internal systems) is on a tight training loop. Speed is money at our scale. The opportunity for improvement was not in the hyperparameters, but in the plumbing: the way numbers moved between processors, the way memory was allocated, the way the model performed its most basic mathematical operations. The challenge was scale. An engineer might try five or ten structural rewrites. A particularly ambitious one, armed with an AI coding assistant, might push to a hundred. But the full search space, the universe of possible combinations of precision formats, data pipelines, attention mechanisms, and gradient strategies, numbered in the thousands. We partnered with Google to apply a different kind of tool. Instead of trying to prompt our way to a solution, we handed the problem to AlphaEvolve, which treats code optimization the way evolution treats organisms: generate candidates, test them, keep the fittest, repeat. Over three weeks and nearly 6,000 candidate programs, it doubled our training speed and, unexpectedly, produced a better model in the process. The Machine That Writes Machines AlphaEvolve is not a chatbot for code. You don't interact with it through prompts. Instead, you build a sandbox around it. The engineer's job is to define what can change in the code and what cannot (passing only structural code snippets to the system, never customer data) to specify the metric that matters, and to set the constraints that must never be violated. You write hints in the form of code comments. You craft error messages that help the system learn when it fails. Then you step back. The system takes over from there. It generates a candidate program, runs it, measures the result, scores it. The b