Skip to main content
Research period: August 2025 - November 2026 · Research timeline

What this study compares

This study asks whether a transaction-processing pipeline can identify financial events and reconstruct revenue more reliably than simpler classification methods. AMLOK’s TE-327 uses a ModernBERT-395M encoder with hierarchical classification and payment-event linking; five-hop reconciliation then connects the resulting evidence across financial systems. The comparison measures these complete configurations on the same task.
The transaction benchmark uses 125,000 audited bilingual out-of-time transactions. Revenue reconstruction uses the study’s non-fraud business subset, a separate evaluation population. F1 balances precision and recall; higher is better. MAPE measures percentage error; lower is better. The source leaves the zero-shot model unnamed, so that row describes the evaluated baseline without assigning it a model brand. Source: RP-2026-01, reported benchmark results, source section 6 and Figure 1.1. The full table below also includes the aggregator/regex baseline and every reported measure.

Abstract

Reliable financial analysis starts by distinguishing what a transaction means from the way a bank describes it. This paper combines TE-327, a Hierarchical Transaction Encoder with 327 categories, with payment-event linking, windowed cash-flow statistics, and reconciliation across commerce, payment, bank, and accounting records. The classification tree contains 14 macro groups, 45 groups, and 327 leaf categories. The statistical engine produces 12,805 windowed attributes, and the paper defines 79 financial metrics across six dimensions. The reported bilingual transaction benchmark contains 125,000 audited transactions. TE-327 reaches 0.964 macro-group F1, 0.891 leaf-category F1, and 0.988 F1 for linking failed payments to their fees and reversals. The combined reconciliation pipeline reports 1.9% revenue mean absolute percentage error on the study’s non-fraud business subset. The sections below explain the method, reproduce every benchmark column, and provide all 79 metric expressions. Source: RP-2026-01, abstract and sections 2-6.

The problem

A short bank description can hide a supplier payment, a transfer between the borrower’s own accounts, loan proceeds, or genuine sales. English and Quebec French abbreviations make those distinctions harder. A failed payment can also produce three ledger entries: the attempted principal, its reversal, and a fee. Counting all three as separate failures exaggerates payment stress. Calendar boundaries create another problem. Payments on January 31 and February 1 are close together, even though a linear calculation of the day-of-month numbers makes them look far apart. The method therefore keeps economic classification, event identity, calendar timing, and accounting corroboration as separate steps.

Hierarchical bilingual classification

TE-327 uses a ModernBERT-395M encoder. Instead of treating all 327 categories as unrelated labels, it predicts a path through the classification tree. A leaf probability is the product of the probabilities along that path. An uncertain macro prediction becomes unknown.unclassified. A supported macro with an uncertain group produces macro_only; a supported group with an uncertain leaf produces group_only, with a null category. These uncertainty states preserve the supported parent without inventing an unspecified leaf. This preserves uncertainty instead of forcing an unsupported detailed classification.
1.1 - Category probabilities and abstentionP(cL3∣xj,sj)=P(gL1∣hj)P(gL2∣gL1,hj)P(cL3∣gL2,hj)c^j={unknown.unclassified,max⁡P(gL1)<τ1NULL (macro only),max⁡P(gL2∣g^L1)<τ2NULL (group only),max⁡P(c∣g^L2)<τ3arg⁡max⁡c∈g^L2P(c∣g^L2),otherwise\begin{aligned} P(c_{L3}\mid x_j,s_j)&=P(g_{L1}\mid\mathbf h_j)P(g_{L2}\mid g_{L1},\mathbf h_j)P(c_{L3}\mid g_{L2},\mathbf h_j)\\ \widehat c_j&=\begin{cases} \text{unknown.unclassified},&\max P(g_{L1})<\tau_1\\ \text{NULL (macro only)},&\max P(g_{L2}\mid\widehat g_{L1})<\tau_2\\ \text{NULL (group only)},&\max P(c\mid\widehat g_{L2})<\tau_3\\ \arg\max_{c\in\widehat g_{L2}}P(c\mid\widehat g_{L2}),&\text{otherwise} \end{cases} \end{aligned}x_j is a transaction, s_j its surface, and h_j its encoded representation. The thresholds control whether the model has enough confidence to publish the relevant level of detail. Choose each parent by its highest posterior within the supported preceding parent, using a stable key order to break ties. Thresholds tau_1, tau_2, and tau_3 are explicit classifier-version inputs in [0,1]. Return the supported parent IDs and uncertainty status alongside a null leaf. The complete parent/child map defines the 45 stable group IDs and preserves all 327 category keys.Source: RP-2026-01, equation 1.1.

Learning from bilingual and cross-system evidence

The teacher-student objective combines classification at all three levels, payment-rail classification, teacher-logit matching, bilingual counterparty alignment, and payment-event linking. The source uses a Qwen2.5-72B teacher with journal and lender-schedule context. Counterparty contrastive learning brings English and French descriptions of the same entity closer together in representation space.
1.2 - Multi-task classification objectiveLTE=∑ℓ=13LCE(y(ℓ),p^(ℓ))+αrailLCE(yrail,p^rail)+βKLτ2DKL ⁣(σ(ztch/τ)∥σ(zstu/τ))+γconLSupCon+λptrLPtrLSupCon=−∑j∈B1∣P(j)∣∑p∈P(j)ln⁡exp⁡((h~j⋅h~p)/τc)∑a∈B, a≠jexp⁡((h~j⋅h~a)/τc)\begin{aligned} \mathcal L_{\mathrm{TE}}={}&\sum_{\ell=1}^{3}\mathcal L_{\mathrm{CE}}(y^{(\ell)},\widehat p^{(\ell)}) +\alpha_{\mathrm{rail}}\mathcal L_{\mathrm{CE}}(y_{\mathrm{rail}},\widehat p_{\mathrm{rail}})\\ &+\beta_{\mathrm{KL}}\tau^2D_{\mathrm{KL}}\!\left(\sigma(z^{\mathrm{tch}}/\tau)\parallel\sigma(z^{\mathrm{stu}}/\tau)\right) +\gamma_{\mathrm{con}}\mathcal L_{\mathrm{SupCon}}+\lambda_{\mathrm{ptr}}\mathcal L_{\mathrm{Ptr}}\\ \mathcal L_{\mathrm{SupCon}}={}&-\sum_{j\in\mathcal B}\frac1{|\mathcal P(j)|}\sum_{p\in\mathcal P(j)} \ln\frac{\exp((\widetilde{\mathbf h}_j\cdot\widetilde{\mathbf h}_p)/\tau_c)} {\sum_{a\in\mathcal B,\,a\ne j}\exp((\widetilde{\mathbf h}_j\cdot\widetilde{\mathbf h}_a)/\tau_c)} \end{aligned}Cross-entropy rewards the correct category. KL divergence transfers the teacher distribution. The contrastive term uses positive counterparty pairs P(j) within a batch B; the pointer term learns which ledger entries belong to the same payment event. The Greek coefficients weight these objectives.Source: RP-2026-01, equation 1.2.

One failed payment, one event

The pointer searches for a failed principal within three Payments Canada business days before or after the associated fee. A null candidate allows the model to leave a fee unmatched. The principal, reversal, and fee form one tuple. Returned-payment amount sums the distinct principals, while fee outflows remain a separate cash-flow measure.
1.3 - Principal, fee, and reversal linkingPptr(p∣f)=softmax⁡p∈W±3d(f)∪{∅}(hf⊤Wptrhp)nsf_event_count⁡(W)=∣BundledTuples⁡(pfailed,rrev,ffee)∣\begin{aligned} P_{\mathrm{ptr}}(p\mid f)&=\operatorname{softmax}_{p\in\mathcal W_{\pm3d}(f)\cup\{\varnothing\}} \left(\mathbf h_f^\top\mathbf W_{\mathrm{ptr}}\mathbf h_p\right)\\ \operatorname{nsf\_event\_count}(W)&=\left|\operatorname{BundledTuples}(p_{\mathrm{failed}},r_{\mathrm{rev}},f_{\mathrm{fee}})\right| \end{aligned}The bilinear score measures whether a principal and fee belong together. W is the observation window. The event count is the number of bundled failures, rather than the number of ledger lines.Source: RP-2026-01, equation 1.3.

Cash-flow statistics and liquidity

All metric expressions use research-financial-v2. Signed operating cash effects include refunds, chargebacks, supported recoveries, and reversals once. A net processor deposit is counted as cash once; embedded fees and refunds are not deducted again. Free cash flow subtracts supported cash CapEx, excluding securities, deposits, and loans advanced. Revenue exclusions affect only the same supported revenue records in which the excluded amounts were included. Events are sorted once in chronological order. Sparse category slices then use compressed-sparse-row indexing, prefix sums, and Welford second moments. Sorting costs O(M log M) for M events; the subsequent sketch pass is linear. The source reports 7,044 bank-cash-flow attributes and 5,761 card-activity attributes across seven windows and ten statistics, with a 4.8 ms sketch runtime per borrower under its benchmark conditions.
1.4 - Prefix sums and stable varianceS1,k=S1,k−1+xk,xˉk=xˉk−1+(xk−xˉk−1)/k,M2,k=M2,k−1+(xk−xˉk−1)(xk−xˉk),n=b−a,xˉ(a,b]=(bxˉb−axˉa)/n,Δab=anb(xˉa−xˉ(a,b])2,σ(a,b]=M2,b−M2,a−Δabn−1,n≥2.\begin{aligned} S_{1,k}&=S_{1,k-1}+x_k,\quad \bar x_k=\bar x_{k-1}+(x_k-\bar x_{k-1})/k,\\ M_{2,k}&=M_{2,k-1}+(x_k-\bar x_{k-1})(x_k-\bar x_k),\\ n&=b-a,\quad \bar x_{(a,b]}=(b\bar x_b-a\bar x_a)/n,\\ \Delta_{ab}&=\frac{an}{b}(\bar x_a-\bar x_{(a,b]})^2,\\ \sigma_{(a,b]}&=\sqrt{\frac{M_{2,b}-M_{2,a}-\Delta_{ab}}{n-1}},\quad n\ge2. \end{aligned}Initialize S_1,0 = M_2,0 = mean_0 = 0. For a = 0, set Delta_ab = 0. The displayed subtraction is the inverse of combining two centered-moment states. In floating-point arithmetic, clamp a negative residual moment to zero only when its magnitude is at most 1e-12 * max(1, abs(M_2,b), abs(M_2,a), abs(Delta_ab)); a larger negative residual requires recomputing the interval from its observations or returning a numerical-error state. Do not silently take the square root of a materially negative value. Two supported observations are the minimum for sample SD.The prefix sum supports window totals without rescanning every event. Welford accumulation keeps variance numerically stable. The source uses Delta_ab for the correction needed when subtracting prefix second moments to recover a window variance.Source: RP-2026-01, equation 1.4.

Consolidated cash and account-level overdrafts

A business can have one overdrawn account while its total balance remains positive. negative_balance_days tests the sum across assessed accounts. overdraft_days tests whether any assessed account is negative, counting each calendar day once. Cash shocks compare the consolidated balance with the preceding 60-day median and median absolute deviation. Freeze the positive median at the episode start. Recovery requires completing five consecutive covered days at or above 90% of that frozen reference.
1.5 - Negative balances, shocks, and recoverynegative_balance_days⁡(W)=∑d∈WI ⁣(∑a∈ABa,d<0)overdraft_days⁡(W)=∑d∈WI ⁣(min⁡a∈ABa,d<0)Bref,k=Med⁡(Bdstart,k−60: dstart,k−1)>0,Bshock(d)=max⁡ ⁣(Bfloor,Med⁡60pre(B)−2.5MAD⁡60pre(B)),drec,k=min⁡{d≥dstart,k+4: ∀u∈[d−4,d], Bu≥0.9Bref,k ∧ mu=1}\begin{aligned} \operatorname{negative\_balance\_days}(W)&=\sum_{d\in W}\mathbb I\!\left(\sum_{a\in\mathcal A}B_{a,d}<0\right)\\ \operatorname{overdraft\_days}(W)&=\sum_{d\in W}\mathbb I\!\left(\min_{a\in\mathcal A}B_{a,d}<0\right)\\ B_{\mathrm{ref},k}&=\operatorname{Med}(B_{d_{\mathrm{start},k}-60:\,d_{\mathrm{start},k}-1})>0,\\ B_{\mathrm{shock}}(d)&=\max\!\left(B_{\mathrm{floor}},\operatorname{Med}_{60\mathrm{pre}}(B)-2.5\operatorname{MAD}_{60\mathrm{pre}}(B)\right),\\ d_{\mathrm{rec},k}&=\min\{d\ge d_{\mathrm{start},k}+4:\ \forall u\in[d-4,d],\ B_u\ge0.9B_{\mathrm{ref},k}\ \land\ m_u=1\} \end{aligned}B_a,d is the closing balance for account a on day d. The floor is the declared balance threshold. The recovery date is the fifth qualifying covered day. There is at most one open episode; missing days interrupt the run. Require 60 consecutive covered pre-start balances, and carry episode state across requested windows. The reference stays frozen during a prolonged shortfall. An unrecovered excursion remains open at assessment and has a null recovery duration. The versioned domain policies govern counts and unsupported histories.Source: RP-2026-01, equation 1.5.

Receipt timing around a month boundary

Circular statistics treat the end and start of a month as adjacent. The source example compares January 31 and February 1: linear day-of-month standard deviation is 15.0 days, while its circular calculation is 0.54 days. This measure describes timing regularity; it does not change receipt amounts.
1.6 - Circular receipt cadenceθk=2πDayOfMonth⁡(tk)DaysInMonth⁡(tk)Rˉ=(1N∑k=1Ncos⁡θk)2+(1N∑k=1Nsin⁡θk)2receipt_day_of_month_stddev⁡=30.43752π−2ln⁡Rˉ\begin{aligned} \theta_k&=2\pi\frac{\operatorname{DayOfMonth}(t_k)}{\operatorname{DaysInMonth}(t_k)}\\ \bar R&=\sqrt{\left(\frac1N\sum_{k=1}^{N}\cos\theta_k\right)^2+ \left(\frac1N\sum_{k=1}^{N}\sin\theta_k\right)^2}\\ \operatorname{receipt\_day\_of\_month\_stddev}&=\frac{30.4375}{2\pi}\sqrt{-2\ln\bar R} \end{aligned}Each receipt date becomes an angle. R-bar measures how tightly those angles cluster. The last expression converts circular dispersion back to an equivalent number of days. Publish it only with at least three distinct supported receipt dates and R-bar > 1e-12; a zero resultant has unbounded dispersion and returns NULL_UNBOUNDED. Clip roundoff to [0,1] only within 1e-12; larger violations are errors. The two-date example illustrates geometry and does not meet the publication minimum.Source: RP-2026-01, equation 1.6.

Five-hop reconciliation and financial statements

Gross card or marketplace sales do not equal the bank deposit. Refunds, merchant fees, reserve movements, and settlement delay explain the difference. The expected settlement applies a zero-to-five-business-day lag distribution, then matches candidate payouts to bank deposits by both date and amount. Jonker-Volgenant bipartite assignment supplies the pairwise matches. The five relationships are order_payment, payment_payout, payout_bank, invoice_bank, and bank_journal. They are related matching problems, rather than a requirement that every transaction passes through a single linear chain. The statistical catalog also identifies 43 cross-system attributes.
1.7 - Expected settlement and matching costD^t(P→B)=∑δ=05κδ(St−δ(P)−Rt−δ(P)−ft−δ(P)−ΔHt−δ(P))min⁡Xpb∈{0,1}∑p=1Mp∑b=1MbXpb[λt∣ΔdCA(tp,tb)−δ^∣+λa∣Db−D^p∣max⁡(D^p,ε)]+ψunm∑p=1Mp(1−∑b=1MbXpb)\begin{aligned} \widehat D_t^{(P\to B)}&=\sum_{\delta=0}^{5}\kappa_\delta \left(S_{t-\delta}^{(P)}-R_{t-\delta}^{(P)}-f_{t-\delta}^{(P)}-\Delta H_{t-\delta}^{(P)}\right)\\ \min_{X_{pb}\in\{0,1\}}\quad&\sum_{p=1}^{M_p}\sum_{b=1}^{M_b}X_{pb} \left[\lambda_t|\Delta d_{\mathrm{CA}}(t_p,t_b)-\widehat\delta| +\lambda_a\frac{|D_b-\widehat D_p|}{\max(\widehat D_p,\varepsilon)}\right]\\ &+\psi_{\mathrm{unm}}\sum_{p=1}^{M_p}\left(1-\sum_{b=1}^{M_b}X_{pb}\right) \end{aligned}The binary assignment satisfies∑bXpb≤1∀p,∑pXpb≤1∀b,Xpb=0 for unsupported candidate pairs.\sum_b X_{pb}\le1\quad\forall p,\qquad \sum_p X_{pb}\le1\quad\forall b,\qquad X_{pb}=0\text{ for unsupported candidate pairs}.Payout and deposit IDs identify distinct settled batches. Split or merged settlements must first be represented as supported disjoint bundles; an original cash record can belong to at most one bundle in this assignment. Otherwise use an explicitly capacity-constrained amount-allocation model and report that separate configuration. Do not reuse a receipt to match two payouts. Require nonnegative lag weights summing to one, positive candidate expected deposits, and nonnegative penalty coefficients. Negative settlements use a separately typed debit matching problem.S, R, f, and Delta H represent sales, refunds, fees, and reserve changes. kappa is the lag weight. The matching objective penalizes date mismatch, relative amount mismatch, and unmatched payouts; assignment constraints prevent duplicate matching.Source: RP-2026-01, equation 1.7.
GIFI/GAAP statement spreading keeps accrual measures distinct from cash movements. EBITDA adds stated depreciation and amortization to operating profit. The method does not automatically add back discretionary expenses. Free cash flow deducts cash capital expenditure, while the balance-sheet discrepancy tests whether assets equal liabilities plus equity.
1.8 - Accrual and cash-flow identitiesebitda⁡=EBIT⁡GIFI+Depr⁡stmt+Amort⁡stmtfree_cash_flow⁡=operating_net_cash_flow⁡−CapEx⁡cashΔBS=∣A−(L+E)∣\begin{aligned} \operatorname{ebitda}&=\operatorname{EBIT}_{\mathrm{GIFI}}+\operatorname{Depr}_{\mathrm{stmt}}+\operatorname{Amort}_{\mathrm{stmt}}\\ \operatorname{free\_cash\_flow}&=\operatorname{operating\_net\_cash\_flow}-\operatorname{CapEx}_{\mathrm{cash}}\\ \Delta_{\mathrm{BS}}&=|A-(L+E)| \end{aligned}A, L, and E are assets, liabilities, and equity. These identities keep supported statement entries and observed cash transactions traceable to their respective sources.Source: RP-2026-01, equation 1.8.

Reported benchmark results

The classification results use the paper’s 125,000 audited bilingual transactions from the out-of-time evaluation. F1 ranges from zero to one and combines precision and recall; higher is better. Revenue MAPE is a separate reconciliation result on the stated non-fraud business subset; lower is better. Throughput uses the benchmark’s different API and GPU execution conditions and should be read with those conditions. The source additionally reports 91.2% recall for manual journal stuffing in the reconciliation study and 51.4% category coverage for the aggregator proxy. These describe the source study and its proxy configuration. RP-2026-01, abstract, section 1, and Figure 1.1.

Metric definitions (79)

These definitions retain the source notation and its scope. W is the observation window; t_0 is the assessment time; I(condition) is one when the condition holds and zero otherwise. Div+ denotes the catalog division operation with a supported positive denominator. Missing evidence or an unsupported denominator does not establish a zero. Currency expressions use a consistent reporting currency. Source: RP-2026-01, metric-definition table.

Cash flow

total_inflowsScope and unit: business, person [currency].
total_outflowsScope and unit: business, person [currency].
net_cash_flowScope and unit: business, person [currency].
operating_cash_inflowsScope and unit: business, person [currency].
operating_cash_outflowsScope and unit: business, person [currency].
operating_net_cash_flowScope and unit: business, person [currency].
internal_transfer_inflowsScope and unit: business, person [currency].
financing_inflowsScope and unit: business, person [currency].
positive_cashflow_month_shareScope and unit: business, person [ratio].
cashflow_volatilityScope and unit: business, person [ratio].
cashflow_change_90dScope and unit: business, person [ratio].
posted_transaction_countScope and unit: business [count].
operating_receipt_countScope and unit: business [count].
owner_contribution_inflowsScope and unit: business [currency].
owner_distribution_outflowsScope and unit: business [currency].
debt_proceeds_inflowsScope and unit: business [currency].
observed_debt_serviceScope and unit: business [currency].
bank_fee_outflowsScope and unit: business [currency].
cash_withdrawal_outflowsScope and unit: business [currency].
payroll_outflowsScope and unit: business [currency].
inventory_purchase_outflowsScope and unit: business [currency].
internal_transfer_outflowsScope and unit: business [currency].
spending_to_receipts_ratioScope and unit: business [ratio].
spending_to_receipts_change_90dScope and unit: business [ratio].

Liquidity

unrestricted_cashScope and unit: business, person [currency].
average_daily_balanceScope and unit: business, person [currency].
minimum_daily_balanceScope and unit: business, person [currency].
negative_balance_daysScope and unit: business, person [days].
cash_buffer_daysScope and unit: business, person [days].
current_ratioScope and unit: business [ratio].
quick_ratioScope and unit: business [ratio].
cash_ratioScope and unit: business [ratio].
balance_stddevScope and unit: business [currency].
balance_coefficient_of_variationScope and unit: business [ratio].
maximum_daily_balanceScope and unit: business [currency].
median_daily_balanceScope and unit: business [currency].
low_balance_daysScope and unit: business [days].
balance_change_90dScope and unit: business [currency].
cash_shock_countScope and unit: business [count].
balance_recovery_daysScope and unit: business [days].
unrecovered_cash_shock_countScope and unit: business [count].

Revenue quality

verified_revenueScope and unit: business [currency].
recurring_revenue_shareScope and unit: business [ratio].
revenue_growth_yoyScope and unit: business [ratio].
revenue_growth_90dScope and unit: business [ratio].
revenue_volatilityScope and unit: business [ratio].
refund_amount_shareScope and unit: business [ratio].
chargeback_amount_shareScope and unit: business [ratio].
revenue_cash_realizationScope and unit: business [ratio].
unverified_receipts_shareScope and unit: business [ratio].
nonrecurring_revenue_shareScope and unit: business [ratio].
receipt_gap_mean_daysScope and unit: business [days].
receipt_gap_stddev_daysScope and unit: business [days].
receipt_day_of_month_stddevScope and unit: business [days].
zero_revenue_month_countScope and unit: business [count].
operating_receipts_volatilityScope and unit: business [ratio].
operating_receipts_change_90dScope and unit: business [ratio].
days_since_last_operating_receiptScope and unit: business [days].
unclassified_receipt_shareScope and unit: business [ratio].

Profitability

gross_profitScope and unit: business [currency].
gross_marginScope and unit: business [ratio].
ebitdaScope and unit: business [currency].
ebitda_marginScope and unit: business [ratio].
operating_profitScope and unit: business [currency].
operating_marginScope and unit: business [ratio].
net_profitScope and unit: business [currency].
net_marginScope and unit: business [ratio].
free_cash_flowScope and unit: business [currency].
return_on_assetsScope and unit: business [ratio].

Payment behavior

nsf_event_countScope and unit: business, person [count].
overdraft_daysScope and unit: business, person [days].
returned_payment_amountScope and unit: business, person [currency].
delinquent_obligation_countScope and unit: business, person [count].
maximum_days_past_dueScope and unit: business, person [days].
on_time_payment_shareScope and unit: business, person [ratio].

Financial reporting quality

bank_accounting_match_shareScope and unit: business [ratio].
statement_balance_discrepancyScope and unit: business [currency].
material_adjustment_shareScope and unit: business [ratio].
books_closing_lag_daysScope and unit: business [days].

Supporting material