Views
No views yet
answerdotai/ModernBERT-large for the
ingestion-model-spec-v1 task in episodic-rs. Produces the
information-bearing subset of a claim candidate; a deterministic
wrapper (available in Python at scripts/ingestion_wrapper.py OR
natively in Rust via
episodic-ingestion-compiler-rust-bundle)
assembles the full JSON.decided recall: 0.833 → 0.917.| Metric | P3 v3 | P4 LDAM |
|---|---|---|
| claim F1 | 0.962 | 0.962 |
| claim precision | 0.962 | 0.962 |
| claim recall | 0.962 | 0.962 |
| schema_validity | 1.000 | 1.000 |
| abstention_accuracy | 0.976 | 0.976 |
| predicate_accuracy_macro | 0.959 | 0.966 |
| span_token_IoU | 0.969 | 0.969 |
| confidence MAE | 0.022 | 0.022 |
| predicate | P3 v3 | P4 LDAM | Δ |
|---|---|---|---|
| has_next_action | 0.860 | 0.907 | +0.047 |
| has_quality_finding | 0.883 | 0.917 | +0.033 |
| has_open_question | 0.949 | 0.959 | +0.010 |
| decided | 0.917 | 0.917 | ± |
| blocked_by | 1.000 | 1.000 | ± |
| created_file | 1.000 | 1.000 | ± |
| ran_command | 0.997 | 0.997 | ± |
| touched_file | 0.986 | 0.986 | ± |
| has_status | 0.982 | 0.982 | ± |
| has_goal | 0.983 | 0.978 | −0.005 |
| has_constraint | 0.990 | 0.979 | −0.011 |
calibrator.joblib.Δ_j ∝ n_j^(-1/4), normalized)1import torch, torch.nn as nn
2from huggingface_hub import hf_hub_download
3from transformers import AutoModel, AutoTokenizer
4import joblib
5
6class IngestionEncoder(nn.Module):
7 def __init__(self, backbone, load_dtype=torch.float32):
8 super().__init__()
9 self.backbone = AutoModel.from_pretrained(backbone, torch_dtype=load_dtype)
10 h = self.backbone.config.hidden_size
11 self.dropout = nn.Dropout(0.1)
12 self.head_claim_present = nn.Linear(h, 1)
13 self.head_predicate = nn.Linear(h, 21)
14 self.head_subject_type = nn.Linear(h, 13)
15 self.head_confidence = nn.Linear(h, 1)
16 self.head_span = nn.Linear(h, 2)
17
18 def forward(self, input_ids, attention_mask):
19 out = self.backbone(input_ids=input_ids, attention_mask=attention_mask)
20 h = out.last_hidden_state
21 pooled = self.dropout(h[:, 0])
22 span_logits = self.head_span(self.dropout(h))
23 s_log, e_log = span_logits.split(1, dim=-1)
24 very_neg = torch.finfo(s_log.dtype).min
25 mask = (attention_mask == 0)
26 return {
27 "claim_logit": self.head_claim_present(pooled).squeeze(-1),
28 "predicate_logits": self.head_predicate(pooled),
29 "subject_type_logits": self.head_subject_type(pooled),
30 "confidence_pred": torch.sigmoid(self.head_confidence(pooled).squeeze(-1)),
31 "span_start_logits": s_log.squeeze(-1).masked_fill(mask, very_neg),
32 "span_end_logits": e_log.squeeze(-1).masked_fill(mask, very_neg),
33 }
34
35ckpt_path = hf_hub_download("Avifenesh/episodic-ingestion-compiler-modernbert-large-span-5000", "best.pt")
36cal_path = hf_hub_download("Avifenesh/episodic-ingestion-compiler-modernbert-large-span-5000", "calibrator.joblib")
37ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
38model = IngestionEncoder(ckpt["backbone"])
39model.load_state_dict(ckpt["state_dict"])
40model.eval()
41tok = AutoTokenizer.from_pretrained(ckpt["backbone"])
42calibrator = joblib.load(cal_path)scripts/ingestion_wrapper.py from the source repo to assemble
spec-v1 claims from the model output.1use ingestion_model::{Bundle, IngestionService, Request, WrapperConfig};
2let bundle = Bundle::load("ingestion_model_v1")?;
3let service = IngestionService::load(bundle, device, WrapperConfig::default())?;
4let resp = service.predict(&Request {
5 text: "Make sure the build stays under 50 MB.".into(),
6 role: Some("user".into()),
7 ..Default::default()
8})?;validated_by, had_outcome,
failed_because, worked_because, decided, blocked_by,
has_next_action, has_status, has_goal. Class E: touched_file,
ran_command, logged_event, has_constraint, has_open_question,
has_quality_finding, reverted_file, deleted_file, created_file,
committed, deployed, incident_observed.objective, command, file, pr, incident,
policy, person, repo, team, service, document, ticket,
thread.has_current_input, has_phase.docs/phase-3-results-2026-05-09.md and
docs/phase-4-results-2026-05-09.md for full methodology.