gliner2.5-ja-modernbert-130m
English | 日本語
A Japanese-specialized GLiNER2.5 model (boundary architecture). A single model performs named entity recognition, text classification, relation extraction and structured (JSON) extraction on Japanese text.
This is an unofficial community model. It is not affiliated with or endorsed by fastino-ai.
- Trained from scratch (no fastino-ai weights): because the encoder is replaced with ModernBERT-Ja, none of the weights released by fastino-ai (such as
fastino/gliner2.5-multi-v1) are used. The encoder starts from the pretrained ModernBERT-Ja-130m weights, and all GLiNER2 task heads start from random initialization and are trained from scratch. - Training code: the trainer of the public GLiNER2 repository (
gliner2==2.1.0) is used without modifying the library itself. A small wrapper script adds Japanese-specific settings: the Sudachi word splitter, schema-augmentation settings, and a fallback for aligning gold spans to Sudachi tokens. - Word splitter: a custom splitter built on Sudachi (SplitMode.C, core dictionary).
- Encoder: ModernBERT-Ja-130m by SB Intuitions.
- Training data: a proprietary Japanese synthetic dataset (not publicly released).
- Model family: 310m (higher accuracy) and 130m (smaller and faster, for CPU / edge). Both are listed in the GLiNER2.5 Japanese collection.
- Demo: try both models in the browser in the GLiNER2.5 Japanese demo Space.
How it works

The animation above follows model.extract(query, schema) for the query 渋谷でリモート可のPythonエンジニア正社員.
Everything here is done by the gliner2 library; this repository only provides the weights and the word splitter settings.
- Word splitting. The
word_splitteryou pass (Sudachi, SplitMode.C) splits the text into words and keeps each word's character offsets. Words are lowercased (Python→python), and a.is appended to the end of the text. - One input sequence. The schema is written as a prompt with marker tokens and joined with the text:
( [P] entities ( [E] 職種/occupation [E] 勤務地/work_location … ) ) [SEP_STRUCT] ( [P] 検索意図/search_intent ( [L] 条件指定検索/criteria_search … ) ) [SEP_TEXT] 渋谷 で リモート 可 の python エンジニア 正 社員 .Each entity label gets an[E]marker, each class label an[L]marker, each relation argument an[R]marker and each structure field a[C]marker. Every item is then split into subwords by the ModernBERT-Ja tokenizer. - One encoder pass. ModernBERT-Ja encodes the schema and the text together in a single forward pass, so the label markers and the text words attend to each other. The vector at each marker becomes the query for that label, and each word is represented by the vector of its first subword.
- Spans. For every label, a boundary head scores each gap between words as a possible start or end of a span. The best start–end pairs (up to 128 per label) are re-scored using the compatibility of the two ends, the words inside the span and the span length. Spans whose probability (sigmoid) reaches
threshold(default 0.5) are kept, and the best non-overlapping set is chosen per label. A separate "no answer" score lets the model return nothing for a label that is not in the text. - Classification. Each
[L]marker vector is turned into one score by a small MLP. Single-label tasks take a softmax over the task's labels and return the best one; multi-label tasks use a sigmoid per label and keep every label at or abovecls_threshold(default 0.5). - Relations and structures reuse the same span machinery. The head and the tail of a relation type are two span queries, and pairs of their candidates are scored by a relation head. In a structure, each field is a span query; with
mode="natural", every candidate of the first (anchor) field starts a record and the other fields are assigned to the records. - Back to the original text. Word positions are mapped back to character offsets, and each answer is cut out of the original text, so it keeps its original form (
Pythonエンジニア, notpythonエンジニア). The results are returned as a Python dict.
Usage
Installation
pip install "gliner2[local]>=2.1,<2.2" "transformers>=5" "sudachipy==0.7.0" "sudachidict-core==20261015"
[local] installs PyTorch and Transformers, which are needed to run the model on your machine. transformers>=5 is required because the tokenizer files were saved with Transformers 5 (Transformers 4 cannot read them). For the same reason, use gliner2 2.1.x (the [local] extra of gliner2 2.0.0 requires Transformers < 5). The model was trained and evaluated with gliner2 2.1.0; with 2.2.0, structured extraction results change slightly.
Checked on CPU with gliner2 2.1.0 (Python 3.10 / 3.12 / 3.13), including an environment that already had Transformers 4 installed before running the line above. The outputs below are from gliner2 2.1.0.
Load the model
Pass word_splitter. Without it, text is split on whitespace and Japanese spans cannot be extracted correctly.
from gliner2 import AutoExtractor
from sudachipy import Dictionary, SplitMode
class SudachiSplitter:
"""Japanese word splitter (same settings as in training: SplitMode.C, core dictionary)."""
def __init__(self):
self.tok = Dictionary(dict="core").tokenizer()
def __call__(self, text, lower=True):
for m in self.tok.tokenize(text, SplitMode.C):
s = m.surface()
if s.strip():
yield (s.lower() if lower else s), m.begin(), m.end()
model = AutoExtractor.from_pretrained("tkhshtsh0917/gliner2.5-ja-modernbert-130m", word_splitter=SudachiSplitter())
Named entity recognition
text = "株式会社青葉ソフトは東京都渋谷区のオフィスで働くPythonエンジニアを募集しています。月給35万円〜、週2日まで在宅勤務できます。"
print(model.extract_entities(text, ["企業/company", "職種/occupation", "勤務地/work_location", "給与/salary"]))
# With label descriptions, confidence scores and character offsets
print(model.extract_entities(
text,
{"職種/occupation": "募集している職種・ポジション名", "給与/salary": "給与の金額表記"},
include_confidence=True,
include_spans=True,
))
Output:
{'entities': {'企業/company': ['株式会社青葉ソフト'], '職種/occupation': ['Pythonエンジニア'], '勤務地/work_location': ['東京都渋谷区'], '給与/salary': ['月給35万円〜']}}
{'entities': {'職種/occupation': [{'text': 'Pythonエンジニア', 'confidence': 0.9999942779541016, 'start': 24, 'end': 35}], '給与/salary': [{'text': '月給35万円〜', 'confidence': 0.964093029499054, 'start': 44, 'end': 51}]}}
Text classification
text = "株式会社青葉ソフトは東京都渋谷区のオフィスで働くPythonエンジニアを募集しています。月給35万円〜、週2日まで在宅勤務できます。"
# Single-label (several tasks at once)
print(model.classify_text(text, {
"リモート可否/remote_option": ["在宅可/remote_ok", "ハイブリッド/hybrid", "出社のみ/onsite_only"],
"経験レベル/experience_level": ["未経験可/entry", "経験者優遇/preferred", "経験必須/required"],
}))
# Multi-label
query = "しぶや ぱいそん 正社員"
print(model.classify_text(query, {
"検索意図/search_intent": {
"labels": ["条件指定検索/criteria_search", "企業名検索/brand_search", "フリーワード検索/keyword_search", "意図不明/ambiguous"],
"multi_label": True,
},
}))
Output:
{'リモート可否/remote_option': 'ハイブリッド/hybrid', '経験レベル/experience_level': '経験者優遇/preferred'}
{'検索意図/search_intent': ['条件指定検索/criteria_search']}
Relation extraction
job = "株式会社みなと警備(本社:横浜市)は常駐警備員を募集しています。勤務地は川崎市です。主な業務は巡回業務で、警備員検定2級が必須です。"
print(model.extract_relations(job, ["採用職種/hiring_for", "本社所在地/headquartered_in", "所在地/located_in", "業務内容/responsible_for", "必須スキル/requires_skill"]))
resume = "佐藤美咲(34歳)は青葉大学を卒業後、北斗システムズでJavaエンジニアとして8年勤務した。保有資格は基本情報技術者。"
print(model.extract_relations(resume, ["学歴/studied_at", "勤務経験/worked_at", "保有資格/has_certification"]))
Output:
{'relation_extraction': {'採用職種/hiring_for': [('株式会社みなと警備', '常駐警備員')], '本社所在地/headquartered_in': [('株式会社みなと警備', '横浜市')], '所在地/located_in': [('株式会社みなと警備', '川崎市')], '業務内容/responsible_for': [('常駐警備員', '巡回業務')], '必須スキル/requires_skill': [('常駐警備員', '警備員検定2級')]}}
{'relation_extraction': {'学歴/studied_at': [('佐藤美咲', '青葉大学')], '勤務経験/worked_at': [('佐藤美咲', '北斗システムズ')], '保有資格/has_certification': [('佐藤美咲', '基本情報技術者')]}}
Structured extraction (JSON)
Declare structures with mode="natural" (the first field is the anchor of each record), as in training. A text can yield several records, and a field with choices returns one of the given values.
job = "職種:介護スタッフ。企業:株式会社ひだまりケア。雇用形態:正社員。給与:月給24万円〜。勤務地:さいたま市。"
schema = model.create_schema()
(schema.structure("求人情報/job_posting", mode="natural")
.field("職種/occupation", dtype="str")
.field("企業/company", dtype="str")
.field("雇用形態/employment_type", dtype="str", choices=["正社員", "契約社員", "パート・アルバイト", "業務委託", "派遣社員"])
.field("給与/salary", dtype="str")
.field("勤務地/work_location", dtype="str"))
print(model.extract(job, schema))
resume = "北斗システムズで営業として5年勤務した後、みらい商事に転職し、現在は営業マネージャーとして3年目です。"
schema = model.create_schema()
(schema.structure("職歴/work_history", mode="natural")
.field("企業/company", dtype="str")
.field("役職/position", dtype="str")
.field("期間/duration", dtype="str"))
print(model.extract(resume, schema))
Output:
{'求人情報/job_posting': [{'職種/occupation': '介護スタッフ', '企業/company': '株式会社ひだまりケア', '雇用形態/employment_type': '正社員', '給与/salary': '月給24万円〜', '勤務地/work_location': 'さいたま市'}]}
{'職歴/work_history': [{'企業/company': '北斗システムズ', '役職/position': '営業', '期間/duration': '5年'}, {'企業/company': 'みらい商事', '役職/position': '営業マネージャー', '期間/duration': '3年目'}]}
When the same posting comes back as several records: with mode="natural", a record is created for each occurrence of the first field (here the occupation) in the text. A job posting that repeats the occupation name can therefore return overlapping records for the same posting. If you know a document has one posting per occupation, merging records whose first field has the same value removes the overlap.
Caveat: if one document has two postings for the same occupation (e.g. a full-time and a part-time care worker), they are merged too. Do not use this for structures where records with the same anchor value can be different records, such as 職歴/work_history.
def merge_records(records):
"""Merge records whose first field (the anchor) has the same value. Empty fields are filled from later records, and lists are combined."""
def text(v):
return v.get("text") if isinstance(v, dict) else v
merged = {}
for rec in records:
key = text(next(iter(rec.values()), None))
if key not in merged:
merged[key] = dict(rec)
continue
m = merged[key]
for k, v in rec.items():
if m.get(k) in (None, "", []):
m[k] = v
elif isinstance(m[k], list) and isinstance(v, list):
seen = {text(x) for x in m[k]}
m[k] = m[k] + [x for x in v if text(x) not in seen]
return list(merged.values())
job = (
"株式会社ひだまりケアは介護スタッフを募集しています。勤務地はさいたま市の特別養護老人ホームです。"
"介護スタッフは入浴介助や食事介助を担当します。雇用形態は正社員で、給与は月給24万円〜です。"
)
schema = model.create_schema()
(schema.structure("求人情報/job_posting", mode="natural")
.field("職種/occupation", dtype="str")
.field("企業/company", dtype="str")
.field("雇用形態/employment_type", dtype="str")
.field("給与/salary", dtype="str")
.field("勤務地/work_location", dtype="str"))
records = model.extract(job, schema)["求人情報/job_posting"]
print(len(records), "->", len(merge_records(records)))
print(merge_records(records))
Output:
2 -> 1
[{'職種/occupation': '介護スタッフ', '企業/company': '株式会社ひだまりケア', '雇用形態/employment_type': '正社員', '給与/salary': '月給24万円〜', '勤務地/work_location': 'さいたま市'}]
Several tasks in one call (search-query understanding)
query = "渋谷でリモート可のPythonエンジニア正社員"
schema = (
model.create_schema()
.entities(["職種/occupation", "勤務地/work_location", "スキル/skill", "雇用形態/employment_type", "勤務形態/work_style"])
.classification("検索意図/search_intent", ["条件指定検索/criteria_search", "企業名検索/brand_search", "フリーワード検索/keyword_search", "意図不明/ambiguous"])
.classification("クエリ複雑度/query_complexity", ["単一条件/single", "掛け合わせ/compound", "文章型/sentence"])
)
print(model.extract(query, schema))
Output:
{'entities': {'職種/occupation': ['Pythonエンジニア'], '勤務地/work_location': ['渋谷'], 'スキル/skill': [], '雇用形態/employment_type': ['正社員'], '勤務形態/work_style': ['リモート可']}, '検索意図/search_intent': '条件指定検索/criteria_search', 'クエリ複雑度/query_complexity': '掛け合わせ/compound'}
Batch processing
queries = ["看護師 札幌 夜勤なし", "トヨタ 期間工", "未経験から始められる事務の仕事を大阪で探しています"]
schema = model.create_schema().entities(["職種/occupation", "勤務地/work_location", "企業/company", "除外条件/exclusion_condition"])
for result in model.batch_extract(queries, schema, batch_size=8):
print(result)
Output:
{'entities': {'職種/occupation': ['看護師'], '勤務地/work_location': ['札幌'], '企業/company': [], '除外条件/exclusion_condition': ['夜勤なし']}}
{'entities': {'職種/occupation': ['期間工'], '勤務地/work_location': [], '企業/company': ['トヨタ'], '除外条件/exclusion_condition': []}}
{'entities': {'職種/occupation': ['事務'], '勤務地/work_location': ['大阪'], '企業/company': [], '除外条件/exclusion_condition': []}}
Tips
- Label names: the model was trained with labels written as
日本語/english(e.g.職種/occupation). Labels in this form work best. - Threshold: every method takes
threshold(default0.5). Lower it to get more candidates, raise it for higher precision. - Confidence and offsets: every method (
extract,extract_entities,extract_relations,classify_text,batch_extract) acceptsinclude_confidence=True(adds confidence scores) andinclude_spans=True(adds character offsets into the original text). - Recommended settings: the default thresholds (
threshold=0.5,cls_threshold=0.5) and labels without descriptions. These were chosen for this model on our held-out development data.
License
This model is released under the Apache License 2.0.
It is fine-tuned from ModernBERT-Ja-130m (Copyright (c) 2025 SB Intuitions), which is released under the MIT License. The original MIT license text is included in this repository as LICENSE.modernbert-ja.
Acknowledgements
- We thank fastino-ai for developing and releasing GLiNER2 / GLiNER2.5, whose library and training code this model is built on.
- We thank SB Intuitions for developing and releasing ModernBERT-Ja, which this model uses as its encoder.
- We thank Works Applications for developing and releasing the Sudachi morphological analyzer and its dictionaries, which this model uses as its word splitter.