--- title: Transaction Encoder — LFM2.5 multi-head + Co-Pilot surfaces emoji: 🪙 colorFrom: gray colorTo: indigo sdk: gradio sdk_version: 6.14.0 app_file: app.py pinned: false --- # Transaction Encoder — One Backbone, Many Surfaces Reference implementation of the multimodal-encoder recipe applied to discrete-feature transaction sequences, demonstrating cross-surface reuse on **the same customer history**. Same recipe as Liquid AI's [LFM2.5-Audio](https://huggingface.co/LiquidAI/LFM2-Audio-1.5B) and [LFM2.5-VL](https://huggingface.co/LiquidAI/LFM2-VL-1.6B): a small per-modality encoder produces continuous embeddings, a projection adapter maps them into the LFM2.5 text backbone's hidden space, and a per-surface LoRA adapts the attention layers. ## What this demo shows Seven tabs over one shared LFM2.5-350M backbone: - **Multi-Head Demo** — the original 4-task-head encoder demo. Live inference on curated customer archetypes: fraud probability, next-merchant prediction, amount-bucket prediction, MCC prediction. - **Cold Start** — a brief self-supervised pretraining stage ("SSL") catches ~5× more fraud at a fixed approval rate on a newly onboarded merchant with almost no labels, while declining fewer good customers. The same connector-pretraining stage LFM2.5-Audio and LFM2.5-VL use. Synthetic-data demonstration with operating-point numbers + figure. - **Why Liquid** — architectural pitch for the encoder-on-frozen-backbone recipe. - **Integration** — build-it-yourself guide. - **Dispute Co-Pilot** — given a customer's transaction history + a dispute complaint, classifies the dispute as likely / ambiguous / unlikely friendly fraud, with per-transaction attribution. - **Collections Co-Pilot** — given a delinquency context, predicts the customer's likely response to each of 4 treatment options (settlement / payment plan / soft-touch / no-offer). - **Fraud Pattern Co-Pilot** — given an upstream-flagged transaction, classifies the attack stage (5-way) AND the underlying type (4-way) in two independent categorical outputs. Each Co-Pilot surface ships its own slim checkpoint (~24 MB) alongside the original multi-head checkpoint (~24 MB), but all four share the LFM2.5-350M base weights — the demonstration that the backbone is the product, and per-surface plumbing rides on top. ## How it works ``` feature_ids (1, 64, 15) ──► TransactionEncoder ──► ProjectionAdapter (per-feature embed, (LayerNorm + MLP, concat, MLP + d_encoder → d_lfm) surface markers) │ ▼ [tx pseudo-tokens, SEP, context tokens] │ ▼ LFM2.5-350M (frozen) + LoRA r=16 │ ▼ ┌─────────────────────┬─────────────────────┐ ▼ ▼ ▼ Probability Head Attribution Head (LM head NOT trained; (3 / K×3 / 5+4 (per-position reasoning rendered per surface) binary) via Python template) ``` ## Scope Reference implementation on synthetic data. Backbone is [LFM2.5-350M](https://huggingface.co/LiquidAI/LFM2.5-350M-Base) (frozen) plus ~6M trainable parameters per surface (encoder + projector + LoRA + heads). Quality numbers reflect synthetic data — they should not be cited as performance on real payment data. ## Cast performance (held-out) - Multi-Head V3 (step 4999): per-head accuracy reported on the test split. - Dispute v7 (step 2000): 5/6 cast band-match, 6/6 attribution top-5 - Collections v3 (step 4500): 5/6 cast band-match - Fraud v1 (step 3000): 6/6 stage AND type at 1.00 confidence ## Read more - [LFM2 technical report (arXiv 2511.23404)](https://arxiv.org/abs/2511.23404) - [LFM2 model weights on Hugging Face](https://huggingface.co/LiquidAI)