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.2 (this one) | The v3 recipe unchanged, plus 11 946 synthetic training fields: building and park names after a party are address (WANG LEI SIIC BUILDING, MICHELLE SMITH HUAWEI TECHNOLOGIES PARK, AL SAFA BLDG), with counter-examples that stay names (PARKVIEW BUILDING MATERIALS LLC, a person called PARK); the v3.1 bank and unit layouts. The v3.1 layout "person on a line after the address" is removed, because no training field may have an address inside a name. Routing: one owner per word (name or address agent, never both); an unsure word goes to one side and the field to human review. |
this one |
| v3.1 | v3 plus real-life layouts (person after the address, bank fields, units and buildings). | msw1410/swift-party-tagger-silent-jev-gemma-v3.1 |
| v3 | First version. | msw1410/swift-party-tagger-silent-jev-gemma |
Release check: passed (13 of 13 criteria). On the new v3.2 test set (996 synthetic fields) 98.5% of fields are split exactly right (name / address / noise).
Checked on 103 hand-checked fields with layouts from real payments (none used in training). Both columns use the same v3.2 routing code; only the model weights differ:
| Problem | v3 failed | v3.2 failed |
|---|---|---|
| a BIC on its own line was glued into the bank name | 2 of 5 | 0 of 5 |
unit or building words (OFFICE, TOWER, PLAZA) became names |
3 of 7 | 0 of 7 |
a legal form with dots (N.A.) split the bank name |
2 of 2 | 1 of 2 |
| estate / trust / remittance wording split into fragments | 3 of 3 | 2 of 3 |
| two people on adjacent lines became one name | 1 of 3 | 2 of 3 (both sent to review) |
| building or park name after the party, town inside a bank name | 0 of 9 | 0 of 9 |
| control fields | 1 of 58 | 1 of 58 |
| all fields | 14 of 103 | 8 of 103 |
| failed without being sent to review | 5 | 3 |
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": "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": []
},
"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": "UL TVERSKAYA 7 RU MOSCOW",
"iso20022_hint": {
"StrtNm": "UL TVERSKAYA",
"BldgNb": "7",
"Ctry": "RU",
"TwnNm": "MOSCOW"
},
"care_of": []
},
"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 and the field goes to review. Thresholds are class-conditional conformal quantiles from calibration data (policy: 0.5% allowed miss rate per class).entities with roles (party, care_of, attention, on_behalf_of, further_credit, trading_as). A building or place name after the party (XXX BUILDING, a person + XXX PARK) goes to the geo agent; an address word inside a name on one line goes back to the name.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.2")
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.0% | 100.0% | 99.9% |
| Synthetic, countries never seen in training (PT, RO) | 1000 | 97.6% | 90.1% | 98.8% | 99.5% |
| Synthetic, harder layouts + damage (typos, junk, missing spaces) | 1000 | 98.0% | 91.8% | 99.7% | 99.7% |
| Hard + damage, unseen countries | 1000 | 96.0% | 87.1% | 99.0% | 99.5% |
| Hand-written fields | 30 | 100.0% | 96.7% | 99.2% | 100.0% |
| Synthetic, layouts added in v3.2 (building and park names, bank fields, units) | 996 | 98.5% | 95.5% | 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.0% | 0.0% | 99.8% |
| Synthetic, countries never seen in training (PT, RO) | 99.9% | 99.8% | 0.0% | 0.0% | 98.1% |
| Synthetic, harder layouts + damage (typos, junk, missing spaces) | 99.8% | 99.8% | 0.0% | 0.0% | 98.2% |
| Hard + damage, unseen countries | 99.9% | 99.6% | 0.0% | 0.0% | 97.0% |
| Hand-written fields | 100.0% | 100.0% | 0.0% | 0.0% | 100.0% |
| Synthetic, layouts added in v3.2 (building and park names, bank fields, units) | 100.0% | 99.7% | 0.0% | 0.1% | 98.5% |
Speed on one NVIDIA GeForce RTX 4080: 90.8 ms per field (median, one at a time), 56.2 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