Splits the content of one party field of a payment message (SWIFT MT 50K, 59, 50F, 59F) into who (the party's name) and where (its postal address), word by word, in one forward pass, with calibrated probabilities and a routing decision for every word.
It is a discriminative tagger (no text generation): a Gemma 4 backbone with bidirectional attention, a LoRA adapter and two small classification heads.
Trained on synthetic data only. This is a pre-processing component for name screening and geographic screening, not a sanctions screening system.
| Version | What changed | Repository |
|---|---|---|
| v3.1 (this one) | The v3 recipe unchanged, plus 12 000 synthetic training fields with layouts seen in real payments that the v3 generator never produced: a person's name on the last line, after the address; bank fields with the BIC on its own line, //FW / //SC codes and N.A.; unit and building names (OFFICE 1204, CHAMPION TOWER, 17/F ... BUILDING); account numbers without /. |
this one |
| v3 | First public version. | swift-party-tagger-silent-jev-gemma |
Checked on 56 hand-checked fields with layouts from real payments (29 that v3 got wrong and 27 controls; none of them used in training):
| Problem | v3 failed | v3.1 failed |
|---|---|---|
| a person's name on a line after the address reached only the geo agent | 4 of 4 | 0 of 4 |
| a BIC on its own line was glued into the bank name | 5 of 5 | 0 of 5 |
unit or building words (OFFICE, TOWER, PLAZA) became names |
7 of 7 | 0 of 7 |
a legal form with dots (N.A.) split the bank name |
2 of 2 | 1 of 2 |
| control fields | 0 of 27 | 0 of 27 |
Not changed by v3.1 (they need code, not data): two people on adjacent lines become one name entity; account numbers
without / are sent to the agents instead of being dropped; a word cut between two 1/ lines in format F; C/O spelling
variants such as C\O. On the hand-written set v3.1 gets 29 of 30 fields right (v3: 30): in 10969/BERLIN it reads the
postcode as 1096; that field has low confidence and is sent to review.
Many systems flatten structured names and addresses into free text lines (4 × 35 characters in MT messages). Under CBPR+ (from November 2026) payment messages need structured or hybrid postal addresses (at least town and country), and screening works best when names and addresses are checked separately. The model reverses the flattening without assuming any order: the name may come after the address, lines may be cut in the middle of a word, separators may be missing.
Input (content of :50K:; the tag itself is found by a deterministic parser):
BALTIC TIMBER TRADING LTD
C/O ALPHA CORPORATE SERVICES LTD
2 ARCH MAKARIOS III AVE
1065 NICOSIA CYPRUS
Output (shortened; the full JSON also has per-word probabilities, spans and line-break decisions):
{
"name_agent": {
"entities": [
{
"value": "BALTIC TIMBER TRADING LTD",
"type": "organization",
"role": "party"
},
{
"value": "ALPHA CORPORATE SERVICES LTD",
"type": "organization",
"role": "care_of",
"marker": "C/O"
}
],
"identifiers": []
},
"geo_agent": {
"text": "C/O ALPHA CORPORATE SERVICES LTD 2 ARCH MAKARIOS III AVE 1065 NICOSIA CYPRUS",
"iso20022_hint": {
"BldgNb": "2",
"StrtNm": "ARCH MAKARIOS III AVE",
"PstCd": "1065",
"TwnNm": "NICOSIA",
"Ctry": "CY",
"Ctry_written": "CYPRUS"
},
"care_of": [
"C/O ALPHA CORPORATE SERVICES LTD"
]
},
"ignored": [],
"review": false
}
Field 59F with a line code glued to C/O (2/C/O):
1/IVAN SOKOLOV
2/C/O OOO VEKTOR LOGISTIK
2/UL TVERSKAYA 7
3/RU/MOSCOW
{
"name_agent": {
"entities": [
{
"value": "IVAN SOKOLOV",
"type": "person",
"role": "party"
},
{
"value": "OOO VEKTOR LOGISTIK",
"type": "organization",
"role": "care_of",
"marker": "C/O"
}
],
"identifiers": []
},
"geo_agent": {
"text": "C/O OOO VEKTOR LOGISTIK UL TVERSKAYA 7 RU MOSCOW",
"iso20022_hint": {
"StrtNm": "UL TVERSKAYA",
"BldgNb": "7",
"Ctry": "RU",
"TwnNm": "MOSCOW"
},
"care_of": [
"C/O OOO VEKTOR LOGISTIK"
]
},
"ignored": [
"1/",
"2/",
"2/",
"3/"
],
"review": false
}
example_output.json in this repository holds the complete outputs for these and one more field.
| Label | Group | ISO 20022 | Meaning |
|---|---|---|---|
NAME_PERSON |
who: name agent | Nm | name of a person |
NAME_ORG |
who: name agent | Nm | name of an organisation, legal form included (also a department after ATTN) |
STREET |
where: geo agent | StrtNm | street name |
BUILDING |
where: geo agent | BldgNb | building number, also ranges such as 142/144 |
UNIT |
where: geo agent | Room | flat, suite, floor, room |
POSTCODE |
where: geo agent | PstCd | postal code |
TOWN |
where: geo agent | TwnNm | town or city |
REGION |
where: geo agent | CtrySubDvsn | state, province, region |
COUNTRY |
where: geo agent | Ctry | country name or code |
PO_BOX |
where: geo agent | PstBx | post office box |
ACCOUNT |
ignored | – | account line (IBAN, domestic number, //FW...) |
LINE_PREFIX |
ignored | – | 50F/59F line codes 1/ 2/ 3/ ... |
NOISE |
ignored | – | garbage and placeholders only (%@#$, ===, NOTPROVIDED, N/A) |
PARTY_INTRO |
who: name agent | – | word that introduces a party or contact: C/O, ATTN, OBO, FFC, T/A, BENEFICIARY |
PARTY_ID |
who: name agent | Id / CtctDtls | identifier or contact detail of the party: TEL, VAT, BIC, date of birth, passport, reference |
Principle: everything about the party that is not its postal address (name, identifiers, contact details) is who; the postal address is where. Noise is reserved for garbage and placeholders.
1/–8/ line codes). Any other word reaches an agent, even when the model calls it noise (flag kept_by_guard).ambiguous). Thresholds are class-conditional conformal quantiles from calibration data (policy: 0.5% allowed miss rate per class).C/O is sent to both agents (flag care_of), because a screening hit may concern the party or the place. The name agent receives separate entities with roles (party, care_of, attention, on_behalf_of, further_credit, trading_as).review: true and review_reasons.Runs on an NVIDIA GPU (CUDA), Apple silicon (MPS) or, slowly, on the CPU; needs about 10 GB of GPU memory and Python 3.11+.
pip install torch # with CUDA: see pytorch.org
pip install -r requirements.txt
import sys
from huggingface_hub import snapshot_download
path = snapshot_download("msw1410/swift-party-tagger-silent-jev-gemma-v3.1")
sys.path.insert(0, path)
from party_tagger.infer import Predictor
tagger = Predictor(path) # downloads google/gemma-4-E4B-it on first use
out = tagger.predict("BALTIC TIMBER TRADING LTD\nC/O ALPHA CORPORATE SERVICES LTD\n2 ARCH MAKARIOS III AVE\n1065 NICOSIA CYPRUS")
print(out["routing"]["name_agent"]["entities"])
print(out["routing"]["geo_agent"]["iso20022_hint"])
Or from the command line: python predict.py "LINE 1|LINE 2|LINE 3" (| separates lines).
party_tagger/swiftgen.py, party_tagger/corrupt.py): fictional names and addresses from Faker for 32 locales plus hand-written lists (legal forms, street abbreviations, intermediaries such as corporate service providers, hotels and law firms); 5 layouts (natural lines, hard 35-character wrap with words cut at line ends, glued text, F-format with 1/ 2/ 3/ codes, name line + glued address); second parties after C/O, ATTN, OBO, FFC, T/A; identifiers; garbage; 13 kinds of damage (typos, missing spaces, junk inside names, duplicates, truncation...). Labels are computed by the generator, so they are exact. No real payment messages and no real personal data were used.All numbers are on synthetic or hand-written data; expect lower accuracy on real traffic and evaluate on your own data before use.
| Set | Fields | Name / address / noise right in the whole field | Every label right in the whole field | Characters right | Line-break joins right |
|---|---|---|---|---|---|
| Synthetic, training countries | 1000 | 99.8% | 99.1% | 100.0% | 99.9% |
| Synthetic, countries never seen in training (PT, RO) | 1000 | 97.9% | 90.7% | 99.0% | 99.4% |
| Synthetic, harder layouts + damage (typos, junk, missing spaces) | 1000 | 97.8% | 91.3% | 99.7% | 99.6% |
| Hard + damage, unseen countries | 1000 | 96.9% | 87.9% | 99.2% | 99.4% |
| Hand-written fields | 30 | 96.7% | 93.3% | 99.2% | 100.0% |
| Synthetic, layouts added in v3.1 (person after the address, bank fields, unit and building names) | 1000 | 99.0% | 96.7% | 99.8% | 99.9% |
Routing with the default policy (letters and digits; a word sent to both agents counts as received by both):
| Set | Name words reaching the name agent | Address words reaching the geo agent | Content sent to both | Content dropped | Fields with nothing lost |
|---|---|---|---|---|---|
| Synthetic, training countries | 100.0% | 100.0% | 0.1% | 0.0% | 100.0% |
| Synthetic, countries never seen in training (PT, RO) | 100.0% | 100.0% | 1.1% | 0.0% | 99.9% |
| Synthetic, harder layouts + damage (typos, junk, missing spaces) | 100.0% | 100.0% | 1.0% | 0.0% | 99.7% |
| Hard + damage, unseen countries | 100.0% | 99.9% | 1.7% | 0.0% | 99.5% |
| Hand-written fields | 100.0% | 100.0% | 0.0% | 0.0% | 100.0% |
| Synthetic, layouts added in v3.1 (person after the address, bank fields, unit and building names) | 100.0% | 100.0% | 0.4% | 0.0% | 99.8% |
Speed on one NVIDIA GeForce RTX 4080: 99.3 ms per field (median, one at a time), 51.0 fields/s in batches of 32.
ATTN JOHN SMITH and ATTN ACCOUNTS DEPT are on the name side. ISO 20022 keeps a contact person in CtctDtls/Nm and a department in PstlAdr/Dept; this split is about who vs where, not the final ISO mapping.C/O <party>: marker and party go to both agents. CBPR+ has no CareOf element; in a hybrid address it would be an address line.142/5 = building 142, flat 5; 142/144 or 142/144/146 (ascending, at most 6 apart) = one building spanning several numbers; Czech/Slovak 1079/3A = building number.4/–7/ (date and place of birth, customer and national ids) are identifiers, so they are on the name side even when they contain a town.Adapter, heads and code: Apache 2.0. Base model: google/gemma-4-E4B-it by Google, Apache 2.0 (Gemma 4 license); its weights are not included here.
The name: jev stands for the class of Jev-style decision models (one forward pass, calibrated probabilities instead of generated text); silent because the model never writes text. It is not a product of, or endorsed by, any company.
adapter/adapter_model.safetensors 279 MBheads.safetensors 184.7 kBgoogle/gemma-4-E4B-it