Skip to content

Extraction Tiers

Waspada AI uses a two-tier extraction system that balances speed, accuracy, and resource usage.

Tier 1: Regex Engine (Deterministic)

Always available. Zero model download required.

The regex engine runs instantly and handles the majority of Malaysian financial document patterns:

PatternExampleRegex
Malaysian NRIC880101-14-5678\d{6}-\d{2}-\d{4}
Bank Account (8-17 digits)1234567890\d{8,17}
SWIFT/BIC CodeMBBEMYKL[A-Z]{4}MY[A-Z0-9]{2}
Phone (MY format)+60123456789\+?60\d{9,10}
URLshttps://scam.comStandard URL regex
Transaction AmountRM 1,500.00RM\s*[\d,]+\.?\d*

Supported Banks (BIC Resolution)

BankBIC Code
MaybankMBBEMYKL
CIMBCIBBMYKL
Public BankPBBEMYKL
Hong LeongHLBBMYKL
RHBRHBBMYKL
AmBankAMMBMYKL
Bank IslamBIMBMYKL
Bank RakyatBKRMMYKL
Alliance BankAFBQMYKL
Affin BankARBKMYKL
OCBCOCBCMYKL
UOBUOBBMYKL
HSBCHBMBMYKL
Standard CharteredSCBLMYKX
BSNBSNAMYK1
AgrobankAGOBMYKL
Bank MuamalatMBABOREA
GXBankGXSPMYKL
Touch 'n GoTNGDMYNB

Measured Accuracy (CI gate)

Corpus 2026-07-1137 synthetic Malay receipt layouts (Tier-1 regex).
Gate: precision ≥ 0.90 and recall ≥ 0.85 on account + BIC.

FieldSupportPrecisionRecallF1
mule_account_number29100%100%100%
mule_bank_bic32100%100%100%
scammer_alias35100%100%100%
malicious_urls3100%100%100%

Full extraction metrics write-up (including NER/OCR gate limits and DuitNow QR handling) available on request.

CI gate scope

The gate measures Tier-1 regex on clean labeled text only. It will not fail if the DistilBERT NER model regresses after a dependency bump. Full-pipeline / OCR eval stays on the private corpus until a pinned model artifact is CI-cacheable.

DuitNow QR (no account on the slip)

Many DuitNow QR receipts never show a recipient account number — only a name and sometimes a bank/e-wallet. The eval corpus labels those as mule_account_number: null on purpose. Inventing an account from a DuitNow reference ID is a false positive. Product response: extract alias/BIC when present, keep disposition advisory, and ask the user for a second (account-transfer) slip when possible.

Tier 2: NER Engine (AI-Powered)

Available after background model download (~40MB).

The NER engine uses a quantized DistilBERT model to extract entities that regex cannot reliably identify:

Entity TypeNER LabelMaps To
Person namePERscammer_alias
OrganizationORGmule_bank_bic (via bank name lookup)

When Tier 2 Activates

Tier 2 only runs when Tier 1 results are incomplete:

Regex extracts account + BIC + alias → REGEX_ONLY (skip NER)
Regex extracts account + BIC only   → Run NER for alias → HYBRID
Regex extracts nothing              → Run NER for all  → NER_ENCODER

Performance Optimization

For 95%+ of digital bank receipts, Tier 1 Regex is sufficient. The NER model is only invoked for ambiguous, informal, or handwritten evidence where regex patterns fail.

Extraction Tier Labels

TierMeaningTypical Latency
REGEX_ONLYAll indicators extracted by regex< 10ms
NER_ENCODERNER model used for extraction100-200ms
HYBRIDRegex + NER combined100-200ms

Waspada AI: Enterprise infrastructure powering public defense.