Infon Sheaf hypergraph GNN
Tiny (~140 K params, 370 KB FP16) line-graph Sheaf GNN that scores reasoning chains. Two outputs:
- 3-class verdict: SUPPORTS / REFUTES / NOT_ENOUGH_INFO
- Per-edge HΒΉ structural-discrepancy score (used as an anomaly prior by the symbolic reasoner)
Quick start (JavaScript)
npm install @cp500/infon-sheaf-gnn onnxruntime-web
import { SheafGNNModel } from '@cp500/infon-sheaf-gnn';
const model = await SheafGNNModel.fromHub('cp500/infon-sheaf-gnn');
const r = await model.scoreChain([
{ kind: 'connective', polarity: 1, confidence: 0.92,
touchesSource: true, connectsPrev: true },
{ kind: 'connective', polarity: 1, confidence: 0.85,
touchesTarget: true, isLast: true, connectsPrev: true },
]);
console.log(r.verdict); // 'SUPPORTS'
console.log(r.totalDiscrepancy); // small (clean chain)
The JS client source is mirrored under js/ for
self-contained installs.
Architecture
Line-graph Sheaf GNN: each edge becomes a node; message passing flows
forward + backward through per-relation-kind restriction maps. The
Sheaf design types messages by 3-class kind (connective,
terminal, reportive), not by predicate slug β which is what
makes the model transferable across relation vocabularies.
chain β encode 10-d edge features β StalkEncoder β Linear(10, 64)
|
βββ 3 Γ SheafMessageLayer (64) βββ
β β’ per-kind restriction maps β
β β’ forward + backward messages β
β β’ HΒΉ discrepancy per edge β
βββββββββββββββ¬βββββββββββββββββββ
βΌ
ChainVerdictHead (3)
Evaluation
Best-by-val-accuracy checkpoint, trained on the default synthetic chain corpus (n=2000, 5 chain kinds: clean / retracted / anomaly / disconnected / cyclic):
| Metric | Value |
|---|---|
| Best val accuracy | 0.998 |
| Per-kind: clean | 0.995 |
| Per-kind: retracted | 1.000 |
| Per-kind: anomaly | 1.000 |
| Per-kind: disconnected | 1.000 |
| Per-kind: cyclic | 1.000 |
Files
| File | Size | Purpose |
|---|---|---|
onnx/sheaf_gnn.onnx |
~627 KB | FP32 graph |
onnx/sheaf_gnn.fp16.onnx |
~370 KB | FP16 graph (default for browser) |
gnn.pt |
small | PyTorch state dict + config |
meta.json |
tiny | JS client contract |
relation_kinds.json |
tiny | predicateβkind lookup mirror |
js/ |
~30 KB | source of @cp500/infon-sheaf-gnn |
License
Apache 2.0 for both weights and JS code.
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support