Financial Transaction Categorization at Scale Using LLMs and Custom Embeddings

mercado_libre · Finance · 2025 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: financial transaction enrichment

Mercado Libre needed to categorize and enrich massive volumes of financial transaction data across Latin America, where Open Finance unlocked access to data but country-specific formats, languages, merchant codes, and naming conventions made manual rules brittle and hard to scale.

Constraints:

Architecture

Mercado Libre evolved the enrichment pipeline through three architectures: country-specific regex and MCC rules, GPT-3.5/4o-mini-assisted labeling with human validation, and finally custom BERT-style semantic embeddings trained on regional financial text. The final system runs on MELI infrastructure such as Fury and DataMesh, uses model-agnostic orchestration to integrate improved LLMs, and relies on local semantic categorization to deliver faster, cheaper, near-real-time transaction understanding.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  open-finance-transaction-sources["Open Finance transaction sources"] --> datamesh-and-fury-infrastructure["DataMesh and Fury infrastructure"]
  datamesh-and-fury-infrastructure --> llm-assisted-labeling-workflow["LLM-assisted labeling workflow"]
  llm-assisted-labeling-workflow --> human-validation-loop["Human validation loop"]
  human-validation-loop --> semantic-categorization-engine["Semantic categorization engine"]
  llm-assisted-labeling-workflow --> semantic-categorization-engine
  datamesh-and-fury-infrastructure --> semantic-categorization-engine
  semantic-categorization-engine --> personalization-and-financial-insights["Personalization and financial insights"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Open Finance transaction sources Provide raw financial transaction data voluntarily shared by users through authorized Open Finance systems. DataMesh and Fury infrastructure
DataMesh and Fury infrastructure Hosts the core MELI data and orchestration infrastructure used by enrichment workflows. Open Finance transaction sources, LLM-assisted labeling workflow, Semantic categorization engine
LLM-assisted labeling workflow Uses prompts, batch processing, and LLMs to generate categorization labels for financial transactions. DataMesh and Fury infrastructure, Human validation loop, Semantic categorization engine
Human validation loop Reviews GenAI-generated labels to maintain control, precision, traceability, and data quality. LLM-assisted labeling workflow, Semantic categorization engine
Semantic categorization engine Runs custom BERT-style embeddings trained on regional financial text for low-latency semantic categorization. DataMesh and Fury infrastructure, Personalization and financial insights
Personalization and financial insights Uses enriched categories for personalized financial narratives, credit models, and discrepancy feedback loops. Semantic categorization engine

Data flow

Open Finance transaction data enters MELI's data infrastructure, is transformed by financial data enrichment workflows, receives LLM-assisted and human-validated labels during model development, and is later categorized by custom semantic embeddings that map regionally varied merchant names and transaction text into structured categories for personalization, credit, and financial insight products.

“how we use Large Language Models (LLMs) and custom-trained semantic embeddings to transform Financial Data Enrichment”article, stated
“The Final Architecture with Semantic Embeddings: This new workflow incorporates our custom ‘Semantic Categorization’ engine”article, stated

Why this architecture

MELI moved from rules to LLMs because regex and MCC categories could not handle the region's language and merchant variability. It then distilled LLM knowledge into custom embeddings because external LLM calls were accurate but too costly and slow for hundreds of millions of weekly transactions, while embeddings preserved semantic understanding in a faster local form.

“This approach caused frequent inconsistencies such as classifying a “Posto de Gasolina” (gas station) under “8220-Educational Services”.”article, stated
“LLM APIs were a massive breakthrough, but querying them for hundreds of millions of transactions presents long-term latency and cost challenges.”article, stated

Models used: GPT-3.5 Turbo · GPT-4o-mini · Gemini · Claude · BERT-style semantic embeddings · Fury · DataMesh

Scale

Alternatives considered (roads not taken)

Country-specific regex and MCC rules.

Rejected because: They produced inconsistent categories, required constant local tweaks, and became unsustainable under new data volume.

“The work was titanic, artisanal, expensive — and totally unsustainable given the daily tsunami of new data.”article, stated

Train a specialized corpus from scratch.

Rejected because: The source says that would be expensive and raise privacy concerns at the time.

“training your own specialized corpus (a meticulously labeled financial dataset) would cost a fortune 💰 and raise serious privacy concerns.”article, stated

Rely solely on external LLM APIs.

Rejected because: External LLM calls had latency and cost problems at hundreds-of-millions weekly transaction scale.

“querying them for hundreds of millions of transactions presents long-term latency and cost challenges.”article, stated

Lock the system to one LLM model.

Rejected because: MELI wanted a flexible, model-agnostic design that could incorporate GPT-4o-mini, Gemini, Claude, and future models.

“The fundamental principle of our solution was to build a flexible, model-agnostic architecture.”article, stated

Patterns

human-in-the-loop-gate (financial labeling quality)

MELI combined GenAI-generated categorization decisions with expert validation to preserve control, precision, and traceability.

“The real game-changer wasn’t just using an LLM — it was designing a human-in-the-loop labeling workflow to scale without sacrificing control or quality.”article, stated

fine-tuning-adaptation (domain semantic embeddings)

MELI trained BERT-style embeddings on regional financial text so similar merchants and spending contexts cluster despite language variation.

“At MELI, we developed our own embeddings, fine-tuning BERT-style (Bidirectional Encoder Representations from Transformers) models on regional financial text.”article, stated

cost-aware-routing (LLM-to-embedding optimization)

The architecture uses cheaper, faster embeddings for real-time operation after LLMs helped build the semantic foundation.

“embeddings come in: they distill semantic intelligence into a format that’s much faster and cheaper to operate in real time.”article, stated

data-quality-loop (financial category feedback)

The envisioned system can detect discrepancies between official MCC codes and semantic categories and ask users to confirm feedback.

“This is likely an error from the source. Would you like to confirm and submit this feedback to improve the model?”article, stated

Tradeoffs

Use LLM-assisted human validation before deploying custom embeddings.

Chose GenAI prompts plus expert feedback over Fully automatic LLM labels.

Rationale: Financial categories affect decisions for millions of users, so precision, traceability, ethics, and control mattered.

“combining LLM power with expert human feedback. This ensures precision, traceability, and control in a world where data quality is key to real decisions impacting millions of users”article, stated

Distill LLM intelligence into custom embeddings.

Chose Locally trained semantic embeddings over Querying LLM APIs for every transaction.

Rationale: Embeddings preserved semantic categorization while improving latency and cost for near-real-time usage.

“By distilling the intelligence of LLMs into locally trained financial embeddings, we enabled real-time responses with lower cost and greater semantic precision.”article, stated

Keep the enrichment architecture model-agnostic.

Chose Flexible model-agnostic architecture over One fixed provider/model.

Rationale: The system could adopt GPT-4o-mini and test Gemini/Claude as the AI landscape shifted.

“This design proved its value by allowing us to efficiently integrate new advancements like GPT-4o-mini and experiment with other key players like Gemini and Claude.”article, stated

Gotchas (what bit them)

Manual rules broke on local language and merchant-name variation.

Root cause: Latin American transaction descriptions used different dialects, country conventions, and merchant naming changes.

Resolution: MELI moved toward GenAI and then semantic embeddings trained on regional financial text.

“created a huge barrier to scale due to local language nuances, like ‘birreria’ vs. ‘cervecería’ 🍻.”article, stated

MCC codes could be wildly inaccurate.

Root cause: Merchant category codes were manually reported and did not always reflect the true purchase context.

Resolution: Semantic categorization replaced brittle code/rule reliance with contextual transaction understanding.

“MCC (Merchant Category Codes) which, being manually reported, often led to wildly inaccurate categorizations.”article, stated

External LLM APIs became expensive and latent at scale.

Root cause: The workload grew to hundreds of millions of weekly transactions.

Resolution: MELI distilled semantic intelligence into local embeddings for faster, cheaper real-time operation.

“querying them for hundreds of millions of transactions presents long-term latency and cost challenges.”article, stated

Evaluation

MELI evaluated successive generations by categorization accuracy, operating cost, throughput, and ability to support near-real-time semantic categorization while retaining human validation for financial data quality.

Metrics: Regex baseline accuracy around 60% · GPT-3.5 Turbo accuracy over 80% · 75% operational cost reduction · Custom embedding accuracy 90% · Additional operational cost reduction over 30% · Tens of millions per quarter to tens of millions per week · Near-real-time response capability

“deliver over 80% accuracy with the right setup, far surpassing our regex-based approach (which hovered around 60%).”article, stated
“we boosted our global categorization accuracy from 80% to 90%, and further reduced operational costs by more than 30%.”article, stated

Outcomes

The case reports millions to hundreds of millions of transactions, tens-of-millions weekly throughput, and near-real-time response expectations across LATAM financial data.

“scaled up transaction categorization: from tens of millions per quarter to tens of millions per week.”article, stated
“This solution didn’t just cut operating costs further — it now allows us to respond in near real time (NRT) to millions of transactions”article, stated