Initial release of SauerkrautLM-GLiNEREL-128m
Browse files- .gitattributes +27 -0
- LICENSE +71 -0
- README.md +125 -0
- SauerkrautLM-GLiNEREL-128m-glinerel-fast.png +3 -0
- SauerkrautLM-GLiNEREL-128m-llm-reasoning.png +3 -0
- SauerkrautLM-GLiNEREL-128m-overview.png +3 -0
- SauerkrautLM-GLiNEREL-128m-pdf-graph.png +3 -0
- SauerkrautLM-GLiNEREL-128m-pruning.png +3 -0
- SauerkrautLM-GLiNEREL-128m-relation-benchmarks.png +3 -0
- SauerkrautLM-GLiNEREL-128m-speed-compile.png +3 -0
- SauerkrautLM-GLiNEREL-128m-speed.png +3 -0
- SauerkrautLM-GLiNEREL-128m-test-multilingual.png +3 -0
- SauerkrautLM-GLiNEREL-german-ner.png +3 -0
- SauerkrautLM-GLiNEREL-german-relations.png +3 -0
- SauerkrautLM-GLiNEREL-llm-cost-tokens.png +3 -0
- config.json +131 -0
- encoder_config/config.json +63 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,30 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
glinerel-128m-comparison.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
glinerel-128m-llm-reasoning.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
glinerel-128m-relation-benchmarks.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
glinerel-128m-speed.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
glinerel-german-ner.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
glinerel-german-relations.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
glinerel-llm-cost-tokens.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
glinerel-128m-glinerel-fast.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
glinerel-128m-pruning.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
glinerel-128m-test-multilingual.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
glinerel-pdf-graph.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
glinerel-128m-speed-compile.png filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
glinerel-128m-gpu-h100.png filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
glinerel-128m-pdf-graph.png filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
glinerel-128m-overview.png filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
SauerkrautLM-GLiNEREL-128m-glinerel-fast.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
SauerkrautLM-GLiNEREL-128m-llm-reasoning.png filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
SauerkrautLM-GLiNEREL-128m-overview.png filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
SauerkrautLM-GLiNEREL-128m-pdf-graph.png filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
SauerkrautLM-GLiNEREL-128m-pruning.png filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
SauerkrautLM-GLiNEREL-128m-relation-benchmarks.png filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
SauerkrautLM-GLiNEREL-128m-speed-compile.png filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
SauerkrautLM-GLiNEREL-128m-speed.png filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
SauerkrautLM-GLiNEREL-128m-test-multilingual.png filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
SauerkrautLM-GLiNEREL-german-ner.png filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
SauerkrautLM-GLiNEREL-german-relations.png filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
SauerkrautLM-GLiNEREL-llm-cost-tokens.png filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LFM Open License v1.0
|
| 2 |
+
|
| 3 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 4 |
+
|
| 5 |
+
1. Definitions.
|
| 6 |
+
|
| 7 |
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this document.
|
| 8 |
+
|
| 9 |
+
"Licensor" shall mean Liquid AI, Inc.
|
| 10 |
+
|
| 11 |
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
| 12 |
+
|
| 13 |
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
| 14 |
+
|
| 15 |
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
| 16 |
+
|
| 17 |
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
| 18 |
+
|
| 19 |
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
|
| 20 |
+
|
| 21 |
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
| 22 |
+
|
| 23 |
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
| 24 |
+
|
| 25 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
| 26 |
+
|
| 27 |
+
"Commercial Use" shall mean any use of the Work for direct or indirect commercial advantage or monetary compensation.
|
| 28 |
+
|
| 29 |
+
"Qualified Non-Profit Organization" shall mean a Legal Entity that is organized and operated exclusively for religious, charitable, scientific, testing for public safety, literary, or educational purposes, and which is exempt from federal income tax under Section 501(c)(3) of the United States Internal Revenue Code of 1986, as amended, or any equivalent non-profit or charitable organization in a foreign jurisdiction.
|
| 30 |
+
|
| 31 |
+
"Non-Commercial or Research Purposes" shall mean purposes that do not involve any use of the Work or a Derivative Work for Commercial Use.
|
| 32 |
+
|
| 33 |
+
"Threshold" shall mean annual revenue of 10 million United States dollars ($10,000,000) or more.
|
| 34 |
+
|
| 35 |
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
| 36 |
+
|
| 37 |
+
3. Grant of Patent License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
| 38 |
+
|
| 39 |
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
| 40 |
+
|
| 41 |
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
| 42 |
+
|
| 43 |
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
| 44 |
+
|
| 45 |
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
| 46 |
+
|
| 47 |
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
| 48 |
+
|
| 49 |
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
| 50 |
+
|
| 51 |
+
5. Commercial Use Limitation.
|
| 52 |
+
|
| 53 |
+
(a) The rights granted under this License for Commercial Use are conditioned upon You or Your Legal Entity not exceeding the Threshold.
|
| 54 |
+
|
| 55 |
+
(b) Any Commercial Use of the Work or a Derivative Work by a Legal Entity that exceeds the Threshold is not licensed under this Agreement.
|
| 56 |
+
|
| 57 |
+
(c) The Threshold shall not apply to a Qualified Non-Profit Organization's use of the Work or a Derivative Work for Non-Commercial or Research Purposes.
|
| 58 |
+
|
| 59 |
+
6. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
| 60 |
+
|
| 61 |
+
7. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except for the reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
| 62 |
+
|
| 63 |
+
8. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
| 64 |
+
|
| 65 |
+
9. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
| 66 |
+
|
| 67 |
+
10. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
| 68 |
+
|
| 69 |
+
11. Termination. This License will terminate automatically and immediately if You fail to comply with any of its terms and conditions. Upon termination, You must cease all use of the Work and any Derivative Works and delete all copies in Your possession.
|
| 70 |
+
|
| 71 |
+
END OF TERMS AND CONDITIONS
|
README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: VAGOsolutions/SauerkrautLM-GLiNEREL-314m
|
| 3 |
+
license: other
|
| 4 |
+
license_name: lfm1.0
|
| 5 |
+
license_link: LICENSE
|
| 6 |
+
pipeline_tag: token-classification
|
| 7 |
+
library_name: glinerel-fast
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
- de
|
| 11 |
+
- fr
|
| 12 |
+
- it
|
| 13 |
+
- es
|
| 14 |
+
tags:
|
| 15 |
+
- glinerel
|
| 16 |
+
- sauerkrautlm
|
| 17 |
+
- named-entity-recognition
|
| 18 |
+
- relation-extraction
|
| 19 |
+
- information-extraction
|
| 20 |
+
- pii-detection
|
| 21 |
+
- pruning
|
| 22 |
+
- knowledge-distillation
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# SauerkrautLM-GLiNEREL-128m
|
| 26 |
+
|
| 27 |
+
Joint named-entity recognition, PII detection and relation extraction in one encoder pass. **It turns a 33-page PDF into a knowledge graph in 0.36 s on a GPU, where a 4B generative model needs 17.6 s for a single paragraph.** Labels are free text, chosen at inference time. English, German, French, Italian, Spanish. **[Try it in the demo →](https://huggingface.co/spaces/VAGOsolutions/SauerkrautLM-GLiNEREL-Knowledge-Graph)**
|
| 28 |
+
|
| 29 |
+
| | |
|
| 30 |
+
|---|---|
|
| 31 |
+
| Parameters | 127.9M (256 MB) |
|
| 32 |
+
| Origin | pruned + distilled from [SauerkrautLM-GLiNEREL-314m](https://huggingface.co/VAGOsolutions/SauerkrautLM-GLiNEREL-314m): 41% of the parameters, 98% of the score |
|
| 33 |
+
| Overall score (4 relation benchmarks) | 65.2 |
|
| 34 |
+
| Latency per text | 2.73 ms NVIDIA H100 (fp16) · 37.9 ms CPU (Apple M3 Pro, 4.1× faster than the reference) |
|
| 35 |
+
| License | [LFM Open License v1.0](./LICENSE) |
|
| 36 |
+
| Demo | [SauerkrautLM-GLiNEREL Interactive Knowledge Graph](https://huggingface.co/spaces/VAGOsolutions/SauerkrautLM-GLiNEREL-Knowledge-Graph): PDF → knowledge graph, text extraction, benchmarks |
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
|
| 40 |
+
**Try it:** [SauerkrautLM-GLiNEREL Interactive Knowledge Graph](https://huggingface.co/spaces/VAGOsolutions/SauerkrautLM-GLiNEREL-Knowledge-Graph): upload a PDF, explore the graph and export it as JSON, CSV, GraphML or Cypher (Neo4j).
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
|
| 44 |
+
## Quickstart: glinerel-fast
|
| 45 |
+
|
| 46 |
+
[`glinerel-fast`](https://pypi.org/project/glinerel-fast/) is our new inference library for SauerkrautLM-GLiNEREL, written for CPUs: about 1,600 lines of plain PyTorch, no `transformers`; also runs on NVIDIA and Apple GPUs.
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
pip install -U glinerel-fast # private repo: hf auth login
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
from glinerel_fast import GLiNERel
|
| 54 |
+
|
| 55 |
+
model = GLiNERel.from_pretrained("VAGOsolutions/SauerkrautLM-GLiNEREL-128m") # device="cuda", precision="bf16" on GPUs
|
| 56 |
+
result = model.extract(
|
| 57 |
+
"Marie Curie was born in Warsaw. She married Pierre Curie, a professor at the University of Paris.",
|
| 58 |
+
entities=["person", "location", "organization"],
|
| 59 |
+
relations=["born in", "spouse", "works for"],
|
| 60 |
+
)
|
| 61 |
+
# {"entities": [{label, text, start, end, score}, ...], "relations": [{label, head, tail, score}, ...]}
|
| 62 |
+
|
| 63 |
+
model.redact("Call Laura Bianchi at +39 347 555 0192.", ["first name", "last name", "phone number"])
|
| 64 |
+
# 'Call [FIRST_NAME] [LAST_NAME] at [PHONE_NUMBER].'
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### What makes it fast
|
| 68 |
+
|
| 69 |
+
- **Packed batches:** the tokens of all texts are concatenated without padding; only attention sees a padded view.
|
| 70 |
+
- **Fused matrices:** q/k/v and the SwiGLU gate/up projections are one matrix product each; the LFM2 short convolutions run as three shifted multiply-adds that never cross text boundaries.
|
| 71 |
+
- **No 4-D intermediate in span scoring:** the FiLM layer is rewritten algebraically, so the texts × labels × spans × width tensor is never built.
|
| 72 |
+
- **Cache-sized CPU batches:** texts sorted by length, at most ~2,048 tokens per batch so activations stay in the CPU cache; tokenized words and label prompts are cached.
|
| 73 |
+
- **Inference-only weights:** training heads are dropped at load time, no `transformers` model is built.
|
| 74 |
+
- **GPU (0.1.1):** span selection on the GPU, an asynchronous pipeline and CUDA graphs for small batches: about 3 ms per text on an H100.
|
| 75 |
+
- **Same predictions:** in fp32 the output matches the reference implementation exactly (agreement F1 1.000).
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
|
| 79 |
+
## Pruning
|
| 80 |
+
|
| 81 |
+
Structured width pruning of SauerkrautLM-GLiNEREL-314m (narrower residual stream and feed-forward layers, factorized token embedding; all 14 layers and all attention heads kept), followed by knowledge distillation from SauerkrautLM-GLiNEREL-314m.
|
| 82 |
+
|
| 83 |
+

|
| 84 |
+
|
| 85 |
+
## Speed
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
*One German document (1,065 characters), against gliner2.5 and 4B generative models.*
|
| 91 |
+
|
| 92 |
+
## Results
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
*Development splits, zero-shot, against gliner2.5, gliner-relex, GPT-6 Luna and Qwen3.8-27B.*
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
|
| 99 |
+

|
| 100 |
+
*German relations (RED^FM test split).*
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
*German entities (RED^FM and MobIE test splits).*
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
*Tokens, latency and cost of the LLM baselines.*
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
*LLM baselines with reasoning and four prompts (600-record subset).*
|
| 110 |
+
|
| 111 |
+
Thresholds are chosen per benchmark; LLMs get the same label sets with one fixed instruction at temperature 0.
|
| 112 |
+
|
| 113 |
+
## Citation
|
| 114 |
+
|
| 115 |
+
```bibtex
|
| 116 |
+
@misc{sauerkrautlm_glinerel_2026,
|
| 117 |
+
title={SauerkrautLM-GLiNEREL: Joint Entity, PII and Relation Extraction in One Encoder Pass},
|
| 118 |
+
author={Michele Montebovi and Hakim Bedhief},
|
| 119 |
+
organization={VAGO Solutions},
|
| 120 |
+
url={https://huggingface.co/VAGOsolutions/SauerkrautLM-GLiNEREL-128m},
|
| 121 |
+
year={2026}
|
| 122 |
+
}
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
Family: [SauerkrautLM-GLiNEREL-314m](https://huggingface.co/VAGOsolutions/SauerkrautLM-GLiNEREL-314m) · [SauerkrautLM-GLiNEREL-128m](https://huggingface.co/VAGOsolutions/SauerkrautLM-GLiNEREL-128m) · [SauerkrautLM-GLiNEREL-72m](https://huggingface.co/VAGOsolutions/SauerkrautLM-GLiNEREL-72m)
|
SauerkrautLM-GLiNEREL-128m-glinerel-fast.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-llm-reasoning.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-overview.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-pdf-graph.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-pruning.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-relation-benchmarks.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-speed-compile.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-speed.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-128m-test-multilingual.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-german-ner.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-german-relations.png
ADDED
|
Git LFS Details
|
SauerkrautLM-GLiNEREL-llm-cost-tokens.png
ADDED
|
Git LFS Details
|
config.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architecture": "boundary",
|
| 3 |
+
"architecture_version": 1,
|
| 4 |
+
"architectures": [
|
| 5 |
+
"PostExtractor"
|
| 6 |
+
],
|
| 7 |
+
"attn_implementation": "flash_attention_2",
|
| 8 |
+
"boundary_head": {
|
| 9 |
+
"abstention_loss_weight": 0.2,
|
| 10 |
+
"abstention_threshold": 0.5,
|
| 11 |
+
"adaptive_threshold": false,
|
| 12 |
+
"bidirectional_proposals": true,
|
| 13 |
+
"boundary_attention_heads": 4,
|
| 14 |
+
"boundary_attention_layers": 2,
|
| 15 |
+
"boundary_attention_window": 128,
|
| 16 |
+
"boundary_dim": 128,
|
| 17 |
+
"boundary_ffn_multiplier": 2.0,
|
| 18 |
+
"boundary_focal_clip": 0.05,
|
| 19 |
+
"boundary_focal_gamma_negative": 2.0,
|
| 20 |
+
"boundary_focal_gamma_positive": 0.0,
|
| 21 |
+
"boundary_marginal_loss": "asymmetric_focal",
|
| 22 |
+
"boundary_negative_weight": 0.5,
|
| 23 |
+
"boundary_refinement_layers": 1,
|
| 24 |
+
"boundary_top_k_alpha": 0.08,
|
| 25 |
+
"boundary_top_k_bucket": 8,
|
| 26 |
+
"boundary_top_k_max": 128,
|
| 27 |
+
"candidate_attention_heads": 4,
|
| 28 |
+
"candidate_attention_layers": 0,
|
| 29 |
+
"candidate_budget": 192,
|
| 30 |
+
"candidate_pool": "shared",
|
| 31 |
+
"classification_loss_weight": 1.0,
|
| 32 |
+
"classification_temperature": 1.0,
|
| 33 |
+
"consistency_loss_weight": 0.1,
|
| 34 |
+
"consistency_warmup_steps": 0,
|
| 35 |
+
"content_dim": 64,
|
| 36 |
+
"content_soft_max_pool": false,
|
| 37 |
+
"count_loss_weight": 0.2,
|
| 38 |
+
"directional_relation_states": true,
|
| 39 |
+
"dropout": 0.1,
|
| 40 |
+
"enable_abstention": true,
|
| 41 |
+
"enable_count_head": true,
|
| 42 |
+
"enable_records": true,
|
| 43 |
+
"enable_relations": true,
|
| 44 |
+
"enable_rotary_endpoints": true,
|
| 45 |
+
"enable_span_content": true,
|
| 46 |
+
"end_block_size": 256,
|
| 47 |
+
"end_top_k": 24,
|
| 48 |
+
"endpoint_difference_features": true,
|
| 49 |
+
"ends_per_start": 12,
|
| 50 |
+
"export_mode": "auto",
|
| 51 |
+
"hard_negative_keep_all_when_absent": true,
|
| 52 |
+
"hard_negatives_per_positive": 20,
|
| 53 |
+
"loss_reduction": "sum",
|
| 54 |
+
"max_gold_per_query": 64,
|
| 55 |
+
"max_negative_queries_per_batch": 64,
|
| 56 |
+
"min_pool_per_query": 8,
|
| 57 |
+
"minimum_hard_negatives": 16,
|
| 58 |
+
"multihead_pair_compat_heads": 8,
|
| 59 |
+
"negative_query_ratio": 1.0,
|
| 60 |
+
"overlap_policy": "flat",
|
| 61 |
+
"pair_dim": 128,
|
| 62 |
+
"pair_reader": true,
|
| 63 |
+
"pair_reader_fresh_layers": 2,
|
| 64 |
+
"pair_reader_layers": 4,
|
| 65 |
+
"pair_reader_mode": "pretrained",
|
| 66 |
+
"pair_reader_score": "sum",
|
| 67 |
+
"pair_reader_top_m": 64,
|
| 68 |
+
"pair_reader_train_top_m": 16,
|
| 69 |
+
"pair_reader_typed": true,
|
| 70 |
+
"pair_temperature": 1.0,
|
| 71 |
+
"pool_boundary_top_k": 64,
|
| 72 |
+
"pool_size": 768,
|
| 73 |
+
"proposal_loss_weight": 0.3,
|
| 74 |
+
"query_attention_layers": 0,
|
| 75 |
+
"query_conditioned_inside_weight": true,
|
| 76 |
+
"record_anchor_proposal_threshold": 0.2,
|
| 77 |
+
"record_anchor_threshold": 0.5,
|
| 78 |
+
"record_dim": 128,
|
| 79 |
+
"record_field_threshold": 0.5,
|
| 80 |
+
"record_instance_queries": 32,
|
| 81 |
+
"record_loss_weight": 1.0,
|
| 82 |
+
"record_temperature": 1.0,
|
| 83 |
+
"relation_argument_evidence": false,
|
| 84 |
+
"relation_argument_proposal_threshold": 0.2,
|
| 85 |
+
"relation_biaffine_content": true,
|
| 86 |
+
"relation_distance_normalization": "per_example",
|
| 87 |
+
"relation_extra_same_head_tails": 2,
|
| 88 |
+
"relation_extra_siblings_max": 4,
|
| 89 |
+
"relation_extra_siblings_min": 2,
|
| 90 |
+
"relation_heads_per_type": 32,
|
| 91 |
+
"relation_loss_weight": 1.0,
|
| 92 |
+
"relation_max_bag_mention_pairs": 16,
|
| 93 |
+
"relation_pair_cap": 64,
|
| 94 |
+
"relation_tails_per_type": 32,
|
| 95 |
+
"relation_target_mode": "p2",
|
| 96 |
+
"relation_temperature": 1.0,
|
| 97 |
+
"relation_training_extras": true,
|
| 98 |
+
"rerank_listwise_weight": 0.3,
|
| 99 |
+
"reranker_endpoint_compat": true,
|
| 100 |
+
"rotary_base": 10000.0,
|
| 101 |
+
"soft_iou_anneal_steps": 1000000000,
|
| 102 |
+
"soft_iou_aux_weight": 0.001541758080713741,
|
| 103 |
+
"start_top_k": 24,
|
| 104 |
+
"starts_per_end": 12,
|
| 105 |
+
"training_candidate_budget": 192,
|
| 106 |
+
"use_inside_evidence": true,
|
| 107 |
+
"vectorized_pair_elements": 16777216
|
| 108 |
+
},
|
| 109 |
+
"compressed_embedding": {
|
| 110 |
+
"dedicated": 4096,
|
| 111 |
+
"kind": "factorized",
|
| 112 |
+
"rank": 128
|
| 113 |
+
},
|
| 114 |
+
"config_version": 3,
|
| 115 |
+
"encoder_options": {
|
| 116 |
+
"add_bos_token": true,
|
| 117 |
+
"lowercase_words": false,
|
| 118 |
+
"word_prefix_space": true
|
| 119 |
+
},
|
| 120 |
+
"encoder_revision": "0b649ad0c684378b03d4d8304f7577a662ab89bc",
|
| 121 |
+
"ffn_widths": null,
|
| 122 |
+
"fusion_ffn": 1024,
|
| 123 |
+
"fusion_layers": 2,
|
| 124 |
+
"max_len": 4096,
|
| 125 |
+
"model_name": "LiquidAI/LFM2.5-Encoder-230M",
|
| 126 |
+
"model_type": "extractor",
|
| 127 |
+
"pool_max_width": null,
|
| 128 |
+
"reader_own_layers": true,
|
| 129 |
+
"token_pooling": "first",
|
| 130 |
+
"transformers_version": "5.17.0"
|
| 131 |
+
}
|
encoder_config/config.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Lfm2BidirectionalForMaskedLM"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoModel": "modeling_lfm2_bidirectional.Lfm2BidirectionalModel",
|
| 7 |
+
"AutoModelForMaskedLM": "modeling_lfm2_bidirectional.Lfm2BidirectionalForMaskedLM"
|
| 8 |
+
},
|
| 9 |
+
"block_auto_adjust_ff_dim": false,
|
| 10 |
+
"block_dim": 768,
|
| 11 |
+
"block_ffn_dim_multiplier": 1.0,
|
| 12 |
+
"block_mlp_init_scale": 1.0,
|
| 13 |
+
"block_multiple_of": 256,
|
| 14 |
+
"block_norm_eps": 1e-05,
|
| 15 |
+
"block_out_init_scale": 1.0,
|
| 16 |
+
"block_use_swiglu": true,
|
| 17 |
+
"block_use_xavier_init": true,
|
| 18 |
+
"bos_token_id": 1,
|
| 19 |
+
"conv_L_cache": 3,
|
| 20 |
+
"conv_bias": false,
|
| 21 |
+
"conv_dim": 768,
|
| 22 |
+
"conv_use_xavier_init": true,
|
| 23 |
+
"dtype": "float32",
|
| 24 |
+
"eos_token_id": 7,
|
| 25 |
+
"full_attn_idxs": null,
|
| 26 |
+
"head_dim": 64,
|
| 27 |
+
"hidden_size": 768,
|
| 28 |
+
"initializer_range": 0.02,
|
| 29 |
+
"intermediate_size": 1280,
|
| 30 |
+
"layer_types": [
|
| 31 |
+
"conv",
|
| 32 |
+
"conv",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"conv",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"conv",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"conv",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"conv",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"conv",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"conv"
|
| 45 |
+
],
|
| 46 |
+
"max_position_embeddings": 128000,
|
| 47 |
+
"model_type": "lfm2",
|
| 48 |
+
"norm_eps": 1e-05,
|
| 49 |
+
"num_attention_heads": 16,
|
| 50 |
+
"num_heads": 16,
|
| 51 |
+
"num_hidden_layers": 14,
|
| 52 |
+
"num_key_value_heads": 8,
|
| 53 |
+
"pad_token_id": 0,
|
| 54 |
+
"rope_parameters": {
|
| 55 |
+
"rope_theta": 1000000.0,
|
| 56 |
+
"rope_type": "default"
|
| 57 |
+
},
|
| 58 |
+
"tie_word_embeddings": true,
|
| 59 |
+
"transformers_version": "5.17.0",
|
| 60 |
+
"use_cache": false,
|
| 61 |
+
"use_pos_enc": true,
|
| 62 |
+
"vocab_size": 65536
|
| 63 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da27b34c52c7f3bc2f0ba93d76c2b7d0019d002485f765c5273a10f53aae89dc
|
| 3 |
+
size 256472504
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|