Skip to main content

Torch-only inference for grounded infon extraction: paragraph in -> typed, grounded, polarity-aware infons + coreference, multilingual (EN/JA/KO), on a fine-tuned mDeBERTa backbone. No transformers/gliner2 runtime dependency.

Project description

hyper-gliner

Torch-only inference for grounded infon extraction + learned-sparse recall, multilingual (EN/JA/KO), on fine-tuned mDeBERTa + a BERT SPLADE retriever. No transformers / gliner2 runtime dependency — both encoders are vendored and parity-proven, so the package is small enough to ship in an AWS Lambda container image.

from hyper_gliner import InfonExtractor, SpladeRetriever

ex = InfonExtractor.from_pretrained("cp500/infon-extract")        # extraction + polarity + coref
infons = ex.extract("Samsung SDI supplies battery cells to BMW.")  # -> [Infon(...)]
#  Infon(Samsung SDI —supplies→ battery cells)  polarity=affirmed

# the {"anchors","infons","stats"} envelope the ami-world-model pipeline consumes:
doc = ex.extract_doc("...", title="...")        # drop-in for extract_infons_neural

sp = SpladeRetriever.from_pretrained("cp500/infon-extract")        # loads the sparse/ subfolder
terms = sp.encode("electric SUV battery", mode="query")            # {term_id: weight}
doc = ex.extract_doc("...", sparse=sp)          # attaches per-infon splade_terms (recall tags)

What's in the box

Capability Model Role
Extraction mDeBERTa-v3 (fine-tuned) + span_rep + classifier + count explicit grounded infons (subject→predicate→object + polarity)
Polarity 3-way head (affirmed / negated / uncertain) constitutive negation
Coreference Lee-2017 antecedent head resolve anaphora (rewrite-first)
Sparse recall cp500/opensearch-neural-sparse-en-jp-ko (BERT SPLADE) implicit term-level recall (complements extraction)

All weights ship as fp16 in cp500/infon-extract (the sparse model under sparse/).

Dependencies

torch, tokenizers, safetensors, numpy. Optional huggingface_hub (only to download from the Hub; pass a local dir otherwise — e.g. weights baked into a Lambda image).

Design notes

  • Torch-only, parity-proven. The mDeBERTa encoder (disentangled attention) and the BERT SPLADE encoder are reimplemented in pure torch and gated bit-close against the reference (tests/test_parity.py 9.5e-5, tests/test_bert_parity.py 1e-5). The full decode is gated against gliner2 (tests/test_decode_parity.py, exact on EN/JA/KO).
  • CJK grounding. A subword splitter + char-offset grounding make Japanese/Korean ground at 100% (stock GLiNER2 whitespace-splits and fails on spaceless CJK).
  • Precision vs recall, separated. extract() applies an exact-span argmax filter (one canonical type per span, nesting preserved). The SPLADE head supplies the multi-label / implicit recall channel as splade_terms — feeding an inverted index, a SQL splade_terms side-table, and the term↔infon bipartite incidence a Sheaf GNN expands.
  • fp16 only. int8-dynamic was measured to hurt the extraction model (grounding 14→5 spans, and larger on disk because the embedding table stays fp32); fp16 is the shipped artifact.

Consumer contract

extract_doc() returns the same {"anchors","infons","stats"} envelope, with each infon dict carrying subject / predicate / object / polarity(int) / mass{supports,refutes,theta} / span / confidence / relation_type / tense / anchors, so it is a drop-in for the ami-world-model ingest pipeline + Memgraph writer + MCTS/IKL readers. See tests/test_consumer_contract.py.

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyper_gliner-0.1.0.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyper_gliner-0.1.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file hyper_gliner-0.1.0.tar.gz.

File metadata

  • Download URL: hyper_gliner-0.1.0.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for hyper_gliner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b27952a5513f4b4e5857cf0fb74103c64a1ef09d40464322963db1c62fb60a15
MD5 429399be7e09817fafd15978a2fca648
BLAKE2b-256 7c3de7e2338138b45babfa45ea0b8275d0614af91c8097628aa1fbc097798a60

See more details on using hashes here.

File details

Details for the file hyper_gliner-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hyper_gliner-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for hyper_gliner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1eff47456556cd0fb0b31419e9dc5aa030d31e3353d4c5531b9a39394e68c671
MD5 30cd857f7dd26bd71d9a68bf721bc3a2
BLAKE2b-256 a8ba4cf652d3ecd5e9fc540e8cf584fb5c3c09d7c7ce2323ac70e3ba0533f3a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page