Every banking test team faces the same tension. Good tests need realistic data: customers with messy names and addresses, accounts with years of transaction history, the odd payment that should trigger a fraud rule. Realistic data has traditionally meant production data, masked or not, and production data in a test environment is exactly what data protection officers and auditors spend their time trying to remove. Masking helps, but masked data is often still personal data under GDPR. Pseudonymised records can be re-identified when combined with other information, so they keep their regulatory weight and their risk.
Large language models look like the obvious way out. Ask a model for a thousand realistic Romanian retail customers with eighteen months of card transactions, and you get something plausible in seconds. Plausible isn't the same as usable, though. Generated balances may not match the transactions behind them. IBANs may fail their checksum. A model may "invent" a name and address that belong to a real person. And there's a temptation to paste a few real records into a prompt "as examples", which defeats the whole purpose.
This article sets out the approach that holds up in practice. LLMs do what they're genuinely good at: realistic text, varied scenarios, unusual patterns. Deterministic Java code owns everything that must be exactly right. SQL checks prove the result is consistent and contains nothing real. And personal data never goes near an external model, not even as an example.
Divide the work by what each tool does well
The most useful design decision is to stop asking one tool to do everything. A synthetic banking dataset has two very different kinds of content.
Structure and arithmetic, where correctness is binary. That covers primary and foreign keys, IBAN check digits, card numbers that pass the Luhn check, balances that equal the sum of their transactions, dates that fall on banking days, and interest calculated to the cent. It also covers volume (millions of rows), reproducibility (the same seed producing the same dataset next month) and exact control of distributions. Rule-based generators do all of this reliably and cheaply. LLMs do it badly, inconsistently and expensively.
Texture and variety, where realism is a matter of degree. That covers names across cultures and alphabets, addresses in the formats different countries actually use, payment references people actually type, merchant names, complaint texts for a support system, and inventive scenarios: the account that's dormant for two years and then suddenly active, the series of transfers kept just under a reporting threshold, the customer with a 70-character surname and three diacritics. This is where LLMs are genuinely better than any template list.
So the architecture is a pipeline. An LLM proposes scenarios and generates pools of textual values. A Java generator, seeded and deterministic, builds the actual records, links them, computes every number and applies the scenarios. Then a set of SQL checks validates the result before anyone uses it.
Rule one: the model never sees a real record
No real customer data goes into a prompt: not as an example, not "just the structure with a few rows", not masked. The model works only from three kinds of input:
The schema: table and field definitions, types, constraints and allowed codes.
Written descriptions of the population you want, such as "30% of retail customers are over 60" or "card spending peaks on Fridays and around salary day".
Aggregate statistics where you need realism in distributions, produced inside the bank's environment and released only after small groups have been suppressed. A count of five customers in one postcode and age band is already too revealing.
That boundary matters legally as well as ethically. Data generated without any personal data as input isn't personal data, so it can move freely between environments, vendors and test teams. Data derived from real records needs a much harder argument to make that claim. Keeping real records out of the pipeline entirely is the simplest way to keep the output out of scope.
There's a second, less obvious risk. Models are trained on public text, and they sometimes reproduce memorised fragments. Ask for "a realistic address in Iași" and you may get a real street and number, sometimes next to a real person's name. The defences are structural. Build names by combining first names and surnames drawn separately from model-generated pools, never as whole name-and-address pairs. Use fictional streets, or a synthetic place list, in combination with real city names. And for anything that leads somewhere, use reserved ranges: email addresses on domains reserved for documentation such as example.com, phone numbers from ranges set aside for fiction, and card numbers from the schemes' test ranges.
The Java generator owns correctness
The generator is ordinary, testable Java. Two examples show where determinism matters most.
Identifiers that validate. An IBAN with the wrong check digits fails at the first validation layer, so tests of anything deeper never run. Computing them correctly is a few lines:
1 static String iban(String countryCode, String bban) {
2 String rearranged = bban + countryCode + "00";
3 StringBuilder digits = new StringBuilder();
4 for (char c : rearranged.toCharArray()) {
5 digits.append(Character.isLetter(c) ? String.valueOf(c - 'A' + 10) : c);
6 }
7 int checkDigits = 98 - new BigInteger(digits.toString())
8 .mod(BigInteger.valueOf(97)).intValue();
9 return countryCode + String.format("%02d", checkDigits) + bban;
10 }
Use bank codes inside the BBAN that are reserved for your test environment, agreed with the team that owns the account ranges. A valid IBAN that happens to belong to a real account elsewhere is exactly the kind of collision a test dataset must never contain.
Balances derived, never generated. The most common flaw in hand-made or model-made test data is a balance that doesn't match its transaction history. The fix is to generate in the right order:
1 Account generateAccount(CustomerProfile profile, RandomGenerator rng) {
2 BigDecimal opening = profile.openingBalance(rng);
3 List history = transactionModel.generate(profile, rng); // salary, rent, card spend…
4 scenarioInjector.apply(profile, history, rng); // labelled unusual payments
5 BigDecimal current = history.stream()
6 .map(Transaction::amount)
7 .reduce(opening, BigDecimal::add);
8 return new Account(nextIban(rng), profile.currency(), opening, current, history);
9 }
Every random choice comes from a seeded RandomGenerator, so a dataset can be rebuilt exactly when a test fails months later. Amounts are BigDecimal throughout. The model's contribution enters as data, never as code: pools of names, merchant descriptions and payment references, and scenario definitions loaded from versioned files.
Where the LLM earns its place: scenarios, not rows
The most valuable thing an LLM contributes isn't a thousand customer rows. It's a hundred well-designed scenarios that a human tester wouldn't have listed. Ask the model, through structured output, for scenario definitions in a fixed format:
1 record PaymentScenario(String id, String description, String customerProfile,
2 List steps, String expectedDetection) {}
A good prompt for fraud and AML testing describes the rule set under test, in plain language and without real thresholds if those are confidential. It then asks for patterns that should and shouldn't trigger each rule, including near-misses. Typical results include money arriving from many unrelated senders and leaving within hours, card-not-present spending from a new device right after a password reset, and a long-dormant account that suddenly makes international transfers. The generator then injects each scenario into synthetic histories with a ground-truth label, so a detection test has something exact to measure against: this account should raise an alert, and this near-miss should not.
Every scenario still goes through human review before it enters the library. A model can describe a "money mule pattern" that's actually indistinguishable from a student receiving rent shares from flatmates. Sometimes that's the point of a near-miss test, but only if someone has consciously labelled it that way.
Where rule-based generators still do better
It's worth being precise about this, because the hype suggests otherwise:
Volume and performance testing. Generating fifty million transactions through a model is slow and costly. A seeded Java generator does it in minutes.
Exact distributions. If a test needs exactly 2% of accounts in arrears and a specific age profile, code delivers that. Prompts deliver an approximation.
Reproducibility. The same seed and code version produce the same dataset every time. The same prompt doesn't.
Regulatory and scheme formats. ISO 20022 messages, card scheme fields and statement formats have exact rules. Templates and validators handle them. A model will produce something that looks right and fails schema validation.
Boundary values. Testing limits at exactly the threshold, one cent below and one cent above is a job for an explicit list, not for a model's creativity.
In practice, the LLM's share of a mature synthetic data platform is small but important: perhaps the text pools and the scenario library, while code produces the overwhelming majority of rows.
SQL checks before anyone uses the data
The last stage is validation, run automatically on every generated dataset, with publication blocked if any check fails. Two examples:
1 -- Every balance must equal opening balance plus all booked transactions
2 SELECT a.account_id
3 FROM test_data.accounts a
4 LEFT JOIN test_data.transactions t USING (account_id)
5 GROUP BY a.account_id, a.opening_balance, a.current_balance
6 HAVING a.opening_balance + COALESCE(SUM(t.amount), 0) <> a.current_balance;
7
8 -- Contact data must stay inside reserved ranges
9 SELECT customer_id, email
10 FROM test_data.customers
11 WHERE email NOT LIKE '%@example.com'
12 AND email NOT LIKE '%@example.org';
Alongside the consistency checks, run one privacy check that only the bank can run. Inside the production environment, the data owner compares hashed combinations of synthetic name, date of birth and postcode against the same hashes of real customer records. Any match is investigated and removed, however unlikely. That check, and its clean result, is the evidence a DPO will want to see before approving synthetic data for wider use: proof that "no real customer" was verified, not assumed.
Governance that makes it stick
A few practices turn this from a project into a capability. Version the generator code, the text pools and the scenario library together, so every dataset is traceable to exactly what produced it. Record which model and prompt produced each pool or scenario, and when. Give scenario libraries an owner in the fraud or financial crime team as well as in QA. And agree the data classification with the DPO once: synthetic data produced by this pipeline, under these controls, can be used in these environments by these teams.
What this adds up to
LLMs make synthetic banking data more realistic in the places where realism was hardest to achieve: language, variety and inventive scenarios. They don't replace the deterministic generator, and they must never become a channel for real customer data. The approach that works keeps a clear division. The model proposes and describes. Java computes and links. SQL proves the result is consistent and contains nothing real. From a testing perspective, that combination finally gives teams data that's realistic enough to find real defects and clean enough that nobody has to argue about whether it should be in a test environment at all.