shekharp77 commited on
Commit
99da1a4
·
verified ·
1 Parent(s): b0b7e80

Mira-3 v11: adapter + per-epoch + training metrics + eval results + learnings

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ 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
+ adapter/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ epochs/epoch_1/tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ epochs/epoch_2/tokenizer.json filter=lfs diff=lfs merge=lfs -text
39
+ epochs/epoch_3/tokenizer.json filter=lfs diff=lfs merge=lfs -text
MIRA3_LEARNINGS.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Mira-3 Learnings — Building a Specialized Document→JSON Extraction SLM
2
+
3
+ **What this is.** A distilled, reusable playbook from building **Mira-3**: a ~4B, on-prem, fine-tuned small language model that reads a document and returns **structured, source-grounded JSON**. The beachhead is clinical extraction (lab reports, discharge summaries, intake forms → schema JSON), but **every lesson below generalizes to any document→JSON extraction task** — résumé/CV parsing, invoices, receipts, KYC forms, contracts, RFP/compliance docs. Where a lesson is clinical-specific, it's marked; most aren't.
4
+
5
+ Read this before starting a new extraction vertical (e.g. a "Mira-Résumé"). It will save you a training run and an eval that lies to you.
6
+
7
+ > **The one-line lesson:** *A fine-tuned extractor learns the exact surface form of its training data. If your training docs state facts one way and real docs state them another, the model silently fails on real docs — and an in-distribution synthetic eval will score ~1.0 and hide it. Measure on real, out-of-distribution documents, and measure recall, not just validity.*
8
+
9
+ ---
10
+
11
+ ## 0. The stack (what we actually shipped)
12
+
13
+ | Component | Choice | Why |
14
+ |---|---|---|
15
+ | Base model | `Qwen/Qwen3-4B-Instruct-2507` (Unsloth 4-bit: `unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit`) | Strong instruction-following at a size that runs on a customer's single GPU. Open weights (no ToS trap). |
16
+ | Method | **QLoRA** (4-bit base + LoRA r16/α32), Unsloth, sequence packing | ~2× faster + low VRAM; fits a free Kaggle T4. |
17
+ | Trainer | TRL `SFTConfig`/`SFTTrainer`, full-sequence loss, packing on | Proven config; validity 1.0 on in-dist data. |
18
+ | Compute | **Kaggle free T4** (30h/wk), multi-session with lossless resume | Zero infra cost for v0. Paid GPU only for teacher generation. |
19
+ | Data (v0) | **Synthetic + permissively-licensed public only** | No DUA/PHI/copyright risk; retrain on real partner data at v1. |
20
+ | Output contract | JSON Schema with `x-grounding` / `x-match-on` extensions | Schema is a runtime input, not code — lets you onboard a new vertical without a code change. |
21
+
22
+ **Reusable assets in this repo** (paths are the concrete, working versions):
23
+ - Training kernel (resumable): `models/mira-3/notebooks/train_mira3_v11.py` + `RUNBOOK_v11.md`
24
+ - Eval kernel (2-phase, best-epoch): `models/mira-3/notebooks/eval_mira3_v11.py`
25
+ - Offline authoritative scorer: `scripts/mira3/build_v11_gate_scorecard.py`
26
+ - Exit gate: `scripts/mira3/phase25_gate_check.py`
27
+ - Grounding checker (schema-aware): `src/slm/data/_grounding.py`; field-F1: `src/slm/eval/_field_f1.py`
28
+
29
+ ---
30
+
31
+ ## 1. Training recipe that worked
32
+
33
+ - **QLoRA 4-bit + Unsloth + packing**, `max_seq_length` sized to cover ~100% of your token length distribution (we used 3072; a too-small 2048 silently truncated ~10% of rows in an earlier run and degraded quality). **Measure your length distribution first**; truncation is a silent quality leak.
34
+ - LoRA on all attention + MLP projections (`q,k,v,o,gate,up,down`), r=16, α=32, dropout 0.05, lr 2e-4 cosine, warmup 3%, effective batch 16 (2 × grad-accum 8), **3 epochs**.
35
+ - **Loss plateaus fast.** Loss went 1.36 → 0.15 within epoch 1 and only 0.15 → 0.13 across epochs 2–3. Most learning is epoch 1; later epochs are refinement. **Save a per-epoch adapter and pick the best by eval**, don't assume the last epoch is best (see §4).
36
+ - **Chat-template fidelity is non-negotiable.** Train with `apply_chat_template(..., add_generation_prompt=False)` over `[system,user,assistant]`; at inference use `add_generation_prompt=True`. Load the tokenizer **from the saved adapter dir** so the exact template travels with the model. A prompt/template mismatch between train and eval tanks validity for a reason that looks like a model failure.
37
+
38
+ ---
39
+
40
+ ## 2. Training under a hard wall-clock cap (Kaggle 12h) — lossless multi-session resume
41
+
42
+ A full 3-epoch run was ~20h of compute — impossible in one 12h session. The pattern that worked (generalizes to any pre-emptible/capped GPU: spot instances, Colab, CI runners):
43
+
44
+ 1. **Wall-clock callback** forces a full `Trainer` checkpoint + graceful stop at ~10.5h (leave ≥1.5h headroom before the platform kill — the final save + output upload take real time; we lost a run's final adapter once by cutting it to 10.5h with too little margin).
45
+ 2. **Resume = re-run the same kernel with the prior checkpoint mounted** as an input. The `Trainer` restores optimizer + LR schedule + RNG; completion is gated on `global_step >= max_steps` (**not** rounded epoch — a time-stop at epoch 2.99 is *not* "done").
46
+ 3. **Freeze dependency versions to the exact set that wrote the checkpoint** before resuming. A lossless resume requires identical `transformers`/`peft`/`bitsandbytes`/`unsloth` — pin `==`, capture `env_versions.json` in session 1, and pin to those. Ranges drift and break resume.
47
+ 4. **Archive-robust, fail-loud resume.** Upload the checkpoint as one tar with directory structure preserved (`--dir-mode skip`, **never** `--dir-mode zip` — it flattens `checkpoint-XXXX/` and silently restarts from step 0). If a checkpoint is *expected* (a checkpoint dataset is attached) but none is found, **crash** — don't silently burn a session training from scratch.
48
+
49
+ **Bug we hit (watch for it):** a per-epoch adapter saver keyed on `round(state.epoch)` mislabeled a mid-epoch budget-stop at epoch 1.57 as "epoch_2". Guard epoch-boundary saves with `abs(epoch - round(epoch)) < 0.05` so a fractional stop doesn't write a bogus artifact.
50
+
51
+ ---
52
+
53
+ ## 3. Infra/Kaggle gotchas (each cost us time)
54
+
55
+ - **Inline `pip install` at the top of CLI-pushed kernels** — they don't inherit the notebook UI's packages. One pinned command, fail fast (before GPU time).
56
+ - **Split training and eval into separate notebooks.** Never run both in one session (12h timeout). Eval is a separate, shorter GPU session.
57
+ - **`kaggle kernels output` is flaky** — it returns a *different partial subset of files per call*, and the log often needs a second pull. Re-run the pull 2–3× and verify the critical files (metrics, adapters, log) are non-zero before trusting them. A "0-byte final adapter" locally was a download artifact, not a training failure.
58
+ - **Batch (CLI-pushed) kernels don't stream logs.** The whole log publishes only on commit. "No new logs for hours" during a RUNNING batch kernel is normal, not a stall. Status (`RUNNING`/`COMPLETE`) is your only live signal; poll it.
59
+ - **Read adapters across kernels via `kernel_sources`**, not by re-uploading — the eval kernel mounts the training kernel's `/kaggle/working/output` directly.
60
+ - The training output tree may contain a `_resume/` staging dir with **stale copies** of adapters. When discovering adapters, exclude `_resume/` and `checkpoints/` and require `adapter_config.json`, or you may silently score a stale/partial adapter.
61
+
62
+ ---
63
+
64
+ ## 4. Eval methodology — the part that actually determines whether you have a product
65
+
66
+ This is where most of the value is. **Evaluation is harder and more important than training** for extraction models.
67
+
68
+ ### 4a. Mechanics
69
+ - **Best-epoch selection:** score every per-epoch adapter and pick the winner. Load each with the *same* loader the training used (for Unsloth 4-bit adapters, `FastLanguageModel`, **not** vanilla `PeftModel` — quantization mismatch produces garbage).
70
+ - **Two-phase, quota-frugal eval:** Phase A scores all epochs on the labeled set (cheap, decides best epoch first so a timeout still yields it); Phase B runs the full probe suite on the winner only.
71
+ - **In-kernel metrics are for monitoring/ranking; authoritative metrics are computed offline** on the saved raw predictions (schema-aware grounding, macro-F1) with the real library. Save raw predictions in the exact schema your offline loader expects (`extra="forbid"` loaders reject stray keys — we crashed the offline scorer by writing a `gold` key and omitting `gen_time`/`pred_len`).
72
+ - **Adversarially review the eval/train kernel *before* pushing it.** A multi-agent review (independent reviewers per failure-mode: mounts, adapter-loading, prompt fidelity, metric logic, output-format-vs-offline-loader, time-budget) caught 3 real bugs that would each have wasted a ~5h GPU session. Cheap insurance for anything that costs a GPU run.
73
+
74
+ ### 4b. Model-specific output gotcha — the `<think>` prefix
75
+ Qwen3-Instruct emits a leading `<think>...</think>` block (often empty) before the JSON. Our raw validity read **0%** until we stripped it — the JSON was perfect underneath. **Strip the reasoning wrapper before parsing** (and the serving layer must too). Check your base model's default output framing before trusting a "0% valid" result.
76
+
77
+ ### 4c. THE BIG ONE — in-distribution synthetic eval lies
78
+
79
+ Our labeled `test_gold` (synthetic, same generator as training) scored **field-F1 = 1.000, validity = 1.000, 200/200 predictions byte-identical to gold.** This was **not** leakage (0/800 exact overlap, 4.4% template overlap) and the metric was **not** broken (corrupting a field dropped F1 to 0.92). It was real — and **meaningless as a generalization signal.** The synthetic docs have a near-deterministic source→label mapping; the model learned it perfectly. The *previous* model scored 1.0 on it too.
80
+
81
+ **If your held-out set comes from the same generator/distribution as training, a high score tells you the model fit the generator — nothing about the real world.**
82
+
83
+ ### 4d. Build a labeled REAL-doc benchmark (how)
84
+ Real-doc probes (actual clinical transcripts) were **unlabeled**, so we could only measure validity + hallucination, not F1. To get an honest field-F1 we built a small labeled set:
85
+ 1. Select a **diverse** sample (we took 24 real docs, one per specialty/domain).
86
+ 2. **Double-annotate + adjudicate:** two independent annotators produce gold from *source + schema only* (never shown the model's output), then an adjudicator resolves disagreements strictly against the text. (We used LLM annotators + adjudication — a defensible *directional* signal; replace with human gold for certification.)
87
+ 3. Score the model's saved predictions against the adjudicated gold with schema-aware field-F1 (exclude meta fields like `extraction_notes`; coerce malformed list items).
88
+
89
+ ### 4e. What the honest eval revealed (the pattern to expect)
90
+ Real-doc **macro-F1 = 0.61** (vs synthetic 1.0). The shape matters more than the number:
91
+
92
+ - **High precision (0.89–0.98) on every field, but low recall.** The model is *safe* (what it emits is right) but *misses content*.
93
+ - **The blind spot:** it extracted **~0 diagnoses from real narrative notes** (docs with 6–10 explicit diagnoses → output `[]`), and under-extracted procedures (recall 0.33). It nailed list-structured fields (medications, labs, vitals, allergies, encounter date/dept).
94
+
95
+ **Root cause = data, not model.** The synthetic training data only ever presents diagnoses/procedures in **structured `Diagnoses:` blocks with bracketed codes**. Real notes state them in **prose** ("patient has DM type 2, HTN…"). The model learned "extract diagnoses from the Diagnoses: section" and never learned to read narrative. **This is the single most important, most generalizable lesson.**
96
+
97
+ ---
98
+
99
+ ## 5. Data lessons (all generalize)
100
+
101
+ 1. **Structured-vs-narrative coverage is everything.** Whatever field a downstream user cares about, your training data must present it in **every surface form real documents use** — structured lists *and* inline prose, tables *and* sentences. If a form is only ever seen one way in training, the model fails on the other. *This is the recall killer.* (For résumés: a "skill" appears as a bulleted list, a comma-separated line, and buried in a job-description paragraph — train on all three.)
102
+ 2. **Preserve source formatting; don't canonicalize in labels.** Our training labels rendered a lab unit one fixed way (`x10^9/L`) with zero variety, so the model "corrected" the real docs' `10^9/L` to `x10^9/L` — violating "preserve exactly." **Fix: render source values/units in varied equivalent forms and have the label copy the source verbatim.** Teach copying, not canonicalization.
103
+ 3. **Give the verifier principled equivalences.** A correct-unit reformat (`10^9/L ≡ x10^9/L`) is not a hallucination and shouldn't route to a human. Add narrow, meaning-preserving equivalences to the grounding checker (scoped to the right field, so it can never ground a fabricated *value*). Verified precision: it must not "fix" a genuine fabrication (e.g., inventing `Glucose (Fasting)` from `glucose`).
104
+ 4. **Audit your generator empirically.** Run the grounding checker *on your own training labels*: any label value not grounded in its own source is a canonicalization you're teaching. Ours was clean (0.02%) — which is how we learned the unit issue was a *diversity* gap, not a labeling bug. This 5-minute check reframes fixes.
105
+
106
+ ---
107
+
108
+ ## 6. Metrics & acceptance framework (use for any vertical)
109
+
110
+ | Metric | How | Bar | Notes |
111
+ |---|---|---|---|
112
+ | JSON validity | parse to schema-valid object (after stripping any reasoning wrapper) | ≥99% raw, 100% constrained | 100% is achievable at serving via constrained decoding; measure raw to see model behavior. |
113
+ | Field-F1 (**precision + recall separately**) | schema-aware match (`x-match-on` keys); exact for scalars | ≥0.90 **on real docs** | Report P and R separately — a low-recall/high-precision model looks fine on F1-averaged-with-validity but misses content. |
114
+ | Hallucination | grounding: every extracted value must appear in source (schema `x-grounding: exempt` for classifications) | 0 (post-verifier) | Raw model is never 0 on real docs; the *system* hits 0 via verifier + human-in-loop. |
115
+ | Identifier leak | regex for names/MRN/DOB/SSN/phone/email | 0 | Schema stores no identifiers by design. |
116
+ | Beats baseline | vs the prior model AND base zero-shot | strictly better | Base zero-shot ≈ 0% valid JSON; the meaningful bar is the prior fine-tune. |
117
+
118
+ **Do not report a single blended number.** Report: validity, **per-field precision AND recall**, hallucination, leak — on **real** docs. The blended F1 on synthetic data is the metric that lies.
119
+
120
+ ---
121
+
122
+ ## 7. Porting to a new vertical (e.g. Résumé / CV parsing) — checklist
123
+
124
+ The pipeline is schema-driven, so a new vertical is mostly data + schema:
125
+
126
+ 1. **Schema.** Define the JSON contract with `x-grounding` (which fields must be verbatim-grounded vs. are classifications/derived) and `x-match-on` (list-item match keys). E.g. résumé: `experience[]` matched on `(company, title)`, `education[]` on `(institution, degree)`, `skills[]` on `name`. Mark `summary`/`document_type` as grounding-exempt.
127
+ 2. **Data — cover every surface form (see §5.1).** For each field, generate/collect docs where it appears structured *and* in prose. This is where you prevent the recall blind spot before it happens.
128
+ 3. **Preserve formatting (§5.2).** Dates, phone numbers, degree abbreviations (`BS` vs `Bachelor of Science`) — vary them in sources and copy verbatim in labels; add equivalences to the verifier, not the training labels.
129
+ 4. **Train** with the resumable QLoRA recipe (§1–2); save per-epoch adapters.
130
+ 5. **Eval honestly (§4).** Build a small **real** résumé benchmark with double-annotation + adjudication. Measure per-field precision *and* recall. Expect (and hunt for) the high-precision/low-recall blind spot on the fields real documents phrase in prose.
131
+ 6. **Gate + verifier + human-in-loop** identical to clinical — the whole workflow (extract → ground → verify → correct → audit) is the product, not the single model call.
132
+
133
+ ---
134
+
135
+ ## 8. TL;DR — the five things to remember
136
+
137
+ 1. **The model learns the surface form of your data.** Train on every way real documents phrase a field, especially **narrative prose**, or you get high precision and terrible recall on real docs.
138
+ 2. **In-distribution synthetic eval scores ~1.0 and means nothing.** Build a labeled **real-doc** benchmark; measure **recall**, not just validity/F1.
139
+ 3. **Preserve source formatting in labels; put equivalences in the verifier.** Don't teach the model to canonicalize.
140
+ 4. **Adversarially review any kernel before spending a GPU session;** strip the base model's reasoning wrapper before parsing; compute authoritative metrics offline.
141
+ 5. **For capped GPUs, do lossless multi-session resume** with frozen deps, step-gated completion, and fail-loud archive handling.
142
+
143
+ *Written from the Mira-3 v11 build (clinical extraction, Qwen3-4B QLoRA). v11 = valid JSON 100%, identifier-leak 0, beats the prior model — but real-doc field-F1 0.61 with a diagnoses-recall blind spot that the synthetic eval hid. The blind spot is a data problem, and it's the v1 priority.*
README.md ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: dilr-internal
4
+ base_model: Qwen/Qwen3-4B-Instruct-2507
5
+ library_name: peft
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - clinical
9
+ - information-extraction
10
+ - structured-output
11
+ - json-extraction
12
+ - qlora
13
+ - lora
14
+ - on-prem
15
+ language:
16
+ - en
17
+ - es
18
+ - pt
19
+ ---
20
+
21
+ # Mira-3 v11 — Clinical Structured Extraction (Qwen3-4B, QLoRA)
22
+
23
+ **Mira-3** reads a clinical document (lab report, discharge summary, intake form, progress note, …) and returns a single **schema-valid, source-grounded JSON** object. It is a LoRA adapter over `Qwen/Qwen3-4B-Instruct-2507`, built to run **on-prem / offline** on a customer's own GPU — privacy is the point.
24
+
25
+ This repo is the **v0** artifact: trained on **synthetic + permissively-licensed public data only** (no PHI, no DUA/research-only data). It proves the pipeline; v1 will retrain on a design partner's real documents.
26
+
27
+ > ⚠️ **Read the honest eval below before using.** v0 is excellent on validity and grounding but has a real-world **recall blind spot on narrative diagnoses/procedures**. See `MIRA3_LEARNINGS.md` for the full analysis and how to fix it.
28
+
29
+ ## Files
30
+ - `adapter/` — the shipping adapter (**epoch 3**, best by eval)
31
+ - `epochs/epoch_{1,2,3}/` — per-epoch adapters (for reproducibility / best-epoch verification)
32
+ - `training/metrics.json`, `training/env_versions.json` — training run + exact dependency stack
33
+ - `eval/probe_scorecard_v11.json` — real-doc probe validity + hallucination + leak
34
+ - `eval/phase25_gate_v11.json` — Phase-2.5 exit gate verdict (**PASS**)
35
+ - `eval/realdoc_eval_v11.json` — the honest labeled real-doc field-F1 (with adjudicated gold)
36
+ - `MIRA3_LEARNINGS.md` — detailed, reusable playbook (generalizes to other extraction/OCR verticals, e.g. résumé parsing)
37
+
38
+ ## Training
39
+ | | |
40
+ |---|---|
41
+ | Base | `Qwen/Qwen3-4B-Instruct-2507` (Unsloth 4-bit) |
42
+ | Method | QLoRA (4-bit + LoRA r16/α32, dropout 0.05), Unsloth, sequence packing |
43
+ | Data | 21k rows: 15k ladder + 3k schema-variant + 3k PII-abstention (synthetic + public) |
44
+ | Schedule | 3 epochs, lr 2e-4 cosine, warmup 3%, effective batch 16, max_seq 3072 |
45
+ | Compute | Kaggle T4, 2 sessions (~20.7h) via lossless checkpoint/resume |
46
+ | Loss | 1.363 → 0.133 (clean cosine decay; natural completion at 867/867 steps) |
47
+
48
+ ## Evaluation (honest)
49
+
50
+ **Phase-2.5 gate: PASS.** v11 beats the prior production model (Mira-Q2) on all real-doc probes for both JSON validity (100%) and hallucination.
51
+
52
+ | Probe (real docs) | JSON validity | Hallucination (↓ better) |
53
+ |---|---|---|
54
+ | mtsamples_282 | 1.00 | 0.28 |
55
+ | extraction_relevant_150 | 1.00 | 0.52 |
56
+ | synthetic_v2_150 | 1.00 | 0.13 |
57
+ | identifier leak | — | **0** everywhere |
58
+
59
+ **Labeled real-doc field-F1 (the honest generalization metric): 0.61** — on 24 diverse mtsamples docs with double-annotated + adjudicated gold. (The synthetic in-distribution test set scores 1.00 and is **not** a generalization signal — see learnings §4c.)
60
+
61
+ Per-field: **high precision (0.89–0.98) everywhere, but uneven recall.** Strong on allergies (F1 0.99), encounter date/dept (0.96/0.88), vitals (0.84), medications (P 0.98). **Weak on diagnoses (recall 0.10) and procedures (recall 0.33).**
62
+
63
+ ## Limitations
64
+ - **Diagnoses/procedures recall on narrative text is poor.** The model extracts these well from structured `Diagnoses:`-style blocks (as in the synthetic training data) but misses them when stated in prose (real clinical notes). This is a **data-coverage** issue, targeted for v1. Do not rely on v0 for complete diagnosis capture from free-text notes.
65
+ - Every output is a **draft for a human** and must be routed through the verifier (schema + grounding + identifier-leak) before use. Never an autonomous decision.
66
+ - v0 is trained on synthetic/public data; real-world distribution shift is expected until the v1 retrain.
67
+
68
+ ## Usage
69
+ ```python
70
+ import torch
71
+ from unsloth import FastLanguageModel # load with Unsloth, NOT vanilla PeftModel (4-bit quant mismatch)
72
+
73
+ model, tok = FastLanguageModel.from_pretrained(
74
+ "dilr/mira-3-v11/adapter", max_seq_length=4096, dtype=torch.float16, load_in_4bit=True)
75
+ FastLanguageModel.for_inference(model)
76
+
77
+ SYSTEM = ("You are a clinical information extraction system. Read the clinical document and "
78
+ "output a single JSON object matching the schema. Extract ONLY information explicitly "
79
+ "stated ... Output valid JSON only - no prose, no markdown.") # full prompt in the training data
80
+
81
+ msgs = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": document_text}]
82
+ text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
83
+ out = model.generate(**tok(text, return_tensors="pt").to("cuda"), max_new_tokens=2048, do_sample=False)
84
+ raw = tok.decode(out[0], skip_special_tokens=True)
85
+ # NOTE: Qwen3 prepends a <think>...</think> block — strip it before json.loads():
86
+ import re, json
87
+ pred = json.loads(re.sub(r"^\s*<think>.*?</think>\s*", "", raw.split("assistant")[-1], flags=re.DOTALL))
88
+ ```
89
+
90
+ ## License & data
91
+ LoRA adapter over Qwen3-4B (base: Apache-2.0). Internal dilr.ai artifact; not for redistribution. Trained on synthetic + permissively-licensed public data; **contains no PHI and no patient identifiers**. Eval derived from the public MTSamples corpus.
adapter/adapter_config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Qwen3ForCausalLM",
7
+ "parent_library": "transformers.models.qwen3.modeling_qwen3",
8
+ "unsloth_fixed": true
9
+ },
10
+ "base_model_name_or_path": "unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit",
11
+ "bias": "none",
12
+ "corda_config": null,
13
+ "ensure_weight_tying": false,
14
+ "eva_config": null,
15
+ "exclude_modules": null,
16
+ "fan_in_fan_out": false,
17
+ "inference_mode": true,
18
+ "init_lora_weights": true,
19
+ "layer_replication": null,
20
+ "layers_pattern": null,
21
+ "layers_to_transform": null,
22
+ "loftq_config": {},
23
+ "lora_alpha": 32,
24
+ "lora_bias": false,
25
+ "lora_dropout": 0.05,
26
+ "lora_ga_config": null,
27
+ "megatron_config": null,
28
+ "megatron_core": "megatron.core",
29
+ "modules_to_save": null,
30
+ "peft_type": "LORA",
31
+ "peft_version": "0.19.1",
32
+ "qalora_group_size": 16,
33
+ "r": 16,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": [
37
+ "k_proj",
38
+ "q_proj",
39
+ "o_proj",
40
+ "up_proj",
41
+ "down_proj",
42
+ "v_proj",
43
+ "gate_proj"
44
+ ],
45
+ "target_parameters": null,
46
+ "task_type": "CAUSAL_LM",
47
+ "trainable_token_indices": null,
48
+ "use_bdlora": null,
49
+ "use_dora": false,
50
+ "use_qalora": false,
51
+ "use_rslora": false
52
+ }
adapter/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48cffcb83e6810cfaedfad7c4f61ed45bc2c4a133285fb001ac4eabe9d2ca08d
3
+ size 132187888
adapter/chat_template.jinja ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- endif %}
adapter/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7430e9138b76e93fb6f93462394d236b411111aef53cb421ba97d2691040cca
3
+ size 11423114
adapter/tokenizer_config.json ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "model_max_length": 3072,
10
+ "pad_token": "<|PAD_TOKEN|>",
11
+ "padding_side": "left",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null,
15
+ "added_tokens_decoder": {
16
+ "151643": {
17
+ "content": "<|endoftext|>",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ "151644": {
25
+ "content": "<|im_start|>",
26
+ "single_word": false,
27
+ "lstrip": false,
28
+ "rstrip": false,
29
+ "normalized": false,
30
+ "special": true
31
+ },
32
+ "151645": {
33
+ "content": "<|im_end|>",
34
+ "single_word": false,
35
+ "lstrip": false,
36
+ "rstrip": false,
37
+ "normalized": false,
38
+ "special": true
39
+ },
40
+ "151646": {
41
+ "content": "<|object_ref_start|>",
42
+ "single_word": false,
43
+ "lstrip": false,
44
+ "rstrip": false,
45
+ "normalized": false,
46
+ "special": true
47
+ },
48
+ "151647": {
49
+ "content": "<|object_ref_end|>",
50
+ "single_word": false,
51
+ "lstrip": false,
52
+ "rstrip": false,
53
+ "normalized": false,
54
+ "special": true
55
+ },
56
+ "151648": {
57
+ "content": "<|box_start|>",
58
+ "single_word": false,
59
+ "lstrip": false,
60
+ "rstrip": false,
61
+ "normalized": false,
62
+ "special": true
63
+ },
64
+ "151649": {
65
+ "content": "<|box_end|>",
66
+ "single_word": false,
67
+ "lstrip": false,
68
+ "rstrip": false,
69
+ "normalized": false,
70
+ "special": true
71
+ },
72
+ "151650": {
73
+ "content": "<|quad_start|>",
74
+ "single_word": false,
75
+ "lstrip": false,
76
+ "rstrip": false,
77
+ "normalized": false,
78
+ "special": true
79
+ },
80
+ "151651": {
81
+ "content": "<|quad_end|>",
82
+ "single_word": false,
83
+ "lstrip": false,
84
+ "rstrip": false,
85
+ "normalized": false,
86
+ "special": true
87
+ },
88
+ "151652": {
89
+ "content": "<|vision_start|>",
90
+ "single_word": false,
91
+ "lstrip": false,
92
+ "rstrip": false,
93
+ "normalized": false,
94
+ "special": true
95
+ },
96
+ "151653": {
97
+ "content": "<|vision_end|>",
98
+ "single_word": false,
99
+ "lstrip": false,
100
+ "rstrip": false,
101
+ "normalized": false,
102
+ "special": true
103
+ },
104
+ "151654": {
105
+ "content": "<|vision_pad|>",
106
+ "single_word": false,
107
+ "lstrip": false,
108
+ "rstrip": false,
109
+ "normalized": false,
110
+ "special": true
111
+ },
112
+ "151655": {
113
+ "content": "<|image_pad|>",
114
+ "single_word": false,
115
+ "lstrip": false,
116
+ "rstrip": false,
117
+ "normalized": false,
118
+ "special": true
119
+ },
120
+ "151656": {
121
+ "content": "<|video_pad|>",
122
+ "single_word": false,
123
+ "lstrip": false,
124
+ "rstrip": false,
125
+ "normalized": false,
126
+ "special": true
127
+ },
128
+ "151657": {
129
+ "content": "<tool_call>",
130
+ "single_word": false,
131
+ "lstrip": false,
132
+ "rstrip": false,
133
+ "normalized": false,
134
+ "special": false
135
+ },
136
+ "151658": {
137
+ "content": "</tool_call>",
138
+ "single_word": false,
139
+ "lstrip": false,
140
+ "rstrip": false,
141
+ "normalized": false,
142
+ "special": false
143
+ },
144
+ "151659": {
145
+ "content": "<|fim_prefix|>",
146
+ "single_word": false,
147
+ "lstrip": false,
148
+ "rstrip": false,
149
+ "normalized": false,
150
+ "special": false
151
+ },
152
+ "151660": {
153
+ "content": "<|fim_middle|>",
154
+ "single_word": false,
155
+ "lstrip": false,
156
+ "rstrip": false,
157
+ "normalized": false,
158
+ "special": false
159
+ },
160
+ "151661": {
161
+ "content": "<|fim_suffix|>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": false
167
+ },
168
+ "151662": {
169
+ "content": "<|fim_pad|>",
170
+ "single_word": false,
171
+ "lstrip": false,
172
+ "rstrip": false,
173
+ "normalized": false,
174
+ "special": false
175
+ },
176
+ "151663": {
177
+ "content": "<|repo_name|>",
178
+ "single_word": false,
179
+ "lstrip": false,
180
+ "rstrip": false,
181
+ "normalized": false,
182
+ "special": false
183
+ },
184
+ "151664": {
185
+ "content": "<|file_sep|>",
186
+ "single_word": false,
187
+ "lstrip": false,
188
+ "rstrip": false,
189
+ "normalized": false,
190
+ "special": false
191
+ },
192
+ "151665": {
193
+ "content": "<tool_response>",
194
+ "single_word": false,
195
+ "lstrip": false,
196
+ "rstrip": false,
197
+ "normalized": false,
198
+ "special": false
199
+ },
200
+ "151666": {
201
+ "content": "</tool_response>",
202
+ "single_word": false,
203
+ "lstrip": false,
204
+ "rstrip": false,
205
+ "normalized": false,
206
+ "special": false
207
+ },
208
+ "151667": {
209
+ "content": "<think>",
210
+ "single_word": false,
211
+ "lstrip": false,
212
+ "rstrip": false,
213
+ "normalized": false,
214
+ "special": false
215
+ },
216
+ "151668": {
217
+ "content": "</think>",
218
+ "single_word": false,
219
+ "lstrip": false,
220
+ "rstrip": false,
221
+ "normalized": false,
222
+ "special": false
223
+ },
224
+ "151669": {
225
+ "content": "<|PAD_TOKEN|>",
226
+ "single_word": false,
227
+ "lstrip": false,
228
+ "rstrip": false,
229
+ "normalized": false,
230
+ "special": true
231
+ }
232
+ }
233
+ }
epochs/epoch_1/adapter_config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Qwen3ForCausalLM",
7
+ "parent_library": "transformers.models.qwen3.modeling_qwen3",
8
+ "unsloth_fixed": true
9
+ },
10
+ "base_model_name_or_path": "unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit",
11
+ "bias": "none",
12
+ "corda_config": null,
13
+ "ensure_weight_tying": false,
14
+ "eva_config": null,
15
+ "exclude_modules": null,
16
+ "fan_in_fan_out": false,
17
+ "inference_mode": true,
18
+ "init_lora_weights": true,
19
+ "layer_replication": null,
20
+ "layers_pattern": null,
21
+ "layers_to_transform": null,
22
+ "loftq_config": {},
23
+ "lora_alpha": 32,
24
+ "lora_bias": false,
25
+ "lora_dropout": 0.05,
26
+ "lora_ga_config": null,
27
+ "megatron_config": null,
28
+ "megatron_core": "megatron.core",
29
+ "modules_to_save": null,
30
+ "peft_type": "LORA",
31
+ "peft_version": "0.19.1",
32
+ "qalora_group_size": 16,
33
+ "r": 16,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": [
37
+ "k_proj",
38
+ "v_proj",
39
+ "gate_proj",
40
+ "o_proj",
41
+ "up_proj",
42
+ "q_proj",
43
+ "down_proj"
44
+ ],
45
+ "target_parameters": null,
46
+ "task_type": "CAUSAL_LM",
47
+ "trainable_token_indices": null,
48
+ "use_bdlora": null,
49
+ "use_dora": false,
50
+ "use_qalora": false,
51
+ "use_rslora": false
52
+ }
epochs/epoch_1/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b96d29b2458fe548cd1fbb410d73608a2701915a7786d644a071a48515d4831b
3
+ size 132187888
epochs/epoch_1/chat_template.jinja ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- endif %}
epochs/epoch_1/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7430e9138b76e93fb6f93462394d236b411111aef53cb421ba97d2691040cca
3
+ size 11423114
epochs/epoch_1/tokenizer_config.json ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "model_max_length": 3072,
10
+ "pad_token": "<|PAD_TOKEN|>",
11
+ "padding_side": "right",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null,
15
+ "added_tokens_decoder": {
16
+ "151643": {
17
+ "content": "<|endoftext|>",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ "151644": {
25
+ "content": "<|im_start|>",
26
+ "single_word": false,
27
+ "lstrip": false,
28
+ "rstrip": false,
29
+ "normalized": false,
30
+ "special": true
31
+ },
32
+ "151645": {
33
+ "content": "<|im_end|>",
34
+ "single_word": false,
35
+ "lstrip": false,
36
+ "rstrip": false,
37
+ "normalized": false,
38
+ "special": true
39
+ },
40
+ "151646": {
41
+ "content": "<|object_ref_start|>",
42
+ "single_word": false,
43
+ "lstrip": false,
44
+ "rstrip": false,
45
+ "normalized": false,
46
+ "special": true
47
+ },
48
+ "151647": {
49
+ "content": "<|object_ref_end|>",
50
+ "single_word": false,
51
+ "lstrip": false,
52
+ "rstrip": false,
53
+ "normalized": false,
54
+ "special": true
55
+ },
56
+ "151648": {
57
+ "content": "<|box_start|>",
58
+ "single_word": false,
59
+ "lstrip": false,
60
+ "rstrip": false,
61
+ "normalized": false,
62
+ "special": true
63
+ },
64
+ "151649": {
65
+ "content": "<|box_end|>",
66
+ "single_word": false,
67
+ "lstrip": false,
68
+ "rstrip": false,
69
+ "normalized": false,
70
+ "special": true
71
+ },
72
+ "151650": {
73
+ "content": "<|quad_start|>",
74
+ "single_word": false,
75
+ "lstrip": false,
76
+ "rstrip": false,
77
+ "normalized": false,
78
+ "special": true
79
+ },
80
+ "151651": {
81
+ "content": "<|quad_end|>",
82
+ "single_word": false,
83
+ "lstrip": false,
84
+ "rstrip": false,
85
+ "normalized": false,
86
+ "special": true
87
+ },
88
+ "151652": {
89
+ "content": "<|vision_start|>",
90
+ "single_word": false,
91
+ "lstrip": false,
92
+ "rstrip": false,
93
+ "normalized": false,
94
+ "special": true
95
+ },
96
+ "151653": {
97
+ "content": "<|vision_end|>",
98
+ "single_word": false,
99
+ "lstrip": false,
100
+ "rstrip": false,
101
+ "normalized": false,
102
+ "special": true
103
+ },
104
+ "151654": {
105
+ "content": "<|vision_pad|>",
106
+ "single_word": false,
107
+ "lstrip": false,
108
+ "rstrip": false,
109
+ "normalized": false,
110
+ "special": true
111
+ },
112
+ "151655": {
113
+ "content": "<|image_pad|>",
114
+ "single_word": false,
115
+ "lstrip": false,
116
+ "rstrip": false,
117
+ "normalized": false,
118
+ "special": true
119
+ },
120
+ "151656": {
121
+ "content": "<|video_pad|>",
122
+ "single_word": false,
123
+ "lstrip": false,
124
+ "rstrip": false,
125
+ "normalized": false,
126
+ "special": true
127
+ },
128
+ "151657": {
129
+ "content": "<tool_call>",
130
+ "single_word": false,
131
+ "lstrip": false,
132
+ "rstrip": false,
133
+ "normalized": false,
134
+ "special": false
135
+ },
136
+ "151658": {
137
+ "content": "</tool_call>",
138
+ "single_word": false,
139
+ "lstrip": false,
140
+ "rstrip": false,
141
+ "normalized": false,
142
+ "special": false
143
+ },
144
+ "151659": {
145
+ "content": "<|fim_prefix|>",
146
+ "single_word": false,
147
+ "lstrip": false,
148
+ "rstrip": false,
149
+ "normalized": false,
150
+ "special": false
151
+ },
152
+ "151660": {
153
+ "content": "<|fim_middle|>",
154
+ "single_word": false,
155
+ "lstrip": false,
156
+ "rstrip": false,
157
+ "normalized": false,
158
+ "special": false
159
+ },
160
+ "151661": {
161
+ "content": "<|fim_suffix|>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": false
167
+ },
168
+ "151662": {
169
+ "content": "<|fim_pad|>",
170
+ "single_word": false,
171
+ "lstrip": false,
172
+ "rstrip": false,
173
+ "normalized": false,
174
+ "special": false
175
+ },
176
+ "151663": {
177
+ "content": "<|repo_name|>",
178
+ "single_word": false,
179
+ "lstrip": false,
180
+ "rstrip": false,
181
+ "normalized": false,
182
+ "special": false
183
+ },
184
+ "151664": {
185
+ "content": "<|file_sep|>",
186
+ "single_word": false,
187
+ "lstrip": false,
188
+ "rstrip": false,
189
+ "normalized": false,
190
+ "special": false
191
+ },
192
+ "151665": {
193
+ "content": "<tool_response>",
194
+ "single_word": false,
195
+ "lstrip": false,
196
+ "rstrip": false,
197
+ "normalized": false,
198
+ "special": false
199
+ },
200
+ "151666": {
201
+ "content": "</tool_response>",
202
+ "single_word": false,
203
+ "lstrip": false,
204
+ "rstrip": false,
205
+ "normalized": false,
206
+ "special": false
207
+ },
208
+ "151667": {
209
+ "content": "<think>",
210
+ "single_word": false,
211
+ "lstrip": false,
212
+ "rstrip": false,
213
+ "normalized": false,
214
+ "special": false
215
+ },
216
+ "151668": {
217
+ "content": "</think>",
218
+ "single_word": false,
219
+ "lstrip": false,
220
+ "rstrip": false,
221
+ "normalized": false,
222
+ "special": false
223
+ },
224
+ "151669": {
225
+ "content": "<|PAD_TOKEN|>",
226
+ "single_word": false,
227
+ "lstrip": false,
228
+ "rstrip": false,
229
+ "normalized": false,
230
+ "special": true
231
+ }
232
+ }
233
+ }
epochs/epoch_2/adapter_config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Qwen3ForCausalLM",
7
+ "parent_library": "transformers.models.qwen3.modeling_qwen3",
8
+ "unsloth_fixed": true
9
+ },
10
+ "base_model_name_or_path": "unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit",
11
+ "bias": "none",
12
+ "corda_config": null,
13
+ "ensure_weight_tying": false,
14
+ "eva_config": null,
15
+ "exclude_modules": null,
16
+ "fan_in_fan_out": false,
17
+ "inference_mode": true,
18
+ "init_lora_weights": true,
19
+ "layer_replication": null,
20
+ "layers_pattern": null,
21
+ "layers_to_transform": null,
22
+ "loftq_config": {},
23
+ "lora_alpha": 32,
24
+ "lora_bias": false,
25
+ "lora_dropout": 0.05,
26
+ "lora_ga_config": null,
27
+ "megatron_config": null,
28
+ "megatron_core": "megatron.core",
29
+ "modules_to_save": null,
30
+ "peft_type": "LORA",
31
+ "peft_version": "0.19.1",
32
+ "qalora_group_size": 16,
33
+ "r": 16,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": [
37
+ "k_proj",
38
+ "q_proj",
39
+ "o_proj",
40
+ "up_proj",
41
+ "down_proj",
42
+ "v_proj",
43
+ "gate_proj"
44
+ ],
45
+ "target_parameters": null,
46
+ "task_type": "CAUSAL_LM",
47
+ "trainable_token_indices": null,
48
+ "use_bdlora": null,
49
+ "use_dora": false,
50
+ "use_qalora": false,
51
+ "use_rslora": false
52
+ }
epochs/epoch_2/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb50169c3d360d11bbd44ed400bc693a8f16352d049f426f2027588377beac9a
3
+ size 132187888
epochs/epoch_2/chat_template.jinja ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- endif %}
epochs/epoch_2/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7430e9138b76e93fb6f93462394d236b411111aef53cb421ba97d2691040cca
3
+ size 11423114
epochs/epoch_2/tokenizer_config.json ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "model_max_length": 3072,
10
+ "pad_token": "<|PAD_TOKEN|>",
11
+ "padding_side": "right",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null,
15
+ "added_tokens_decoder": {
16
+ "151643": {
17
+ "content": "<|endoftext|>",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ "151644": {
25
+ "content": "<|im_start|>",
26
+ "single_word": false,
27
+ "lstrip": false,
28
+ "rstrip": false,
29
+ "normalized": false,
30
+ "special": true
31
+ },
32
+ "151645": {
33
+ "content": "<|im_end|>",
34
+ "single_word": false,
35
+ "lstrip": false,
36
+ "rstrip": false,
37
+ "normalized": false,
38
+ "special": true
39
+ },
40
+ "151646": {
41
+ "content": "<|object_ref_start|>",
42
+ "single_word": false,
43
+ "lstrip": false,
44
+ "rstrip": false,
45
+ "normalized": false,
46
+ "special": true
47
+ },
48
+ "151647": {
49
+ "content": "<|object_ref_end|>",
50
+ "single_word": false,
51
+ "lstrip": false,
52
+ "rstrip": false,
53
+ "normalized": false,
54
+ "special": true
55
+ },
56
+ "151648": {
57
+ "content": "<|box_start|>",
58
+ "single_word": false,
59
+ "lstrip": false,
60
+ "rstrip": false,
61
+ "normalized": false,
62
+ "special": true
63
+ },
64
+ "151649": {
65
+ "content": "<|box_end|>",
66
+ "single_word": false,
67
+ "lstrip": false,
68
+ "rstrip": false,
69
+ "normalized": false,
70
+ "special": true
71
+ },
72
+ "151650": {
73
+ "content": "<|quad_start|>",
74
+ "single_word": false,
75
+ "lstrip": false,
76
+ "rstrip": false,
77
+ "normalized": false,
78
+ "special": true
79
+ },
80
+ "151651": {
81
+ "content": "<|quad_end|>",
82
+ "single_word": false,
83
+ "lstrip": false,
84
+ "rstrip": false,
85
+ "normalized": false,
86
+ "special": true
87
+ },
88
+ "151652": {
89
+ "content": "<|vision_start|>",
90
+ "single_word": false,
91
+ "lstrip": false,
92
+ "rstrip": false,
93
+ "normalized": false,
94
+ "special": true
95
+ },
96
+ "151653": {
97
+ "content": "<|vision_end|>",
98
+ "single_word": false,
99
+ "lstrip": false,
100
+ "rstrip": false,
101
+ "normalized": false,
102
+ "special": true
103
+ },
104
+ "151654": {
105
+ "content": "<|vision_pad|>",
106
+ "single_word": false,
107
+ "lstrip": false,
108
+ "rstrip": false,
109
+ "normalized": false,
110
+ "special": true
111
+ },
112
+ "151655": {
113
+ "content": "<|image_pad|>",
114
+ "single_word": false,
115
+ "lstrip": false,
116
+ "rstrip": false,
117
+ "normalized": false,
118
+ "special": true
119
+ },
120
+ "151656": {
121
+ "content": "<|video_pad|>",
122
+ "single_word": false,
123
+ "lstrip": false,
124
+ "rstrip": false,
125
+ "normalized": false,
126
+ "special": true
127
+ },
128
+ "151657": {
129
+ "content": "<tool_call>",
130
+ "single_word": false,
131
+ "lstrip": false,
132
+ "rstrip": false,
133
+ "normalized": false,
134
+ "special": false
135
+ },
136
+ "151658": {
137
+ "content": "</tool_call>",
138
+ "single_word": false,
139
+ "lstrip": false,
140
+ "rstrip": false,
141
+ "normalized": false,
142
+ "special": false
143
+ },
144
+ "151659": {
145
+ "content": "<|fim_prefix|>",
146
+ "single_word": false,
147
+ "lstrip": false,
148
+ "rstrip": false,
149
+ "normalized": false,
150
+ "special": false
151
+ },
152
+ "151660": {
153
+ "content": "<|fim_middle|>",
154
+ "single_word": false,
155
+ "lstrip": false,
156
+ "rstrip": false,
157
+ "normalized": false,
158
+ "special": false
159
+ },
160
+ "151661": {
161
+ "content": "<|fim_suffix|>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": false
167
+ },
168
+ "151662": {
169
+ "content": "<|fim_pad|>",
170
+ "single_word": false,
171
+ "lstrip": false,
172
+ "rstrip": false,
173
+ "normalized": false,
174
+ "special": false
175
+ },
176
+ "151663": {
177
+ "content": "<|repo_name|>",
178
+ "single_word": false,
179
+ "lstrip": false,
180
+ "rstrip": false,
181
+ "normalized": false,
182
+ "special": false
183
+ },
184
+ "151664": {
185
+ "content": "<|file_sep|>",
186
+ "single_word": false,
187
+ "lstrip": false,
188
+ "rstrip": false,
189
+ "normalized": false,
190
+ "special": false
191
+ },
192
+ "151665": {
193
+ "content": "<tool_response>",
194
+ "single_word": false,
195
+ "lstrip": false,
196
+ "rstrip": false,
197
+ "normalized": false,
198
+ "special": false
199
+ },
200
+ "151666": {
201
+ "content": "</tool_response>",
202
+ "single_word": false,
203
+ "lstrip": false,
204
+ "rstrip": false,
205
+ "normalized": false,
206
+ "special": false
207
+ },
208
+ "151667": {
209
+ "content": "<think>",
210
+ "single_word": false,
211
+ "lstrip": false,
212
+ "rstrip": false,
213
+ "normalized": false,
214
+ "special": false
215
+ },
216
+ "151668": {
217
+ "content": "</think>",
218
+ "single_word": false,
219
+ "lstrip": false,
220
+ "rstrip": false,
221
+ "normalized": false,
222
+ "special": false
223
+ },
224
+ "151669": {
225
+ "content": "<|PAD_TOKEN|>",
226
+ "single_word": false,
227
+ "lstrip": false,
228
+ "rstrip": false,
229
+ "normalized": false,
230
+ "special": true
231
+ }
232
+ }
233
+ }
epochs/epoch_3/adapter_config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Qwen3ForCausalLM",
7
+ "parent_library": "transformers.models.qwen3.modeling_qwen3",
8
+ "unsloth_fixed": true
9
+ },
10
+ "base_model_name_or_path": "unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit",
11
+ "bias": "none",
12
+ "corda_config": null,
13
+ "ensure_weight_tying": false,
14
+ "eva_config": null,
15
+ "exclude_modules": null,
16
+ "fan_in_fan_out": false,
17
+ "inference_mode": true,
18
+ "init_lora_weights": true,
19
+ "layer_replication": null,
20
+ "layers_pattern": null,
21
+ "layers_to_transform": null,
22
+ "loftq_config": {},
23
+ "lora_alpha": 32,
24
+ "lora_bias": false,
25
+ "lora_dropout": 0.05,
26
+ "lora_ga_config": null,
27
+ "megatron_config": null,
28
+ "megatron_core": "megatron.core",
29
+ "modules_to_save": null,
30
+ "peft_type": "LORA",
31
+ "peft_version": "0.19.1",
32
+ "qalora_group_size": 16,
33
+ "r": 16,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": [
37
+ "k_proj",
38
+ "q_proj",
39
+ "o_proj",
40
+ "up_proj",
41
+ "down_proj",
42
+ "v_proj",
43
+ "gate_proj"
44
+ ],
45
+ "target_parameters": null,
46
+ "task_type": "CAUSAL_LM",
47
+ "trainable_token_indices": null,
48
+ "use_bdlora": null,
49
+ "use_dora": false,
50
+ "use_qalora": false,
51
+ "use_rslora": false
52
+ }
epochs/epoch_3/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48cffcb83e6810cfaedfad7c4f61ed45bc2c4a133285fb001ac4eabe9d2ca08d
3
+ size 132187888
epochs/epoch_3/chat_template.jinja ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- endif %}
epochs/epoch_3/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7430e9138b76e93fb6f93462394d236b411111aef53cb421ba97d2691040cca
3
+ size 11423114
epochs/epoch_3/tokenizer_config.json ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "model_max_length": 3072,
10
+ "pad_token": "<|PAD_TOKEN|>",
11
+ "padding_side": "right",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null,
15
+ "added_tokens_decoder": {
16
+ "151643": {
17
+ "content": "<|endoftext|>",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ "151644": {
25
+ "content": "<|im_start|>",
26
+ "single_word": false,
27
+ "lstrip": false,
28
+ "rstrip": false,
29
+ "normalized": false,
30
+ "special": true
31
+ },
32
+ "151645": {
33
+ "content": "<|im_end|>",
34
+ "single_word": false,
35
+ "lstrip": false,
36
+ "rstrip": false,
37
+ "normalized": false,
38
+ "special": true
39
+ },
40
+ "151646": {
41
+ "content": "<|object_ref_start|>",
42
+ "single_word": false,
43
+ "lstrip": false,
44
+ "rstrip": false,
45
+ "normalized": false,
46
+ "special": true
47
+ },
48
+ "151647": {
49
+ "content": "<|object_ref_end|>",
50
+ "single_word": false,
51
+ "lstrip": false,
52
+ "rstrip": false,
53
+ "normalized": false,
54
+ "special": true
55
+ },
56
+ "151648": {
57
+ "content": "<|box_start|>",
58
+ "single_word": false,
59
+ "lstrip": false,
60
+ "rstrip": false,
61
+ "normalized": false,
62
+ "special": true
63
+ },
64
+ "151649": {
65
+ "content": "<|box_end|>",
66
+ "single_word": false,
67
+ "lstrip": false,
68
+ "rstrip": false,
69
+ "normalized": false,
70
+ "special": true
71
+ },
72
+ "151650": {
73
+ "content": "<|quad_start|>",
74
+ "single_word": false,
75
+ "lstrip": false,
76
+ "rstrip": false,
77
+ "normalized": false,
78
+ "special": true
79
+ },
80
+ "151651": {
81
+ "content": "<|quad_end|>",
82
+ "single_word": false,
83
+ "lstrip": false,
84
+ "rstrip": false,
85
+ "normalized": false,
86
+ "special": true
87
+ },
88
+ "151652": {
89
+ "content": "<|vision_start|>",
90
+ "single_word": false,
91
+ "lstrip": false,
92
+ "rstrip": false,
93
+ "normalized": false,
94
+ "special": true
95
+ },
96
+ "151653": {
97
+ "content": "<|vision_end|>",
98
+ "single_word": false,
99
+ "lstrip": false,
100
+ "rstrip": false,
101
+ "normalized": false,
102
+ "special": true
103
+ },
104
+ "151654": {
105
+ "content": "<|vision_pad|>",
106
+ "single_word": false,
107
+ "lstrip": false,
108
+ "rstrip": false,
109
+ "normalized": false,
110
+ "special": true
111
+ },
112
+ "151655": {
113
+ "content": "<|image_pad|>",
114
+ "single_word": false,
115
+ "lstrip": false,
116
+ "rstrip": false,
117
+ "normalized": false,
118
+ "special": true
119
+ },
120
+ "151656": {
121
+ "content": "<|video_pad|>",
122
+ "single_word": false,
123
+ "lstrip": false,
124
+ "rstrip": false,
125
+ "normalized": false,
126
+ "special": true
127
+ },
128
+ "151657": {
129
+ "content": "<tool_call>",
130
+ "single_word": false,
131
+ "lstrip": false,
132
+ "rstrip": false,
133
+ "normalized": false,
134
+ "special": false
135
+ },
136
+ "151658": {
137
+ "content": "</tool_call>",
138
+ "single_word": false,
139
+ "lstrip": false,
140
+ "rstrip": false,
141
+ "normalized": false,
142
+ "special": false
143
+ },
144
+ "151659": {
145
+ "content": "<|fim_prefix|>",
146
+ "single_word": false,
147
+ "lstrip": false,
148
+ "rstrip": false,
149
+ "normalized": false,
150
+ "special": false
151
+ },
152
+ "151660": {
153
+ "content": "<|fim_middle|>",
154
+ "single_word": false,
155
+ "lstrip": false,
156
+ "rstrip": false,
157
+ "normalized": false,
158
+ "special": false
159
+ },
160
+ "151661": {
161
+ "content": "<|fim_suffix|>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": false
167
+ },
168
+ "151662": {
169
+ "content": "<|fim_pad|>",
170
+ "single_word": false,
171
+ "lstrip": false,
172
+ "rstrip": false,
173
+ "normalized": false,
174
+ "special": false
175
+ },
176
+ "151663": {
177
+ "content": "<|repo_name|>",
178
+ "single_word": false,
179
+ "lstrip": false,
180
+ "rstrip": false,
181
+ "normalized": false,
182
+ "special": false
183
+ },
184
+ "151664": {
185
+ "content": "<|file_sep|>",
186
+ "single_word": false,
187
+ "lstrip": false,
188
+ "rstrip": false,
189
+ "normalized": false,
190
+ "special": false
191
+ },
192
+ "151665": {
193
+ "content": "<tool_response>",
194
+ "single_word": false,
195
+ "lstrip": false,
196
+ "rstrip": false,
197
+ "normalized": false,
198
+ "special": false
199
+ },
200
+ "151666": {
201
+ "content": "</tool_response>",
202
+ "single_word": false,
203
+ "lstrip": false,
204
+ "rstrip": false,
205
+ "normalized": false,
206
+ "special": false
207
+ },
208
+ "151667": {
209
+ "content": "<think>",
210
+ "single_word": false,
211
+ "lstrip": false,
212
+ "rstrip": false,
213
+ "normalized": false,
214
+ "special": false
215
+ },
216
+ "151668": {
217
+ "content": "</think>",
218
+ "single_word": false,
219
+ "lstrip": false,
220
+ "rstrip": false,
221
+ "normalized": false,
222
+ "special": false
223
+ },
224
+ "151669": {
225
+ "content": "<|PAD_TOKEN|>",
226
+ "single_word": false,
227
+ "lstrip": false,
228
+ "rstrip": false,
229
+ "normalized": false,
230
+ "special": true
231
+ }
232
+ }
233
+ }
eval/phase25_gate_v11.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mira2_baseline_path": "models/mira-3/baseline/three_way_scorecard.json",
3
+ "mira3_scorecard_path": "models/mira-3/mira3_v11_scorecard.json",
4
+ "verdict": {
5
+ "passed": true,
6
+ "validity_floor": 0.95,
7
+ "all_validity_at_or_above_floor": true,
8
+ "all_hallucination_improved_or_same": true,
9
+ "per_probe": {
10
+ "mtsamples_282": {
11
+ "present": true,
12
+ "validity": 1.0,
13
+ "validity_ok": true,
14
+ "hallucination_baseline": 0.3723,
15
+ "hallucination_now": 0.2801,
16
+ "halluc_ok": true
17
+ },
18
+ "extraction_relevant_150": {
19
+ "present": true,
20
+ "validity": 1.0,
21
+ "validity_ok": true,
22
+ "hallucination_baseline": 0.5333,
23
+ "hallucination_now": 0.52,
24
+ "halluc_ok": true
25
+ },
26
+ "synthetic_v2_150": {
27
+ "present": true,
28
+ "validity": 1.0,
29
+ "validity_ok": true,
30
+ "hallucination_baseline": 0.2733,
31
+ "hallucination_now": 0.1333,
32
+ "halluc_ok": true
33
+ }
34
+ }
35
+ }
36
+ }
eval/probe_scorecard_v11.json ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "Mira-3-v11",
3
+ "base": "Qwen/Qwen3-4B-Instruct-2507",
4
+ "best_epoch": 3,
5
+ "schema_path": "docs/extraction_schema.json",
6
+ "probes": [
7
+ {
8
+ "name": "mtsamples_282",
9
+ "n": 282,
10
+ "validity": {
11
+ "metric": "json_validity_unconstrained",
12
+ "point": 1.0,
13
+ "ci_lower": 1.0,
14
+ "ci_upper": 1.0,
15
+ "n_samples": 282,
16
+ "n_bootstrap": 1000
17
+ },
18
+ "hallucination": {
19
+ "metric": "hallucination_rate",
20
+ "point": 0.2801,
21
+ "ci_lower": 0.2305,
22
+ "ci_upper": 0.3333,
23
+ "n_samples": 282,
24
+ "n_bootstrap": 1000
25
+ },
26
+ "leak": {
27
+ "metric": "identifier_leak_rate",
28
+ "point": 0.0,
29
+ "ci_lower": 0.0,
30
+ "ci_upper": 0.0,
31
+ "n_samples": 282,
32
+ "n_bootstrap": 1000
33
+ }
34
+ },
35
+ {
36
+ "name": "extraction_relevant_150",
37
+ "n": 150,
38
+ "validity": {
39
+ "metric": "json_validity_unconstrained",
40
+ "point": 1.0,
41
+ "ci_lower": 1.0,
42
+ "ci_upper": 1.0,
43
+ "n_samples": 150,
44
+ "n_bootstrap": 1000
45
+ },
46
+ "hallucination": {
47
+ "metric": "hallucination_rate",
48
+ "point": 0.52,
49
+ "ci_lower": 0.4333,
50
+ "ci_upper": 0.6,
51
+ "n_samples": 150,
52
+ "n_bootstrap": 1000
53
+ },
54
+ "leak": {
55
+ "metric": "identifier_leak_rate",
56
+ "point": 0.0,
57
+ "ci_lower": 0.0,
58
+ "ci_upper": 0.0,
59
+ "n_samples": 150,
60
+ "n_bootstrap": 1000
61
+ }
62
+ },
63
+ {
64
+ "name": "synthetic_v2_150",
65
+ "n": 150,
66
+ "validity": {
67
+ "metric": "json_validity_unconstrained",
68
+ "point": 1.0,
69
+ "ci_lower": 1.0,
70
+ "ci_upper": 1.0,
71
+ "n_samples": 150,
72
+ "n_bootstrap": 1000
73
+ },
74
+ "hallucination": {
75
+ "metric": "hallucination_rate",
76
+ "point": 0.1333,
77
+ "ci_lower": 0.08,
78
+ "ci_upper": 0.1933,
79
+ "n_samples": 150,
80
+ "n_bootstrap": 1000
81
+ },
82
+ "leak": {
83
+ "metric": "identifier_leak_rate",
84
+ "point": 0.0,
85
+ "ci_lower": 0.0,
86
+ "ci_upper": 0.0,
87
+ "n_samples": 150,
88
+ "n_bootstrap": 1000
89
+ }
90
+ }
91
+ ],
92
+ "test_gold": {
93
+ "name": "test_gold_200",
94
+ "n": 200,
95
+ "validity": {
96
+ "metric": "json_validity_unconstrained",
97
+ "point": 1.0,
98
+ "ci_lower": 1.0,
99
+ "ci_upper": 1.0,
100
+ "n_samples": 200,
101
+ "n_bootstrap": 1000
102
+ },
103
+ "hallucination": {
104
+ "metric": "hallucination_rate",
105
+ "point": 0.0,
106
+ "ci_lower": 0.0,
107
+ "ci_upper": 0.0,
108
+ "n_samples": 200,
109
+ "n_bootstrap": 1000
110
+ },
111
+ "leak": {
112
+ "metric": "identifier_leak_rate",
113
+ "point": 0.0,
114
+ "ci_lower": 0.0,
115
+ "ci_upper": 0.0,
116
+ "n_samples": 200,
117
+ "n_bootstrap": 1000
118
+ },
119
+ "field_f1": {
120
+ "metric": "macro_f1",
121
+ "point": 1.0,
122
+ "ci_lower": 1.0,
123
+ "ci_upper": 1.0,
124
+ "n_samples": 200,
125
+ "n_bootstrap": 1000
126
+ }
127
+ },
128
+ "notes": [
129
+ "Authoritative offline metrics (slm.eval + check_grounding). Hallucination = >=1 ungrounded value per row (schema-aware x-grounding: exempt). Feeds scripts/mira3/phase25_gate_check.py."
130
+ ]
131
+ }
eval/realdoc_eval_v11.json ADDED
@@ -0,0 +1,2055 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "benchmark": "mira-3-v11 real-doc field-F1 (mtsamples, LLM-adjudicated gold)",
3
+ "model": "Mira-3-v11 (epoch_3)",
4
+ "n_docs": 24,
5
+ "method": "24 diverse mtsamples (1/specialty); 2 independent LLM annotators + adjudicator on source+schema only; extraction_notes excluded; malformed list-items coerced to primary key",
6
+ "macro_f1": 0.6114,
7
+ "per_field": {
8
+ "document_type": {
9
+ "precision": 0.1667,
10
+ "recall": 0.1667,
11
+ "f1": 0.1667
12
+ },
13
+ "patient.age": {
14
+ "precision": 0.7083,
15
+ "recall": 0.7083,
16
+ "f1": 0.7083
17
+ },
18
+ "patient.sex": {
19
+ "precision": 0.4583,
20
+ "recall": 0.4583,
21
+ "f1": 0.4583
22
+ },
23
+ "encounter.date": {
24
+ "precision": 0.9583,
25
+ "recall": 0.9583,
26
+ "f1": 0.9583
27
+ },
28
+ "encounter.department": {
29
+ "precision": 0.875,
30
+ "recall": 0.875,
31
+ "f1": 0.875
32
+ },
33
+ "vitals": {
34
+ "precision": 0.9188,
35
+ "recall": 0.8771,
36
+ "f1": 0.8354
37
+ },
38
+ "labs": {
39
+ "precision": 0.8917,
40
+ "recall": 0.7292,
41
+ "f1": 0.6435
42
+ },
43
+ "medications": {
44
+ "precision": 0.9792,
45
+ "recall": 0.6647,
46
+ "f1": 0.674
47
+ },
48
+ "diagnoses": {
49
+ "precision": 0.9722,
50
+ "recall": 0.0972,
51
+ "f1": 0.1069
52
+ },
53
+ "procedures": {
54
+ "precision": 0.9722,
55
+ "recall": 0.3333,
56
+ "f1": 0.3125
57
+ },
58
+ "allergies": {
59
+ "precision": 0.9792,
60
+ "recall": 1.0,
61
+ "f1": 0.9861
62
+ }
63
+ },
64
+ "per_doc": [
65
+ {
66
+ "idx": 17,
67
+ "specialty": "Neurology",
68
+ "macro_f1": 0.3318
69
+ },
70
+ {
71
+ "idx": 6,
72
+ "specialty": "Emergency Room Reports",
73
+ "macro_f1": 0.3636
74
+ },
75
+ {
76
+ "idx": 19,
77
+ "specialty": "General Medicine",
78
+ "macro_f1": 0.3636
79
+ },
80
+ {
81
+ "idx": 1,
82
+ "specialty": "Orthopedic",
83
+ "macro_f1": 0.4545
84
+ },
85
+ {
86
+ "idx": 5,
87
+ "specialty": "Pain Management",
88
+ "macro_f1": 0.4545
89
+ },
90
+ {
91
+ "idx": 10,
92
+ "specialty": "Discharge Summary",
93
+ "macro_f1": 0.4545
94
+ },
95
+ {
96
+ "idx": 24,
97
+ "specialty": "Psychiatry / Psychology",
98
+ "macro_f1": 0.5432
99
+ },
100
+ {
101
+ "idx": 0,
102
+ "specialty": "Consult - History and Phy.",
103
+ "macro_f1": 0.5455
104
+ },
105
+ {
106
+ "idx": 3,
107
+ "specialty": "Gastroenterology",
108
+ "macro_f1": 0.5455
109
+ },
110
+ {
111
+ "idx": 27,
112
+ "specialty": "Radiology",
113
+ "macro_f1": 0.5455
114
+ },
115
+ {
116
+ "idx": 2,
117
+ "specialty": "SOAP / Chart / Progress Notes",
118
+ "macro_f1": 0.6364
119
+ },
120
+ {
121
+ "idx": 11,
122
+ "specialty": "Diets and Nutritions",
123
+ "macro_f1": 0.6364
124
+ },
125
+ {
126
+ "idx": 12,
127
+ "specialty": "Podiatry",
128
+ "macro_f1": 0.6364
129
+ },
130
+ {
131
+ "idx": 16,
132
+ "specialty": "Neurosurgery",
133
+ "macro_f1": 0.6364
134
+ },
135
+ {
136
+ "idx": 20,
137
+ "specialty": "Urology",
138
+ "macro_f1": 0.6364
139
+ },
140
+ {
141
+ "idx": 21,
142
+ "specialty": "Nephrology",
143
+ "macro_f1": 0.6364
144
+ },
145
+ {
146
+ "idx": 29,
147
+ "specialty": "Letters",
148
+ "macro_f1": 0.697
149
+ },
150
+ {
151
+ "idx": 13,
152
+ "specialty": "Cardiovascular / Pulmonary",
153
+ "macro_f1": 0.7273
154
+ },
155
+ {
156
+ "idx": 18,
157
+ "specialty": "Speech - Language",
158
+ "macro_f1": 0.7273
159
+ },
160
+ {
161
+ "idx": 22,
162
+ "specialty": "Dentistry",
163
+ "macro_f1": 0.7273
164
+ },
165
+ {
166
+ "idx": 26,
167
+ "specialty": "Rheumatology",
168
+ "macro_f1": 0.7677
169
+ },
170
+ {
171
+ "idx": 4,
172
+ "specialty": "Lab Medicine - Pathology",
173
+ "macro_f1": 0.8182
174
+ },
175
+ {
176
+ "idx": 8,
177
+ "specialty": "ENT - Otolaryngology",
178
+ "macro_f1": 0.8182
179
+ },
180
+ {
181
+ "idx": 23,
182
+ "specialty": "Obstetrics / Gynecology",
183
+ "macro_f1": 0.9697
184
+ }
185
+ ],
186
+ "key_finding": "High precision (0.89-0.98), low recall. Model extracts ~0 diagnoses from real narrative notes (diagnoses R=0.10) and under-extracts procedures (R=0.33). Root cause = synthetic training presents diagnoses only in structured 'Diagnoses:' blocks; real prose diagnoses are missed. Data issue; fix in v1 with narrative-style training docs.",
187
+ "caveats": [
188
+ "N=24, single corpus (mtsamples)",
189
+ "gold is LLM-adjudicated, not human-certified",
190
+ "exact-description match slightly understates meds recall (HCTZ vs Hydrochlorothiazide)"
191
+ ],
192
+ "gold": [
193
+ {
194
+ "idx": 0,
195
+ "specialty": "Consult - History and Phy.",
196
+ "gold": {
197
+ "document_type": "progress_note",
198
+ "patient": {
199
+ "age": null,
200
+ "sex": "male"
201
+ },
202
+ "encounter": {
203
+ "date": null,
204
+ "department": null
205
+ },
206
+ "vitals": [],
207
+ "labs": [
208
+ {
209
+ "test": "Creatinine",
210
+ "value": "1.0",
211
+ "unit": null,
212
+ "reference_range": null,
213
+ "flag": null
214
+ },
215
+ {
216
+ "test": "RBCs (UA)",
217
+ "value": "5-9",
218
+ "unit": null,
219
+ "reference_range": null,
220
+ "flag": null
221
+ }
222
+ ],
223
+ "medications": [],
224
+ "diagnoses": [
225
+ {
226
+ "description": "6-mm left intrarenal stone, nonobstructing",
227
+ "code": null,
228
+ "code_system": null,
229
+ "status": "active"
230
+ },
231
+ {
232
+ "description": "Microhematuria",
233
+ "code": null,
234
+ "code_system": null,
235
+ "status": "active"
236
+ },
237
+ {
238
+ "description": "History of kidney stone",
239
+ "code": null,
240
+ "code_system": null,
241
+ "status": "history"
242
+ }
243
+ ],
244
+ "procedures": [
245
+ {
246
+ "date": "07/24/2008",
247
+ "description": "Renal ultrasound"
248
+ },
249
+ {
250
+ "date": "07/24/2008",
251
+ "description": "IVP"
252
+ },
253
+ {
254
+ "date": null,
255
+ "description": "Cystoscopy (planned)"
256
+ }
257
+ ],
258
+ "allergies": [],
259
+ "extraction_notes": "Urology consultation follow-up note (HPI/Impression/Plan); classified progress_note (no consult enum). Sex male from repeated He/his; age not stated (null). Encounter date null: note says patient presents 'today' but prints no visit date; the printed dates are prior tests (Creatinine June 25, 2008; renal US and IVP 07/24/2008). Department null (urology only inferable, not explicitly named). Labs: serum Creatinine 1.0 (no unit printed) and urinalysis 5-9 RBCs; lab schema has no date field so test dates not captured. Diagnoses: current 6-mm nonobstructing left intrarenal stone and Microhematuria marked active (current problems in the Impression under active management); prior kidney stone marked history ('history of kidney stone', last episode >1 year ago). Procedures: renal ultrasound and IVP both performed 07/24/2008; cystoscopy only planned for the near future (date null). Urine sent for culture/sensitivity and for cytology are pending orders without results, so not listed as labs or procedures. Hydration counseling (goal >2 L urine/24h) is advice, not a drug -> medications []. No vitals (urinary frequency 3-4 and nocturia 1-2 are symptoms), no allergies. Referring physician 'Dr. ABC' and any identifiers excluded per contract."
260
+ }
261
+ },
262
+ {
263
+ "idx": 1,
264
+ "specialty": "Orthopedic",
265
+ "gold": {
266
+ "document_type": "progress_note",
267
+ "patient": {
268
+ "age": 41,
269
+ "sex": "male"
270
+ },
271
+ "encounter": {
272
+ "date": null,
273
+ "department": null
274
+ },
275
+ "vitals": [],
276
+ "labs": [],
277
+ "medications": [
278
+ {
279
+ "name": "aspirin",
280
+ "dose": null,
281
+ "frequency": "a day",
282
+ "route": null,
283
+ "status": "current"
284
+ },
285
+ {
286
+ "name": "Malarone",
287
+ "dose": null,
288
+ "frequency": null,
289
+ "route": null,
290
+ "status": "current"
291
+ },
292
+ {
293
+ "name": "Lovenox",
294
+ "dose": null,
295
+ "frequency": null,
296
+ "route": null,
297
+ "status": "planned"
298
+ }
299
+ ],
300
+ "diagnoses": [
301
+ {
302
+ "code": null,
303
+ "code_system": null,
304
+ "description": "Right Achilles tendon rupture",
305
+ "status": null
306
+ }
307
+ ],
308
+ "procedures": [
309
+ {
310
+ "description": "Radiographs of the right ankle",
311
+ "date": null
312
+ },
313
+ {
314
+ "description": "Radiographs of the heel",
315
+ "date": null
316
+ }
317
+ ],
318
+ "allergies": [],
319
+ "extraction_notes": "Orthopedic consultation/progress note for a right Achilles tendon rupture. Patient identifiers excluded per contract: name (Mr. XYZ), employer (Chevron), and country (Angola). Sex 'male' from explicit 'Mr.'/'gentleman'/'he'; age 41 stated ('41 years of age'). Encounter date null: visit referenced as 'today' with no printed date; injury date redacted as 'Month DD, YYYY'. Department null: 'Orthopedic' is specialty context, not a printed department. Medications: aspirin currently taken ('been on aspirin a day', frequency 'a day' preserved verbatim); Malarone listed under CURRENT MEDICATIONS (anti-malarial); Lovenox planned ('for a week after surgery'). The plan's post-op aspirin is the same drug already captured as current and is not double-listed. NKDA -> no positive allergen, allergies=[]. Past medical history explicitly DENIES diabetes, cardiovascular disease, and pulmonary disease -> negated, not extracted as diagnoses. Diagnosis from IMPRESSION ('Right Achilles tendon rupture'); status left null as no explicit status ('active' is not printed). Procedures: radiographs of the right ankle and heel performed today (preserved joint space, no fracture, good alignment); date null since only 'today' is written. Recommended operative fixation (outpatient Achilles repair) is a future/planned treatment, not a performed procedure -> excluded. Physical exam findings (palpable defect 6-8 cm proximal to insertion, positive calf-squeeze/Thompson, increased dorsiflexion) are exam details, not diagnoses. No vital signs and no laboratory values reported."
320
+ }
321
+ },
322
+ {
323
+ "idx": 2,
324
+ "specialty": "SOAP / Chart / Progress Notes",
325
+ "gold": {
326
+ "document_type": "progress_note",
327
+ "patient": {
328
+ "age": null,
329
+ "sex": "female"
330
+ },
331
+ "encounter": {
332
+ "date": null,
333
+ "department": null
334
+ },
335
+ "vitals": [],
336
+ "labs": [],
337
+ "medications": [],
338
+ "diagnoses": [
339
+ {
340
+ "code": null,
341
+ "code_system": null,
342
+ "description": "Normal postoperative course",
343
+ "status": null
344
+ }
345
+ ],
346
+ "procedures": [
347
+ {
348
+ "date": null,
349
+ "description": "Total abdominal hysterectomy"
350
+ }
351
+ ],
352
+ "allergies": [],
353
+ "extraction_notes": "Postoperative day #1 SOAP/progress note following a total abdominal hysterectomy. patient.sex = \"female\" grounded in explicit female pronouns (\"her clinical condition\", \"all her questions\") plus vaginal/genitalia exam and the hysterectomy; age not stated (null). Vitals left empty: the note gives only qualitative statements (\"Afebrile now\", \"Other vital signs are stable\") with no numeric measurements and no printed vital name \u2014 mapping \"Afebrile\" to a \"Temperature\" vital would require inferring a name not written, which the contract forbids. No labs (no test+value), no medications (Plan says only \"Continue present therapy\" with no drug named; patient is NPO), no allergies stated. Diagnosis = the Assessment \"Normal postoperative course\"; \"incisional tenderness\" is a subjective complaint/symptom, not a formal diagnosis. Procedure \"Total abdominal hysterectomy\" captured from the header. The only date, 6/10/2009, appears solely as the reference point for \"denies any new symptomatology from 6/10/2009\" (symptom-onset reference), not clearly the encounter or surgery date, so encounter.date and procedure.date left null. Department not stated. No ICD/LOINC codes printed and no patient identifiers present."
354
+ }
355
+ },
356
+ {
357
+ "idx": 3,
358
+ "specialty": "Gastroenterology",
359
+ "gold": {
360
+ "document_type": "other",
361
+ "patient": {
362
+ "age": null,
363
+ "sex": null
364
+ },
365
+ "encounter": {
366
+ "date": null,
367
+ "department": null
368
+ },
369
+ "vitals": [],
370
+ "labs": [
371
+ {
372
+ "test": "Gallbladder ejection fraction at 30 minutes",
373
+ "value": "32",
374
+ "unit": "%",
375
+ "reference_range": "greater than 35%",
376
+ "flag": null
377
+ }
378
+ ],
379
+ "medications": [
380
+ {
381
+ "name": "Technetium-99m Choletec",
382
+ "dose": "6.9 mCi",
383
+ "route": "injection",
384
+ "frequency": null,
385
+ "status": null
386
+ }
387
+ ],
388
+ "diagnoses": [
389
+ {
390
+ "code": null,
391
+ "code_system": null,
392
+ "description": "Acute cholecystitis",
393
+ "status": "ruled out"
394
+ },
395
+ {
396
+ "code": null,
397
+ "code_system": null,
398
+ "description": "Cystic duct obstruction",
399
+ "status": "ruled out"
400
+ },
401
+ {
402
+ "code": null,
403
+ "code_system": null,
404
+ "description": "Very mild chronic cholecystitis",
405
+ "status": "possible"
406
+ }
407
+ ],
408
+ "procedures": [
409
+ {
410
+ "date": null,
411
+ "description": "Nuclear Medicine Hepatobiliary Scan"
412
+ },
413
+ {
414
+ "date": "02/13/09",
415
+ "description": "CT of the abdomen"
416
+ },
417
+ {
418
+ "date": "02/13/09",
419
+ "description": "Ultrasound of the abdomen"
420
+ }
421
+ ],
422
+ "allergies": [],
423
+ "extraction_notes": "Nuclear Medicine hepatobiliary (CCK-HIDA) scan report; document_type=\"other\" because the enum has no radiology/nuclear-medicine imaging category (not a serum lab or pathology report). No patient age, sex, or identifiers stated. No encounter date printed. Department set to null: \"Nuclear Medicine\" appears only inside the exam title \"NUCLEAR MEDICINE HEPATOBILIARY SCAN,\" not as an explicit department field, so per the no-inference rule it is not captured (annotator A had captured it; annotator B and this adjudication leave it null). Labs: gallbladder ejection fraction at 30 min = 32% (reference \"greater than 35%\") is the one quantitative measurement with a range; placed under labs as the closest structured slot though it is an imaging-derived functional value, not a blood lab. Flag left null: no discrete H/L token is printed, although the impression states the value is \"just under the lower limits of normal\" (i.e., below the 35% reference). Medications: Technetium-99m Choletec 6.9 mCi captured; route=\"injection\" retained because the text explicitly states \"the injection of radiopharmaceutical\" (annotator A captured this; B left it null). The second administered agent \u2014 \"2.1 mcg of intravenous cholecystic ______\" (a cholecystokinin/cholecystagogue for the ejection-fraction challenge) \u2014 is NOT captured as a medication because its drug name is redacted/blank in the source and the contract requires a grounded drug name (dose 2.1 mcg, route intravenous noted here only for completeness). Diagnoses derived from the IMPRESSION: acute cholecystitis and cystic duct obstruction marked \"ruled out\" (\"Negative for...\"), and \"very mild chronic cholecystitis\" marked \"possible\" (\"can be seen with...\"). \"Right upper quadrant pain\" is NOT listed as a diagnosis: it is explicitly the REASON FOR EXAM (presenting complaint/indication), not a rendered diagnosis, and the contract requires a diagnosis to be an explicit condition statement (annotator B had added it with status \"reason for exam\"; this adjudication omits it). Procedures: this nuclear medicine scan (date null), plus the prior CT of the abdomen and ultrasound of the abdomen (both dated 02/13/09) which are listed under COMPARISONS \u2014 captured for recall with their study dates; descriptions kept to the source wording rather than appended with \"(comparison)\". Not encoded: qualitative findings \"normal hepatobiliary transfer time\" and \"normal accumulation within the gallbladder\" (no discrete values); procedural symptoms \"2/10 pain at 5 minutes\" and \"nausea\" (transient exam-time symptoms, not recorded vital signs or diagnoses)."
424
+ }
425
+ },
426
+ {
427
+ "idx": 4,
428
+ "specialty": "Lab Medicine - Pathology",
429
+ "gold": {
430
+ "document_type": "other",
431
+ "patient": {
432
+ "age": null,
433
+ "sex": null
434
+ },
435
+ "encounter": {
436
+ "date": null,
437
+ "department": null
438
+ },
439
+ "vitals": [],
440
+ "labs": [],
441
+ "medications": [],
442
+ "diagnoses": [],
443
+ "procedures": [],
444
+ "allergies": [],
445
+ "extraction_notes": "Not a patient-specific clinical record. Educational/reference passage explaining two lab tests: BNP (brain/B-type natriuretic peptide), produced in the heart ventricles under strain and used to detect acute congestive heart failure, and BMP (basic metabolic panel), a group of 8 tests (glucose, calcium, sodium, potassium, bicarbonate, chloride, BUN, creatinine), plus guidance on distinguishing BNP from BMP in documentation. Classified 'other' (not lab_report/pathology_report) because no actual patient results are reported. No patient demographics, encounter, vitals, medications, procedures, or allergies present; references to 'a person'/'a doctor'/'he' are generic/hypothetical. labs=[] because the figures 100 and 500 are stated as general interpretive thresholds ('Values above 100 signal a problematic situation and those above 500 a highly demanding state'), not a measured patient value tied to a test; BMP is described as a panel with no single value. diagnoses=[] because 'congestive heart failure', 'heart failure', and 'MI' appear only as illustrative examples of BNP elevation, not conditions diagnosed for any patient. No patient identifiers present."
446
+ }
447
+ },
448
+ {
449
+ "idx": 5,
450
+ "specialty": "Pain Management",
451
+ "gold": {
452
+ "document_type": "other",
453
+ "patient": {
454
+ "age": 14,
455
+ "sex": "female"
456
+ },
457
+ "encounter": {
458
+ "date": null,
459
+ "department": null
460
+ },
461
+ "vitals": [],
462
+ "labs": [],
463
+ "medications": [
464
+ {
465
+ "name": "Naprosyn",
466
+ "dose": null,
467
+ "route": null,
468
+ "frequency": null,
469
+ "status": null
470
+ },
471
+ {
472
+ "name": "Aristospan",
473
+ "dose": "20 mg",
474
+ "route": "injection",
475
+ "frequency": null,
476
+ "status": "administered"
477
+ }
478
+ ],
479
+ "diagnoses": [
480
+ {
481
+ "description": "pauciarticular arthritis, in particular arthritis of her left knee",
482
+ "code": null,
483
+ "code_system": null,
484
+ "status": "history"
485
+ },
486
+ {
487
+ "description": "arthralgias in multiple joints",
488
+ "code": null,
489
+ "code_system": null,
490
+ "status": null
491
+ },
492
+ {
493
+ "description": "joint swelling of her left knee",
494
+ "code": null,
495
+ "code_system": null,
496
+ "status": null
497
+ }
498
+ ],
499
+ "procedures": [
500
+ {
501
+ "description": "Joint injection of the left knee with 20 mg of Aristospan, under general anesthesia and aseptic technique; no fluid obtained; no complications or bleeding",
502
+ "date": null
503
+ }
504
+ ],
505
+ "allergies": [],
506
+ "extraction_notes": "Procedure note (INDICATIONS FOR PROCEDURE / DESCRIPTION OF PROCEDURE) documenting a left-knee joint injection; no procedure_note enum exists and it is not a routine progress note, so document_type=other. Patient stated as \"14-year-old Hispanic female\" \u2014 only age/sex captured; ethnicity is not a schema field and no identifiers present. Encounter date/department null (text says only \"clinic\", not a named department, and no date printed). Vitals empty: swelling \"about 1+\" is a physical-exam finding, not a numeric vital. Labs empty: \"No fluid was obtained\" is a procedure observation, not a test+value. Medications: Naprosyn is a prior/home med (\"has been taking Naprosyn on her last visit\") with no explicit dose/route/frequency/status, so status left null (ongoing use not explicitly stated); Aristospan 20 mg was injected into the left knee during the procedure (route=injection, status=administered, both grounded in the explicit injection event). General anesthesia is mentioned but no specific agent is named, so it is captured under the procedure, not as a medication. Diagnoses/complaints grounded to explicit statements: history of pauciarticular arthritis (esp. left knee), arthralgias in multiple joints, and the chief complaint of left-knee joint swelling for several months. No allergies stated."
507
+ }
508
+ },
509
+ {
510
+ "idx": 6,
511
+ "specialty": "Emergency Room Reports",
512
+ "gold": {
513
+ "document_type": "progress_note",
514
+ "patient": {
515
+ "age": 15,
516
+ "sex": "female"
517
+ },
518
+ "encounter": {
519
+ "date": null,
520
+ "department": "ED"
521
+ },
522
+ "vitals": [
523
+ {
524
+ "name": "BP",
525
+ "value": "102/60",
526
+ "unit": null
527
+ },
528
+ {
529
+ "name": "P",
530
+ "value": "70",
531
+ "unit": null
532
+ },
533
+ {
534
+ "name": "RR",
535
+ "value": "20",
536
+ "unit": null
537
+ },
538
+ {
539
+ "name": "T",
540
+ "value": "98.2",
541
+ "unit": null
542
+ }
543
+ ],
544
+ "labs": [],
545
+ "medications": [
546
+ {
547
+ "name": "Tylenol",
548
+ "dose": null,
549
+ "route": null,
550
+ "frequency": null,
551
+ "status": null
552
+ },
553
+ {
554
+ "name": "Tylenol with codeine",
555
+ "dose": null,
556
+ "route": null,
557
+ "frequency": null,
558
+ "status": null
559
+ }
560
+ ],
561
+ "diagnoses": [
562
+ {
563
+ "code": null,
564
+ "code_system": null,
565
+ "description": "Migraine headache",
566
+ "status": null
567
+ }
568
+ ],
569
+ "procedures": [],
570
+ "allergies": [],
571
+ "extraction_notes": "ED/urgent care encounter note (CC, HPI, PMH, MEDICATIONS, ALLERGIES, FAMILY HISTORY, ROS, PHYSICAL EXAM, COURSE IN THE ED, IMPRESSION, PLAN) classified as progress_note (closest schema type); headers 'COURSE IN THE ED' and 'seen in the urgent care'. Patient is a 15-year-old girl -> age 15, sex female; no patient identifiers present. Department captured as 'ED' from the 'COURSE IN THE ED' section; no encounter date printed. Vitals from Physical Exam preserved exactly with no printed units: BP 102/60, P 70, RR 20, T 98.2. No labs and no procedures printed. Two medications: 'Tylenol for pain' (MEDICATIONS/current) and 'Tylenol with codeine' being tried in the ED ('we'll try Tylenol with codeine for her pain'); no dose/route/frequency and no explicit status word printed, so status left null for both. Diagnosis 'Migraine headache' from IMPRESSION (HPI notes migraine 'highly likely'); chief complaint 'Headache' with nausea/photophobia is the presenting symptom, not a separate diagnosis. ALLERGIES 'None' (empty list). Family history (grandmother died of cerebral aneurysm) is family, not patient, history and excluded."
572
+ }
573
+ },
574
+ {
575
+ "idx": 8,
576
+ "specialty": "ENT - Otolaryngology",
577
+ "gold": {
578
+ "document_type": "other",
579
+ "patient": {
580
+ "age": null,
581
+ "sex": null
582
+ },
583
+ "encounter": {
584
+ "date": null,
585
+ "department": null
586
+ },
587
+ "vitals": [],
588
+ "labs": [],
589
+ "medications": [],
590
+ "diagnoses": [
591
+ {
592
+ "code": null,
593
+ "code_system": null,
594
+ "description": "Recurrent tonsillitis",
595
+ "status": "preoperative"
596
+ },
597
+ {
598
+ "code": null,
599
+ "code_system": null,
600
+ "description": "Recurrent tonsillitis",
601
+ "status": "postoperative"
602
+ }
603
+ ],
604
+ "procedures": [
605
+ {
606
+ "date": null,
607
+ "description": "Adenotonsillectomy"
608
+ }
609
+ ],
610
+ "allergies": [],
611
+ "extraction_notes": "ENT operative note for adenotonsillectomy. Classified as \"other\" because a surgical operative report does not map to any enum value (not progress_note, discharge_summary, or pathology_report). Two explicit diagnosis statements captured: PREOPERATIVE DIAGNOSIS and POSTOPERATIVE DIAGNOSIS, both \"Recurrent tonsillitis\" (status preoperative/postoperative). Named procedure \"Adenotonsillectomy\" captured; procedure-detail technique (McIvor mouthgag, adenoid curettes, gold laser tonsillar dissection, saline irrigation, hemostasis) are steps of the single named procedure, not separate procedures. COMPLICATIONS explicitly \"None\" (not a diagnosis). No patient age or sex stated. No vitals, labs, or allergies stated. No medications: \"general endotracheal anesthesia\" names no specific agent and \"saline\" is intraoperative irrigation, neither a named drug order with dose/route. No encounter date printed; department not stated in text (ENT/Otolaryngology specialty was external context only), so left null. No ICD/LOINC codes printed. No patient identifiers present."
612
+ }
613
+ },
614
+ {
615
+ "idx": 10,
616
+ "specialty": "Discharge Summary",
617
+ "gold": {
618
+ "document_type": "discharge_summary",
619
+ "patient": {
620
+ "age": null,
621
+ "sex": "female"
622
+ },
623
+ "encounter": {
624
+ "date": null,
625
+ "department": null
626
+ },
627
+ "vitals": [],
628
+ "labs": [
629
+ {
630
+ "test": "Urine culture",
631
+ "value": "Klebsiella isolated, sensitive to Bactrim",
632
+ "unit": null,
633
+ "reference_range": null,
634
+ "flag": null
635
+ }
636
+ ],
637
+ "medications": [
638
+ {
639
+ "name": "Bactrim",
640
+ "dose": null,
641
+ "route": "p.o.",
642
+ "frequency": null,
643
+ "status": "active"
644
+ },
645
+ {
646
+ "name": "ibuprofen",
647
+ "dose": "two to three tabs",
648
+ "route": null,
649
+ "frequency": "t.i.d.",
650
+ "status": "active"
651
+ }
652
+ ],
653
+ "diagnoses": [
654
+ {
655
+ "code": null,
656
+ "code_system": null,
657
+ "description": "Pyelonephritis",
658
+ "status": "admission diagnosis"
659
+ },
660
+ {
661
+ "code": null,
662
+ "code_system": null,
663
+ "description": "History of uterine cancer and ileal conduit urinary diversion",
664
+ "status": "admission diagnosis"
665
+ },
666
+ {
667
+ "code": null,
668
+ "code_system": null,
669
+ "description": "Hypertension",
670
+ "status": "admission diagnosis"
671
+ },
672
+ {
673
+ "code": null,
674
+ "code_system": null,
675
+ "description": "Renal insufficiency",
676
+ "status": "admission diagnosis"
677
+ },
678
+ {
679
+ "code": null,
680
+ "code_system": null,
681
+ "description": "Anemia",
682
+ "status": "admission diagnosis"
683
+ },
684
+ {
685
+ "code": null,
686
+ "code_system": null,
687
+ "description": "Pyelonephritis likely secondary to mucous plugging of indwelling Foley in the ileal conduit",
688
+ "status": "discharge diagnosis"
689
+ },
690
+ {
691
+ "code": null,
692
+ "code_system": null,
693
+ "description": "Hypertension",
694
+ "status": "discharge diagnosis"
695
+ },
696
+ {
697
+ "code": null,
698
+ "code_system": null,
699
+ "description": "Mild renal insufficiency",
700
+ "status": "discharge diagnosis"
701
+ },
702
+ {
703
+ "code": null,
704
+ "code_system": null,
705
+ "description": "Anemia, which has been present chronically over the past year",
706
+ "status": "discharge diagnosis"
707
+ },
708
+ {
709
+ "code": null,
710
+ "code_system": null,
711
+ "description": "Right knee pain",
712
+ "status": null
713
+ }
714
+ ],
715
+ "procedures": [
716
+ {
717
+ "description": "Irrigation of thick mucous plug in the Foley in the ileal conduit",
718
+ "date": null
719
+ },
720
+ {
721
+ "description": "Further surgery (scheduled)",
722
+ "date": "08/07/2007"
723
+ }
724
+ ],
725
+ "allergies": [],
726
+ "extraction_notes": "Discharge summary with ADMISSION DIAGNOSES, DISCHARGE DIAGNOSES, and HOSPITAL COURSE sections; no demographics, vitals, or allergies stated. Sex 'female' grounded in repeated she/her pronouns plus documented uterine cancer history; age not stated (null). Both admission and discharge diagnosis lists captured verbatim with status matching the section headers; duplicates (Hypertension, Anemia, renal insufficiency) retained because each is explicitly restated in both sections. 'Right knee pain' included as a diagnosis with null status: it is an explicitly stated, clinically managed complaint ('She also complained of right knee pain') that drove the ibuprofen recommendation, though it is not in the numbered lists. Lab: only micro datum is a urine culture growing Klebsiella sensitive to Bactrim ('Klebsiella was isolated in this urine, which was sensitive to Bactrim'). Medications: Bactrim p.o. (discharge med) and ibuprofen two-to-three tabs t.i.d. (advised OTC for knee pain). 'IV antibiotics' excluded per contract because no specific drug name is given. Procedures: irrigation of the mucous plug in the Foley/ileal conduit (no date, performed by provider), and a further surgery scheduled 08/07/2007. encounter.date left null: no admission/discharge date is stated and 08/07/2007 is the future scheduled-surgery date, not the encounter date. Provider names (Dr. X, Dr. Y) and the 7-10 day follow-up are omitted as they are not schema fields / are identifiers."
727
+ }
728
+ },
729
+ {
730
+ "idx": 11,
731
+ "specialty": "Diets and Nutritions",
732
+ "gold": {
733
+ "document_type": "progress_note",
734
+ "patient": {
735
+ "age": 62,
736
+ "sex": "female"
737
+ },
738
+ "encounter": {
739
+ "date": null,
740
+ "department": null
741
+ },
742
+ "vitals": [],
743
+ "labs": [
744
+ {
745
+ "test": "blood sugar",
746
+ "value": "187",
747
+ "unit": null,
748
+ "reference_range": null,
749
+ "flag": null
750
+ },
751
+ {
752
+ "test": "blood sugar",
753
+ "value": "477",
754
+ "unit": null,
755
+ "reference_range": null,
756
+ "flag": null
757
+ },
758
+ {
759
+ "test": "blood sugar",
760
+ "value": "over 600",
761
+ "unit": null,
762
+ "reference_range": null,
763
+ "flag": null
764
+ }
765
+ ],
766
+ "medications": [
767
+ {
768
+ "name": "Humalog",
769
+ "dose": null,
770
+ "frequency": null,
771
+ "route": "injectable and insulin pump",
772
+ "status": "active"
773
+ },
774
+ {
775
+ "name": "insulin",
776
+ "dose": "boluses 5 units at breakfast, 6 units at lunch, 11 units at supper; basal rate 30.5 units per 24 hours",
777
+ "frequency": null,
778
+ "route": "insulin pump",
779
+ "status": "active"
780
+ }
781
+ ],
782
+ "diagnoses": [
783
+ {
784
+ "description": "type I diabetes",
785
+ "code": null,
786
+ "code_system": null,
787
+ "status": "active"
788
+ },
789
+ {
790
+ "description": "DKA",
791
+ "code": null,
792
+ "code_system": null,
793
+ "status": null
794
+ },
795
+ {
796
+ "description": "cold",
797
+ "code": null,
798
+ "code_system": null,
799
+ "status": "active"
800
+ }
801
+ ],
802
+ "procedures": [],
803
+ "allergies": [],
804
+ "extraction_notes": "SOAP-format dietary/nutrition consultation for carbohydrate counting in a 62-year-old female with type I diabetes; classified progress_note (no consultation option in enum). LABS: three patient-reported self-monitored blood-sugar readings (187 at Friday-night bedtime, 477 on waking, over 600 at hospital); no units printed next to these numbers (mg/dl appears only in the correction-dose context 'down 30 mg/dl'), so unit=null; value 'over 600' preserved verbatim. MEDICATIONS: Humalog is named in SUBJECTIVE (she self-administered 70 extra units during the DKA event, 10 injectable and the rest via pump) \u2014 that 70-unit acute self-correction is a one-time event, not a standing dose, so it is not encoded as a med dose; route 'injectable and insulin pump' reflects both delivery methods stated. The OBJECTIVE pump insulin doses (boluses 5/6/11 units at breakfast/lunch/supper and basal 30.5 units per 24 h) are one pump-insulin regimen with two dose components, kept as a single 'insulin' entry rather than split into two records, and not merged with 'Humalog' because the objective section names only 'insulin' (no inference that they are the same drug). DIAGNOSES: type I diabetes (active), DKA (kept as the literal abbreviation printed; not expanded to 'diabetic ketoacidosis'; status null as a recent acute hospitalization event with no explicit resolved statement), cold (active). Recommendations/education are not structured fields and were not encoded: insulin-to-carbohydrate ratio 1 unit per 10 g carbohydrate (per the '500 rule'), correction dose ~1 unit per 30 mg/dl, recommended carbohydrate intake 45 g breakfast / 45 g lunch / 60 g dinner, Lilly meal-planning guide and carbohydrate-counting book provided, one-hour consultation. No encounter date printed (only relative references: Friday, over the weekend, two years ago); no department header. No vitals, procedures, or allergies stated. Provider names (Charla Yassine, Joanne Araiza) are personnel, not the patient, and are omitted per the no-identifier rule; no patient identifiers present."
805
+ }
806
+ },
807
+ {
808
+ "idx": 12,
809
+ "specialty": "Podiatry",
810
+ "gold": {
811
+ "document_type": "other",
812
+ "patient": {
813
+ "age": null,
814
+ "sex": null
815
+ },
816
+ "encounter": {
817
+ "date": null,
818
+ "department": null
819
+ },
820
+ "vitals": [],
821
+ "labs": [],
822
+ "medications": [
823
+ {
824
+ "name": "morphine",
825
+ "dose": null,
826
+ "route": "intravenous",
827
+ "frequency": null,
828
+ "status": "administered"
829
+ },
830
+ {
831
+ "name": "Versed",
832
+ "dose": null,
833
+ "route": "intravenous",
834
+ "frequency": null,
835
+ "status": "administered"
836
+ },
837
+ {
838
+ "name": "Xylocaine",
839
+ "dose": "1%",
840
+ "route": null,
841
+ "frequency": null,
842
+ "status": "administered"
843
+ }
844
+ ],
845
+ "diagnoses": [
846
+ {
847
+ "description": "Painful ingrown toenail, left big toe",
848
+ "code": null,
849
+ "code_system": null,
850
+ "status": "preoperative"
851
+ },
852
+ {
853
+ "description": "Painful ingrown toenail, left big toe",
854
+ "code": null,
855
+ "code_system": null,
856
+ "status": "postoperative"
857
+ }
858
+ ],
859
+ "procedures": [
860
+ {
861
+ "description": "Removal of an ingrown part of the left big toenail with excision of the nail matrix",
862
+ "date": null
863
+ }
864
+ ],
865
+ "allergies": [],
866
+ "extraction_notes": "Podiatry operative/procedure note; the document_type enum has no operative-note option, so classified as 'other'. No patient age or sex stated; no encounter date printed. encounter.department left null: 'Same Day Surgery' is named only as the post-op recovery destination ('sent back to Same Day Surgery for recovery') and 'minor OR room' as the procedure location, neither is explicitly labeled as the encounter department, so no department is grounded. Medications explicitly administered intraoperatively: morphine and Versed via IV ('intravenous sedation with morphine and Versed was performed') and 1% Xylocaine as a local toe block ('the toe was blocked with 1% Xylocaine'); status='administered' for all three because the giving of each drug is explicitly described. Xylocaine '1%' captured as dose/concentration exactly as written; Xylocaine route left null (described only as a toe block, no standard route term stated). Preoperative and postoperative diagnoses are identical (Painful ingrown toenail, left big toe) and captured separately with their explicit status labels from the note. 'Estimated blood loss was negligible' is not a numeric vital, so not recorded. Additional procedural details (skin flap over matrix, hemostasis with cautery, tubular/bulky dressing) are part of the single procedure narrative and not itemized separately. No labs, vitals, or allergies stated. No patient identifiers present in source."
867
+ }
868
+ },
869
+ {
870
+ "idx": 13,
871
+ "specialty": "Cardiovascular / Pulmonary",
872
+ "gold": {
873
+ "document_type": "pathology_report",
874
+ "patient": {
875
+ "age": null,
876
+ "sex": null
877
+ },
878
+ "encounter": {
879
+ "date": null,
880
+ "department": null
881
+ },
882
+ "vitals": [],
883
+ "labs": [
884
+ {
885
+ "test": "P53 immunohistochemical stain",
886
+ "value": "negative",
887
+ "unit": null,
888
+ "reference_range": null,
889
+ "flag": null
890
+ }
891
+ ],
892
+ "medications": [],
893
+ "diagnoses": [
894
+ {
895
+ "description": "Probable right upper lobe lung adenocarcinoma",
896
+ "status": "probable",
897
+ "code": null,
898
+ "code_system": null
899
+ },
900
+ {
901
+ "description": "Right lung, upper lobe, lobectomy: Bronchioloalveolar carcinoma, mucinous type",
902
+ "status": "final",
903
+ "code": null,
904
+ "code_system": null
905
+ },
906
+ {
907
+ "description": "Non-neoplastic lung: Emphysema",
908
+ "status": null,
909
+ "code": null,
910
+ "code_system": null
911
+ }
912
+ ],
913
+ "procedures": [
914
+ {
915
+ "description": "Lung, right upper lobe resection (lobectomy)",
916
+ "date": null
917
+ },
918
+ {
919
+ "description": "Frozen section",
920
+ "date": null
921
+ }
922
+ ],
923
+ "allergies": [],
924
+ "extraction_notes": "Surgical pathology report (frozen section + final diagnosis) for a right upper lobe lung lobectomy specimen. No patient demographics or identifiers are stated, so patient.age/sex and encounter.date/department are null. Three diagnoses captured: the clinical-history 'probable' adenocarcinoma, the final diagnosis (bronchioloalveolar carcinoma, mucinous type), and the non-neoplastic finding of emphysema; no ICD/other codes are printed. The P53 immunohistochemical stain (result: negative in the tumor) is the only test+value, recorded as a lab. Two procedures are grounded: the right upper lobe resection/lobectomy and the intraoperative frozen section ('received fresh for frozen section'); no dates given. Synoptic/gross pathology parameters are stated but have no appropriate structured field and were NOT forced into labs (they are not laboratory test values): tumor size (greatest diameter) 3.6 cm; gross mass 3.6 x 3.3 x 2.7 cm, 3.7 cm from closest surgical margin and 3.9 cm from hilum; lobectomy specimen 16.1 x 10.6 x 4.5 cm; histologic grade well differentiated; blood/lymphatic vessel invasion absent; perineural invasion absent; bronchial, vascular, and inked surgical margins negative; visceral pleura not involved (tumor abuts but does not invade through; overlying pleura puckered); in situ carcinoma absent; hilar lymph nodes positive 0 of total 1; no necrosis or hemorrhage. No medications, allergies, or vitals present."
925
+ }
926
+ },
927
+ {
928
+ "idx": 16,
929
+ "specialty": "Neurosurgery",
930
+ "gold": {
931
+ "document_type": "other",
932
+ "patient": {
933
+ "age": 51,
934
+ "sex": "male"
935
+ },
936
+ "encounter": {
937
+ "date": null,
938
+ "department": null
939
+ },
940
+ "vitals": [],
941
+ "labs": [],
942
+ "medications": [],
943
+ "diagnoses": [
944
+ {
945
+ "description": "Severe low back pain",
946
+ "status": "preoperative",
947
+ "code": null,
948
+ "code_system": null
949
+ },
950
+ {
951
+ "description": "Severe low back pain",
952
+ "status": "postoperative",
953
+ "code": null,
954
+ "code_system": null
955
+ },
956
+ {
957
+ "description": "very degenerated disk at L5-S1, less so at L3-L4 and L4-L5",
958
+ "status": null,
959
+ "code": null,
960
+ "code_system": null
961
+ }
962
+ ],
963
+ "procedures": [
964
+ {
965
+ "description": "Anterior lumbar fusion, L4-L5, L5-S1, PEEK vertebral spacer, structural autograft from L5 vertebral body, BMP and anterior plate",
966
+ "date": null
967
+ }
968
+ ],
969
+ "allergies": [],
970
+ "extraction_notes": "Operative/surgical report (anterior lumbar interbody fusion); no enum value fits an op note, so document_type=other. Patient from summary \"This is a 51-year-old man\" -> age 51, sex male. Preoperative and postoperative diagnoses both \"Severe low back pain\" captured with respective status; the MRI-stated finding \"very degenerated disk at L5-S1, less so at L3-L4 and L4-L5\" captured as an additional diagnosis (status null). Procedure taken verbatim from the OPERATIONS PERFORMED line; no procedure date printed. Surgical implants/biologics (13-mm PEEK vertebral spacers, structural autograft, BMP, 15x20-mm Chronos VerteFill tricalcium phosphate plug, 87-mm Integra sacral plate/screws) are hardware/graft materials, not administered medications, so medications=[]. Anesthesia \"General endotracheal\" names no drug. \"Estimated blood loss: Less than 50 mL\", drains none, complications none are operative details, not vital signs -> vitals=[]. No labs, allergies, encounter date, or department stated. Historical items noted but not extracted as procedures (prior physical therapy, epidural steroid injections, MRI, positive discogram at lower 3 levels). Surgeon reference \"Dr. X\" excluded as a non-patient/provider identifier."
971
+ }
972
+ },
973
+ {
974
+ "idx": 17,
975
+ "specialty": "Neurology",
976
+ "gold": {
977
+ "document_type": "progress_note",
978
+ "patient": {
979
+ "age": 51,
980
+ "sex": "female"
981
+ },
982
+ "encounter": {
983
+ "date": "1/5/93",
984
+ "department": null
985
+ },
986
+ "vitals": [
987
+ {
988
+ "name": "BP",
989
+ "value": "164/82",
990
+ "unit": null
991
+ },
992
+ {
993
+ "name": "HR",
994
+ "value": "64",
995
+ "unit": null
996
+ },
997
+ {
998
+ "name": "RR",
999
+ "value": "18",
1000
+ "unit": null
1001
+ },
1002
+ {
1003
+ "name": "Temperature",
1004
+ "value": "36.0",
1005
+ "unit": "C"
1006
+ }
1007
+ ],
1008
+ "labs": [],
1009
+ "medications": [
1010
+ {
1011
+ "name": "Micronase",
1012
+ "dose": "5mg",
1013
+ "route": null,
1014
+ "frequency": "qd",
1015
+ "status": "active"
1016
+ },
1017
+ {
1018
+ "name": "HCTZ",
1019
+ "dose": null,
1020
+ "route": null,
1021
+ "frequency": null,
1022
+ "status": "active"
1023
+ },
1024
+ {
1025
+ "name": "ASA",
1026
+ "dose": null,
1027
+ "route": null,
1028
+ "frequency": null,
1029
+ "status": "discontinued"
1030
+ }
1031
+ ],
1032
+ "diagnoses": [
1033
+ {
1034
+ "description": "DM type 2",
1035
+ "code": null,
1036
+ "code_system": null,
1037
+ "status": null
1038
+ },
1039
+ {
1040
+ "description": "HTN",
1041
+ "code": null,
1042
+ "code_system": null,
1043
+ "status": null
1044
+ },
1045
+ {
1046
+ "description": "DJD",
1047
+ "code": null,
1048
+ "code_system": null,
1049
+ "status": null
1050
+ },
1051
+ {
1052
+ "description": "retinal detachment",
1053
+ "code": null,
1054
+ "code_system": null,
1055
+ "status": null
1056
+ },
1057
+ {
1058
+ "description": "hypodensity in the left caudate consistent with ischemic change",
1059
+ "code": null,
1060
+ "code_system": null,
1061
+ "status": null
1062
+ },
1063
+ {
1064
+ "description": "RACA territory stroke with recurrent artery of Heubner involvement",
1065
+ "code": null,
1066
+ "code_system": null,
1067
+ "status": "suspected"
1068
+ }
1069
+ ],
1070
+ "procedures": [
1071
+ {
1072
+ "description": "Vitrectomy and retinal traction OU",
1073
+ "date": "7/92"
1074
+ },
1075
+ {
1076
+ "description": "Cholecystemomy",
1077
+ "date": "1968"
1078
+ },
1079
+ {
1080
+ "description": "Cataract implant OU",
1081
+ "date": "1992"
1082
+ },
1083
+ {
1084
+ "description": "C-section",
1085
+ "date": null
1086
+ },
1087
+ {
1088
+ "description": "EKG",
1089
+ "date": "1/5/93"
1090
+ },
1091
+ {
1092
+ "description": "CXR",
1093
+ "date": "1/5/93"
1094
+ },
1095
+ {
1096
+ "description": "HCT (head CT)",
1097
+ "date": "1/5/93"
1098
+ },
1099
+ {
1100
+ "description": "Carotid Duplex",
1101
+ "date": null
1102
+ },
1103
+ {
1104
+ "description": "Transthoracic echocardiogram",
1105
+ "date": null
1106
+ }
1107
+ ],
1108
+ "allergies": [],
1109
+ "extraction_notes": "Neurology admission H&P/progress note (UIHC); classified progress_note (no discharge disposition/date). Patient = 51 y/o RHF (right-handed female); age and sex only, no identifiers. Encounter date = 1/5/93 (came to UIHC for evaluation; also fell 1/3/93 and 1/4/93). Department not printed in the note text, so null. labs=[] because CBC, GS (including glucose), and PT/PTT are reported only collectively as 'unremarkable' with no discrete test+value pairs; no numeric lab values appear anywhere. Vitals BP 164/82, HR 64, RR 18, Temp 36.0 C taken verbatim from the EXAM line. Medications: Micronase 5mg qd active and HCTZ active; ASA discontinued ('quit ASA 6 months ago'). Diagnoses from PMH and assessment; DM type 2, HTN, DJD, retinal detachment carry no explicit status word so status=null; caudate hypodensity is a definite CT finding (hedge already in description) so status=null; RACA territory stroke marked 'suspected' per explicit hedge 'would invoke.' Excluded family-history conditions (grand aunt stroke; MG CAD; mother CAD/MI; father CA; sisters HTN) as they belong to relatives; excluded symptoms/exam findings (right leg/facial weakness, unsteady wide-based gait, breakaway weakness, RUE fisted posture) as signs/symptoms, not diagnosis statements. Surgical history and diagnostic studies captured as procedures with clean names + dates; the OCR-typo 'Cholecystemomy' is preserved exactly as written (NOT corrected), and the 's/p' status prefix was dropped from procedure names. Carotid Duplex findings (0-15% RICA, 16-49% LICA; antegrade vertebral flow bilaterally) and echocardiogram findings (borderline LV hypertrophy, normal LV function, no valvular abnormality/thrombus) are grounded but left as study context, not elevated to separate diagnoses, since they are mild/borderline and not stated as explicit diagnosis statements. No allergies stated (ASA stopped by preference, not allergy). No ICD/LOINC codes printed."
1110
+ }
1111
+ },
1112
+ {
1113
+ "idx": 18,
1114
+ "specialty": "Speech - Language",
1115
+ "gold": {
1116
+ "document_type": "progress_note",
1117
+ "patient": {
1118
+ "age": 60,
1119
+ "sex": "female"
1120
+ },
1121
+ "encounter": {
1122
+ "date": null,
1123
+ "department": null
1124
+ },
1125
+ "vitals": [],
1126
+ "labs": [],
1127
+ "medications": [],
1128
+ "diagnoses": [
1129
+ {
1130
+ "description": "hypertension",
1131
+ "status": "history",
1132
+ "code": null,
1133
+ "code_system": null
1134
+ },
1135
+ {
1136
+ "description": "TIA/stroke",
1137
+ "status": "history",
1138
+ "code": null,
1139
+ "code_system": null
1140
+ },
1141
+ {
1142
+ "description": "mild-to-moderate cognitive linguistic deficit",
1143
+ "status": null,
1144
+ "code": null,
1145
+ "code_system": null
1146
+ },
1147
+ {
1148
+ "description": "Penetration with cup sips of thin liquid",
1149
+ "status": null,
1150
+ "code": null,
1151
+ "code_system": null
1152
+ },
1153
+ {
1154
+ "description": "globus sensation",
1155
+ "status": null,
1156
+ "code": null,
1157
+ "code_system": null
1158
+ },
1159
+ {
1160
+ "description": "reduced peristaltic action of the constricted muscles in the esophagus",
1161
+ "status": null,
1162
+ "code": null,
1163
+ "code_system": null
1164
+ }
1165
+ ],
1166
+ "procedures": [
1167
+ {
1168
+ "description": "Modified barium swallow study",
1169
+ "date": null
1170
+ },
1171
+ {
1172
+ "description": "Outpatient evaluation revealing mild-to-moderate cognitive linguistic deficit",
1173
+ "date": "approximately 2 months ago"
1174
+ }
1175
+ ],
1176
+ "allergies": [],
1177
+ "extraction_notes": "Speech-language pathology Modified Barium Swallow (video fluoroscopic) study report in SOAP format (SUBJECTIVE/OBJECTIVE/ASSESSMENT/PLAN); classified as progress_note. Patient is a 60-year-old female (stated). No encounter date printed. No named department; study performed in the 'Radiology Suite' (a location, not a stated department) in cooperation with 'Dr. ABC' (redacted provider name, not extracted) \u2014 department left null. No vitals, labs, medications, or allergies stated. Barium was administered as an imaging contrast agent (mixed with liquid/food), not prescribed as a therapeutic drug with dose/route, so medications is empty; the '90-degree angle for at least 45 minutes' upright positioning is a PLAN recommendation, not a vital sign. Diagnoses: past history (hypertension, TIA/stroke); prior finding (mild-to-moderate cognitive linguistic deficit); formal diagnostic impression (Penetration with cup sips of thin liquid); patient complaint of globus sensation; and the radiologist-noted reduced peristaltic action of the constricted esophageal muscles (an explicit positive abnormal finding, tied to the globus complaint). EXCLUDED: 'No aspiration' \u2014 explicitly negated finding, not a present condition; heartburn/gastroesophageal reflux disorder \u2014 explicitly DENIED by the patient. Coughing during meals is the presenting symptom and was not captured as a formal diagnosis. Procedures: the current modified barium swallow study (no date given) and the prior outpatient evaluation completed 'approximately 2 months ago' (grounded, date preserved verbatim). Plan: small bites/sips, upright positioning, referral to a gastroenterologist, and discharge from speech therapy (no skilled speech therapy needed at this time). No patient identifiers included per contract."
1178
+ }
1179
+ },
1180
+ {
1181
+ "idx": 19,
1182
+ "specialty": "General Medicine",
1183
+ "gold": {
1184
+ "document_type": "progress_note",
1185
+ "patient": {
1186
+ "age": 48,
1187
+ "sex": "male"
1188
+ },
1189
+ "encounter": {
1190
+ "date": null,
1191
+ "department": "Nephrology"
1192
+ },
1193
+ "vitals": [
1194
+ {
1195
+ "name": "Blood pressure",
1196
+ "value": "180/110",
1197
+ "unit": null
1198
+ },
1199
+ {
1200
+ "name": "Temperature",
1201
+ "value": "98.1",
1202
+ "unit": null
1203
+ },
1204
+ {
1205
+ "name": "Pulse rate",
1206
+ "value": "60",
1207
+ "unit": null
1208
+ },
1209
+ {
1210
+ "name": "Respiratory rate",
1211
+ "value": "23",
1212
+ "unit": null
1213
+ },
1214
+ {
1215
+ "name": "O2 sat",
1216
+ "value": "95",
1217
+ "unit": "%"
1218
+ }
1219
+ ],
1220
+ "labs": [
1221
+ {
1222
+ "test": "WBC",
1223
+ "value": "7",
1224
+ "unit": null,
1225
+ "reference_range": null,
1226
+ "flag": null
1227
+ },
1228
+ {
1229
+ "test": "H and H",
1230
+ "value": "13 and 40",
1231
+ "unit": null,
1232
+ "reference_range": null,
1233
+ "flag": null
1234
+ },
1235
+ {
1236
+ "test": "platelets",
1237
+ "value": "330",
1238
+ "unit": null,
1239
+ "reference_range": null,
1240
+ "flag": null
1241
+ },
1242
+ {
1243
+ "test": "PT",
1244
+ "value": "12",
1245
+ "unit": null,
1246
+ "reference_range": null,
1247
+ "flag": null
1248
+ },
1249
+ {
1250
+ "test": "PTT",
1251
+ "value": "26",
1252
+ "unit": null,
1253
+ "reference_range": null,
1254
+ "flag": null
1255
+ },
1256
+ {
1257
+ "test": "CO2",
1258
+ "value": "20",
1259
+ "unit": null,
1260
+ "reference_range": null,
1261
+ "flag": null
1262
+ },
1263
+ {
1264
+ "test": "BUN",
1265
+ "value": "27",
1266
+ "unit": null,
1267
+ "reference_range": null,
1268
+ "flag": null
1269
+ },
1270
+ {
1271
+ "test": "creatinine",
1272
+ "value": "3.1",
1273
+ "unit": null,
1274
+ "reference_range": null,
1275
+ "flag": null
1276
+ },
1277
+ {
1278
+ "test": "cholesterol",
1279
+ "value": "174",
1280
+ "unit": null,
1281
+ "reference_range": null,
1282
+ "flag": null
1283
+ },
1284
+ {
1285
+ "test": "BNP",
1286
+ "value": "973",
1287
+ "unit": null,
1288
+ "reference_range": null,
1289
+ "flag": null
1290
+ },
1291
+ {
1292
+ "test": "troponin",
1293
+ "value": "0.18",
1294
+ "unit": null,
1295
+ "reference_range": null,
1296
+ "flag": null
1297
+ },
1298
+ {
1299
+ "test": "Previous creatinine",
1300
+ "value": "2.7",
1301
+ "unit": null,
1302
+ "reference_range": null,
1303
+ "flag": null
1304
+ },
1305
+ {
1306
+ "test": "Urine drug screen",
1307
+ "value": "positive for cocaine",
1308
+ "unit": null,
1309
+ "reference_range": null,
1310
+ "flag": null
1311
+ }
1312
+ ],
1313
+ "medications": [
1314
+ {
1315
+ "name": "Clonidine",
1316
+ "dose": "0.3",
1317
+ "route": "p.o.",
1318
+ "frequency": "q.8",
1319
+ "status": null
1320
+ },
1321
+ {
1322
+ "name": "aspirin",
1323
+ "dose": "325",
1324
+ "route": null,
1325
+ "frequency": "daily",
1326
+ "status": null
1327
+ },
1328
+ {
1329
+ "name": "hydralazine",
1330
+ "dose": "100",
1331
+ "route": null,
1332
+ "frequency": "q.8",
1333
+ "status": null
1334
+ },
1335
+ {
1336
+ "name": "Lipitor",
1337
+ "dose": "20",
1338
+ "route": null,
1339
+ "frequency": "at bedtime",
1340
+ "status": null
1341
+ },
1342
+ {
1343
+ "name": "Toprol XL",
1344
+ "dose": "100",
1345
+ "route": null,
1346
+ "frequency": "daily",
1347
+ "status": null
1348
+ }
1349
+ ],
1350
+ "diagnoses": [
1351
+ {
1352
+ "description": "Coronary artery disease",
1353
+ "code": null,
1354
+ "code_system": null,
1355
+ "status": "history"
1356
+ },
1357
+ {
1358
+ "description": "COPD",
1359
+ "code": null,
1360
+ "code_system": null,
1361
+ "status": "history"
1362
+ },
1363
+ {
1364
+ "description": "Congestive heart failure with ejection fraction of 20%-25%",
1365
+ "code": null,
1366
+ "code_system": null,
1367
+ "status": "history"
1368
+ },
1369
+ {
1370
+ "description": "Hypertension",
1371
+ "code": null,
1372
+ "code_system": null,
1373
+ "status": "history"
1374
+ },
1375
+ {
1376
+ "description": "Renal insufficiency",
1377
+ "code": null,
1378
+ "code_system": null,
1379
+ "status": "history"
1380
+ },
1381
+ {
1382
+ "description": "Recurrent episodes of hypertensive emergency",
1383
+ "code": null,
1384
+ "code_system": null,
1385
+ "status": "history"
1386
+ },
1387
+ {
1388
+ "description": "Hypertensive emergency",
1389
+ "code": null,
1390
+ "code_system": null,
1391
+ "status": "active"
1392
+ },
1393
+ {
1394
+ "description": "Acute on chronic renal failure",
1395
+ "code": null,
1396
+ "code_system": null,
1397
+ "status": "active"
1398
+ },
1399
+ {
1400
+ "description": "CHF versus COPD exacerbation",
1401
+ "code": null,
1402
+ "code_system": null,
1403
+ "status": "suspected"
1404
+ },
1405
+ {
1406
+ "description": "Chronic cocaine abuse",
1407
+ "code": null,
1408
+ "code_system": null,
1409
+ "status": "active"
1410
+ }
1411
+ ],
1412
+ "procedures": [],
1413
+ "allergies": [],
1414
+ "extraction_notes": "Nephrology consultation note (reason for consult: renal insufficiency); classified as progress_note (no 'consult' enum value). No encounter date is printed (December 2005 = CHF EF onset; 'December' = timing of a prior creatinine, neither is the encounter date). Department 'Nephrology' per 'Nephrology is consulted regarding renal insufficiency.' Patient is a 48-year-old African-American male; per contract only age/sex captured (race/ethnicity not part of patient object; no identifiers present). Allergies 'NO KNOWN DRUG ALLERGIES' is a negative finding, so allergies=[]. O2 sat recorded as value '95' unit '%'; 'on room air' is a measurement condition, not a unit, and there is no field for it, so it is dropped. 'H and H 13 and 40' preserved verbatim (clinically Hemoglobin 13 / Hematocrit 40) rather than split. Previous creatinine 2.7 captured as a separate lab; the 'in December' qualifier is not folded into the test name (no lab-date field). Urine drug screen captured as a lab (value 'positive for cocaine'); assessment item 'Urine drug screen positive' treated as this lab finding, not a diagnosis. 'Chronic cocaine abuse' captured as a diagnosis (cited as etiology in the plan). 'Question CHF versus COPD exacerbation' status normalized to 'suspected' (questioned/differential, unconfirmed). No lab units, reference ranges, or H/L flags were printed. Medication statuses not labeled, left null; doses carried no printed units. No procedures documented (physical exam findings are not procedures). No ICD/LOINC codes printed, so all codes left null."
1415
+ }
1416
+ },
1417
+ {
1418
+ "idx": 20,
1419
+ "specialty": "Urology",
1420
+ "gold": {
1421
+ "document_type": "other",
1422
+ "patient": {
1423
+ "age": 52,
1424
+ "sex": "male"
1425
+ },
1426
+ "encounter": {
1427
+ "date": null,
1428
+ "department": null
1429
+ },
1430
+ "vitals": [],
1431
+ "labs": [],
1432
+ "medications": [],
1433
+ "diagnoses": [
1434
+ {
1435
+ "description": "Adrenal mass, right sided",
1436
+ "code": null,
1437
+ "code_system": null,
1438
+ "status": "preoperative"
1439
+ },
1440
+ {
1441
+ "description": "Umbilical hernia",
1442
+ "code": null,
1443
+ "code_system": null,
1444
+ "status": "preoperative"
1445
+ },
1446
+ {
1447
+ "description": "Adrenal mass, right sided",
1448
+ "code": null,
1449
+ "code_system": null,
1450
+ "status": "postoperative"
1451
+ },
1452
+ {
1453
+ "description": "Umbilical hernia",
1454
+ "code": null,
1455
+ "code_system": null,
1456
+ "status": "postoperative"
1457
+ }
1458
+ ],
1459
+ "procedures": [
1460
+ {
1461
+ "description": "Laparoscopic hand-assisted left adrenalectomy and umbilical hernia repair",
1462
+ "date": null
1463
+ }
1464
+ ],
1465
+ "allergies": [],
1466
+ "extraction_notes": "Surgical operative note; no enum matches an operative report, so document_type mapped to \"other\". Age 52 explicit (\"52-year-old inmate\"); sex male grounded in pronoun \"his\" (\"mass in his right adrenal\"). \"inmate\" is not a schema field/identifier, omitted. No patient identifiers present. Encounter date and department not printed in the document (Urology specialty was external metadata, so department left null). Diagnoses appear in both PREOPERATIVE DIAGNOSES and POSTOPERATIVE DIAGNOSES sections (identical); all four instances captured with status to preserve the stated distinction. Internal source discrepancy preserved as written: diagnoses/clinical note reference a RIGHT-sided 5.5 cm nonfunctioning adrenal mass and \"right flank-up position\", while OPERATION PERFORMED states \"left adrenalectomy\" \u2014 values not corrected. Anesthesia \"General\" is not a drug name; surgical materials (Vicryl, Bovie, harmonic scalpel, GelPort, Foley catheter, trocars, clips) are not medications, so medications empty. No test+value pairs, so labs empty. No vital signs; \"Estimated blood loss less than 100 mL\" is an operative measurement, not a vital sign, so vitals empty. No allergies stated."
1467
+ }
1468
+ },
1469
+ {
1470
+ "idx": 21,
1471
+ "specialty": "Nephrology",
1472
+ "gold": {
1473
+ "document_type": "other",
1474
+ "patient": {
1475
+ "age": null,
1476
+ "sex": "male"
1477
+ },
1478
+ "encounter": {
1479
+ "date": null,
1480
+ "department": null
1481
+ },
1482
+ "vitals": [],
1483
+ "labs": [],
1484
+ "medications": [],
1485
+ "diagnoses": [
1486
+ {
1487
+ "code": null,
1488
+ "code_system": null,
1489
+ "description": "Right renal mass",
1490
+ "status": "preoperative"
1491
+ },
1492
+ {
1493
+ "code": null,
1494
+ "code_system": null,
1495
+ "description": "Right renal mass",
1496
+ "status": "postoperative"
1497
+ }
1498
+ ],
1499
+ "procedures": [
1500
+ {
1501
+ "date": null,
1502
+ "description": "Right radical nephrectomy and assisted laparoscopic approach"
1503
+ }
1504
+ ],
1505
+ "allergies": [],
1506
+ "extraction_notes": "Surgical operative note (right radical nephrectomy, hand-assisted laparoscopic approach). No enum value fits an operative report, so document_type=\"other\". Sex=\"male\" grounded in repeated masculine pronouns (\"He was placed...\", \"He was widely shaved\"); age not stated (null). No encounter date or department stated. Diagnoses captured as PREOPERATIVE and POSTOPERATIVE \"Right renal mass\", identical text but kept as separate entries to preserve stated status. Procedure taken verbatim from the PROCEDURE line. Anesthesia \"General\" is an anesthesia type, not a named drug, and has no schema field, so no medication extracted. Surgical supplies/instruments (Surgicel, 0 Vicryl, Harmonic scalpel, stapler, Pneumo sleeve, trocars, Foley catheter, orogastric tube) are devices/supplies, not medications. Intraoperative steps (ureter division, renal artery/vein ligation) are steps within the nephrectomy, not separately documented procedures. Estimated blood loss \"negligible\" is qualitative with no numeric value, so not captured as a lab/vital. No vitals, labs, or allergies stated. No patient identifiers present."
1507
+ }
1508
+ },
1509
+ {
1510
+ "idx": 22,
1511
+ "specialty": "Dentistry",
1512
+ "gold": {
1513
+ "document_type": "other",
1514
+ "patient": {
1515
+ "age": null,
1516
+ "sex": null
1517
+ },
1518
+ "encounter": {
1519
+ "date": null,
1520
+ "department": null
1521
+ },
1522
+ "vitals": [],
1523
+ "labs": [],
1524
+ "medications": [],
1525
+ "diagnoses": [
1526
+ {
1527
+ "description": "Right buccal space infection and abscess tooth #T",
1528
+ "status": "preoperative",
1529
+ "code": null,
1530
+ "code_system": null
1531
+ },
1532
+ {
1533
+ "description": "Right buccal space infection and abscess tooth #T",
1534
+ "status": "postoperative",
1535
+ "code": null,
1536
+ "code_system": null
1537
+ }
1538
+ ],
1539
+ "procedures": [
1540
+ {
1541
+ "description": "Extraction of tooth #T",
1542
+ "date": null
1543
+ },
1544
+ {
1545
+ "description": "Incision and drainage (I&D) of right buccal space infection",
1546
+ "date": null
1547
+ }
1548
+ ],
1549
+ "allergies": [],
1550
+ "extraction_notes": "Dental/oral surgery operative note; no enum fits 'operative note' so document_type='other'. Preoperative and postoperative diagnoses are identical ('Right buccal space infection and abscess tooth #T'), captured as two diagnosis entries with respective status. Combined procedure header split into two procedure entries (extraction of tooth #T; incision and drainage of right buccal space infection); no procedure date stated. Specimens/cultures (aerobic and anaerobic cultures, culture swabs, and the tooth) were sent to the laboratory for culture and sensitivity testing, but NO result/value is reported, so no labs (a lab requires test+value). Anesthesia was 'General, oral endotracheal tube' and IV fluid 150 mL are not drug names, so medications is empty. Intraoperative figures (IV fluid 150 mL, estimated blood loss 10 mL, ~1 mL purulent aspirate) are procedure metrics, not vital signs, so vitals is empty. Complications: none. No patient age/sex, encounter date, department, allergies, or identifiers stated in the document."
1551
+ }
1552
+ },
1553
+ {
1554
+ "idx": 23,
1555
+ "specialty": "Obstetrics / Gynecology",
1556
+ "gold": {
1557
+ "document_type": "other",
1558
+ "patient": {
1559
+ "age": null,
1560
+ "sex": null
1561
+ },
1562
+ "encounter": {
1563
+ "date": null,
1564
+ "department": null
1565
+ },
1566
+ "vitals": [],
1567
+ "labs": [],
1568
+ "medications": [],
1569
+ "diagnoses": [
1570
+ {
1571
+ "code": null,
1572
+ "code_system": null,
1573
+ "description": "Ovarian cyst, persistent",
1574
+ "status": "preoperative"
1575
+ },
1576
+ {
1577
+ "code": null,
1578
+ "code_system": null,
1579
+ "description": "Ovarian cyst",
1580
+ "status": "postoperative"
1581
+ }
1582
+ ],
1583
+ "procedures": [
1584
+ {
1585
+ "date": null,
1586
+ "description": "Diagnostic laparoscopy and drainage of cyst"
1587
+ }
1588
+ ],
1589
+ "allergies": [],
1590
+ "extraction_notes": "Gynecologic operative/procedure note; document_type='other' since an operative report is not among the enumerated types. Preoperative diagnosis 'Ovarian cyst, persistent' and postoperative diagnosis 'Ovarian cyst' captured as two diagnoses with pre/postoperative status. Named operation 'Diagnostic laparoscopy and drainage of cyst' captured as a single procedure; intraoperative steps (infraumbilical incision, Veress needle, second trocar, 3-cm left ovarian cyst needled and incised) are components of that operation and not split into separate entries. Anesthesia documented as 'General' with no specific drug named, so no medication entry (a medication requires a drug name). Sex not printed (ovarian cyst implies female but that is inference, disallowed), so sex=null. No age, dates, department, vitals, labs, or allergies stated. No patient identifiers present."
1591
+ }
1592
+ },
1593
+ {
1594
+ "idx": 24,
1595
+ "specialty": "Psychiatry / Psychology",
1596
+ "gold": {
1597
+ "document_type": "discharge_summary",
1598
+ "patient": {
1599
+ "age": 82,
1600
+ "sex": "female"
1601
+ },
1602
+ "encounter": {
1603
+ "date": null,
1604
+ "department": null
1605
+ },
1606
+ "vitals": [],
1607
+ "labs": [],
1608
+ "medications": [
1609
+ {
1610
+ "name": "Tylenol",
1611
+ "dose": "650 mg",
1612
+ "route": null,
1613
+ "frequency": "q.6h. p.r.n.",
1614
+ "status": "discharge"
1615
+ },
1616
+ {
1617
+ "name": "Xanax",
1618
+ "dose": "0.5",
1619
+ "route": null,
1620
+ "frequency": "q.4h. p.r.n.",
1621
+ "status": "discharge"
1622
+ },
1623
+ {
1624
+ "name": "Lasix",
1625
+ "dose": "80 mg",
1626
+ "route": null,
1627
+ "frequency": "daily",
1628
+ "status": "discharge"
1629
+ },
1630
+ {
1631
+ "name": "Isordil",
1632
+ "dose": "10 mg",
1633
+ "route": null,
1634
+ "frequency": "t.i.d.",
1635
+ "status": "discharge"
1636
+ },
1637
+ {
1638
+ "name": "KCl",
1639
+ "dose": "20 mEq",
1640
+ "route": null,
1641
+ "frequency": "b.i.d.",
1642
+ "status": "discharge"
1643
+ },
1644
+ {
1645
+ "name": "lactulose",
1646
+ "dose": "10 g",
1647
+ "route": null,
1648
+ "frequency": "daily",
1649
+ "status": "discharge"
1650
+ },
1651
+ {
1652
+ "name": "Cozaar",
1653
+ "dose": "50 mg",
1654
+ "route": null,
1655
+ "frequency": "daily",
1656
+ "status": "discharge"
1657
+ },
1658
+ {
1659
+ "name": "Synthroid",
1660
+ "dose": "75 mcg",
1661
+ "route": null,
1662
+ "frequency": "daily",
1663
+ "status": "discharge"
1664
+ },
1665
+ {
1666
+ "name": "Singulair",
1667
+ "dose": "10 mg",
1668
+ "route": null,
1669
+ "frequency": "daily",
1670
+ "status": "discharge"
1671
+ },
1672
+ {
1673
+ "name": "Lumigan",
1674
+ "dose": "one drop",
1675
+ "route": "both eyes",
1676
+ "frequency": "at bed time",
1677
+ "status": "discharge"
1678
+ },
1679
+ {
1680
+ "name": "NitroQuick",
1681
+ "dose": null,
1682
+ "route": null,
1683
+ "frequency": "p.r.n.",
1684
+ "status": "discharge"
1685
+ },
1686
+ {
1687
+ "name": "Pravachol",
1688
+ "dose": "20 mg",
1689
+ "route": null,
1690
+ "frequency": "daily",
1691
+ "status": "discharge"
1692
+ },
1693
+ {
1694
+ "name": "Feldene",
1695
+ "dose": "20 mg",
1696
+ "route": null,
1697
+ "frequency": "daily",
1698
+ "status": "discharge"
1699
+ },
1700
+ {
1701
+ "name": "Paxil",
1702
+ "dose": "20 mg",
1703
+ "route": null,
1704
+ "frequency": "daily",
1705
+ "status": "discharge"
1706
+ },
1707
+ {
1708
+ "name": "Minipress",
1709
+ "dose": "2 mg",
1710
+ "route": null,
1711
+ "frequency": "daily",
1712
+ "status": "discharge"
1713
+ },
1714
+ {
1715
+ "name": "Provera",
1716
+ "dose": null,
1717
+ "route": null,
1718
+ "frequency": "p.r.n.",
1719
+ "status": "discharge"
1720
+ },
1721
+ {
1722
+ "name": "Advair",
1723
+ "dose": "250/50",
1724
+ "route": null,
1725
+ "frequency": "one puff b.i.d.",
1726
+ "status": "discharge"
1727
+ },
1728
+ {
1729
+ "name": "Senokot",
1730
+ "dose": "one tablet",
1731
+ "route": null,
1732
+ "frequency": "b.i.d.",
1733
+ "status": "discharge"
1734
+ },
1735
+ {
1736
+ "name": "Timoptic",
1737
+ "dose": "one drop",
1738
+ "route": "OU",
1739
+ "frequency": "daily",
1740
+ "status": "discharge"
1741
+ },
1742
+ {
1743
+ "name": "verapamil",
1744
+ "dose": "80 mg",
1745
+ "route": null,
1746
+ "frequency": "b.i.d.",
1747
+ "status": "discharge"
1748
+ },
1749
+ {
1750
+ "name": "Darvocet",
1751
+ "dose": null,
1752
+ "route": null,
1753
+ "frequency": null,
1754
+ "status": "home"
1755
+ }
1756
+ ],
1757
+ "diagnoses": [
1758
+ {
1759
+ "code": null,
1760
+ "code_system": null,
1761
+ "description": "Falls",
1762
+ "status": null
1763
+ },
1764
+ {
1765
+ "code": null,
1766
+ "code_system": null,
1767
+ "description": "Anxiety and depression",
1768
+ "status": null
1769
+ },
1770
+ {
1771
+ "code": null,
1772
+ "code_system": null,
1773
+ "description": "Hypertension",
1774
+ "status": null
1775
+ },
1776
+ {
1777
+ "code": null,
1778
+ "code_system": null,
1779
+ "description": "Hypercholesterolemia",
1780
+ "status": null
1781
+ },
1782
+ {
1783
+ "code": null,
1784
+ "code_system": null,
1785
+ "description": "Coronary artery disease",
1786
+ "status": null
1787
+ },
1788
+ {
1789
+ "code": null,
1790
+ "code_system": null,
1791
+ "description": "Osteoarthritis",
1792
+ "status": null
1793
+ },
1794
+ {
1795
+ "code": null,
1796
+ "code_system": null,
1797
+ "description": "Chronic obstructive pulmonary disease",
1798
+ "status": null
1799
+ },
1800
+ {
1801
+ "code": null,
1802
+ "code_system": null,
1803
+ "description": "Hypothyroidism",
1804
+ "status": null
1805
+ }
1806
+ ],
1807
+ "procedures": [
1808
+ {
1809
+ "date": null,
1810
+ "description": "Psychiatric evaluation"
1811
+ }
1812
+ ],
1813
+ "allergies": [],
1814
+ "extraction_notes": "Hospital discharge summary (Chief Complaint, HPI, Physical Exam, Hospital Course, Discharge Diagnoses, Condition Upon Discharge, Discharge Medications, Allergies, Activity, Follow-up) including a psychiatric consult; classified as discharge_summary. Patient is an 82-year-old female; no identifiers present. No encounter date and no discrete department printed (presented to the ER, psychiatric evaluation obtained, discharged to a skilled nursing/rehab facility) so both null. Vitals documented only as 'Stable' with no numeric values (carotid upstrokes 2+ is an exam finding, not a vital), so vitals=[]. No labs (no test+value). Allergies explicitly 'None', so allergies=[]. The 20 DISCHARGE MEDICATIONS captured with status 'discharge', values/units preserved exactly (Xanax '0.5' no unit; Advair '250/50'; eye-drop routes 'both eyes'/'OU'; frequency-only entries NitroQuick and Provera 'p.r.n.'). Darvocet captured separately with status 'home' from the HPI ('frequently takes Darvocet for her anxiety'); it is not on the discharge list and no dose/frequency is stated. Paxil and Xanax noted as 'Continue' in Hospital Course but already on the discharge list (not duplicated). Discharge diagnosis #2 kept as the single printed item 'Anxiety and depression' rather than split. 'Psychiatric evaluation' captured as a procedure (borderline consult/assessment). No ICD/LOINC codes printed, so all codes null."
1815
+ }
1816
+ },
1817
+ {
1818
+ "idx": 26,
1819
+ "specialty": "Rheumatology",
1820
+ "gold": {
1821
+ "document_type": "progress_note",
1822
+ "patient": {
1823
+ "age": 12,
1824
+ "sex": "female"
1825
+ },
1826
+ "encounter": {
1827
+ "date": null,
1828
+ "department": null
1829
+ },
1830
+ "vitals": [
1831
+ {
1832
+ "name": "temperature",
1833
+ "value": "100.1",
1834
+ "unit": null
1835
+ },
1836
+ {
1837
+ "name": "weight",
1838
+ "value": "73.5",
1839
+ "unit": "kg"
1840
+ },
1841
+ {
1842
+ "name": "blood pressure",
1843
+ "value": "121/61",
1844
+ "unit": null
1845
+ },
1846
+ {
1847
+ "name": "height",
1848
+ "value": "158",
1849
+ "unit": null
1850
+ },
1851
+ {
1852
+ "name": "pulse",
1853
+ "value": "84",
1854
+ "unit": null
1855
+ }
1856
+ ],
1857
+ "labs": [
1858
+ {
1859
+ "test": "white blood cell count",
1860
+ "value": "7.9",
1861
+ "unit": null,
1862
+ "reference_range": null,
1863
+ "flag": null
1864
+ },
1865
+ {
1866
+ "test": "hemoglobin",
1867
+ "value": "14.3",
1868
+ "unit": null,
1869
+ "reference_range": null,
1870
+ "flag": null
1871
+ },
1872
+ {
1873
+ "test": "platelet count",
1874
+ "value": "321,000",
1875
+ "unit": null,
1876
+ "reference_range": null,
1877
+ "flag": null
1878
+ },
1879
+ {
1880
+ "test": "sed rate",
1881
+ "value": "11",
1882
+ "unit": null,
1883
+ "reference_range": null,
1884
+ "flag": null
1885
+ }
1886
+ ],
1887
+ "medications": [
1888
+ {
1889
+ "name": "Plaquenil",
1890
+ "dose": null,
1891
+ "frequency": null,
1892
+ "route": null,
1893
+ "status": "continued"
1894
+ },
1895
+ {
1896
+ "name": "hydrocortisone",
1897
+ "dose": null,
1898
+ "frequency": "at night",
1899
+ "route": null,
1900
+ "status": "discontinued"
1901
+ },
1902
+ {
1903
+ "name": "Protopic",
1904
+ "dose": null,
1905
+ "frequency": "at night",
1906
+ "route": null,
1907
+ "status": "new"
1908
+ }
1909
+ ],
1910
+ "diagnoses": [
1911
+ {
1912
+ "description": "discoid lupus",
1913
+ "code": null,
1914
+ "code_system": null,
1915
+ "status": "active"
1916
+ },
1917
+ {
1918
+ "description": "acanthosis nigricans",
1919
+ "code": null,
1920
+ "code_system": null,
1921
+ "status": "active"
1922
+ }
1923
+ ],
1924
+ "procedures": [
1925
+ {
1926
+ "description": "Diet evaluation",
1927
+ "date": null
1928
+ }
1929
+ ],
1930
+ "allergies": [],
1931
+ "extraction_notes": "Rheumatology/CCS follow-up progress note for a 12-year-old female with discoid lupus. Encounter date and department are not explicitly printed (specialty was external metadata only), so both null. Vitals recorded exactly as written; only weight has a printed unit (kg); temperature (100.1), blood pressure (121/61), height (158), and pulse (84) have no printed units. Labs: only test+value pairs captured (CBC components and sed rate); 'CMP shows no abnormalities' has no numeric value and antinuclear antibody/complement level are explicitly pending, so all three excluded. Medications: Plaquenil continued ('Continue on Plaquenil'); hydrocortisone cream used at night marked discontinued because the plan explicitly states 'switch her to Protopic' (a switch replaces/stops the prior agent); Protopic is the new agent started at night; route left null as topical is implied but not labeled. Diagnoses: discoid lupus (active, 'on the control with optimal regimen') and acanthosis nigricans (active present exam finding, 'she does have acanthosis nigricans on the base of the neck'). Systemic/full-blown lupus is only a future watch, not a current diagnosis, so excluded. Procedures: 'Diet evaluation today' captured as a service performed (date null, only 'today' stated). No allergies, no printed ICD/LOINC codes, no identifiers."
1932
+ }
1933
+ },
1934
+ {
1935
+ "idx": 27,
1936
+ "specialty": "Radiology",
1937
+ "gold": {
1938
+ "document_type": "other",
1939
+ "patient": {
1940
+ "age": 38,
1941
+ "sex": "male"
1942
+ },
1943
+ "encounter": {
1944
+ "date": null,
1945
+ "department": null
1946
+ },
1947
+ "vitals": [],
1948
+ "labs": [],
1949
+ "medications": [],
1950
+ "diagnoses": [
1951
+ {
1952
+ "code": null,
1953
+ "code_system": null,
1954
+ "description": "right upper lobe pneumonia",
1955
+ "status": null
1956
+ },
1957
+ {
1958
+ "code": null,
1959
+ "code_system": null,
1960
+ "description": "AIDS",
1961
+ "status": "history"
1962
+ },
1963
+ {
1964
+ "code": null,
1965
+ "code_system": null,
1966
+ "description": "decreased mental status",
1967
+ "status": null
1968
+ },
1969
+ {
1970
+ "code": null,
1971
+ "code_system": null,
1972
+ "description": "diffuse abdominal pain",
1973
+ "status": null
1974
+ }
1975
+ ],
1976
+ "procedures": [
1977
+ {
1978
+ "date": null,
1979
+ "description": "Ultrasound abdomen, complete"
1980
+ }
1981
+ ],
1982
+ "allergies": [],
1983
+ "extraction_notes": "Radiology complete abdominal ultrasound report; no enum category fits, so classified as \"other\". The only printed date, 04/18/2009, is explicitly the emergency-room admission date in the HISTORY (not the stated exam/encounter date), so encounter.date left null to avoid inference. Department not printed in the document, so null. Diagnoses are the explicit HISTORY conditions: right upper lobe pneumonia, decreased mental status, and diffuse abdominal pain (reasons for admission / current), plus AIDS marked status=history (\"There is a history of AIDS\"). IMPRESSION items were excluded as diagnoses because they are normal/negative findings: \"Spleen size at the upper limits of normal\" (i.e., within normal range, despite being \"somewhat prominent\"), pancreas obscured by bowel gas with normal visualized head, no gallstones, no renal calculi. Imaging measurements (common bile duct 4.6 mm, right kidney 10.8 cm, left kidney 10.5 cm, spleen max diameter 11.2 cm) are anatomical ultrasound findings, not lab tests with a test+value and not vitals, and no schema field captures organ measurements, so labs and vitals are empty. No medications, allergies, or vital signs stated. No patient identifiers present."
1984
+ }
1985
+ },
1986
+ {
1987
+ "idx": 29,
1988
+ "specialty": "Letters",
1989
+ "gold": {
1990
+ "document_type": "other",
1991
+ "patient": {
1992
+ "age": null,
1993
+ "sex": "male"
1994
+ },
1995
+ "encounter": {
1996
+ "date": null,
1997
+ "department": null
1998
+ },
1999
+ "vitals": [],
2000
+ "labs": [],
2001
+ "medications": [
2002
+ {
2003
+ "name": "Flonase",
2004
+ "dose": "two sprays to each nostril",
2005
+ "frequency": "once a day",
2006
+ "route": null,
2007
+ "status": "active"
2008
+ },
2009
+ {
2010
+ "name": "Zyrtec",
2011
+ "dose": "10 mg",
2012
+ "frequency": "a day",
2013
+ "route": null,
2014
+ "status": "active"
2015
+ }
2016
+ ],
2017
+ "diagnoses": [
2018
+ {
2019
+ "description": "bulbar cerebral palsy",
2020
+ "code": null,
2021
+ "code_system": null,
2022
+ "status": "active"
2023
+ },
2024
+ {
2025
+ "description": "hypotonia",
2026
+ "code": null,
2027
+ "code_system": null,
2028
+ "status": "active"
2029
+ },
2030
+ {
2031
+ "description": "significant tonsillar hypertrophy",
2032
+ "code": null,
2033
+ "code_system": null,
2034
+ "status": "active"
2035
+ },
2036
+ {
2037
+ "description": "chronic allergic rhinitis",
2038
+ "code": null,
2039
+ "code_system": null,
2040
+ "status": "active"
2041
+ }
2042
+ ],
2043
+ "procedures": [],
2044
+ "allergies": [
2045
+ {
2046
+ "substance": "penicillin",
2047
+ "reaction": null,
2048
+ "severity": null
2049
+ }
2050
+ ],
2051
+ "extraction_notes": "Physician introduction/referral letter (not a listed structured type), so document_type=\"other\". Patient name (\"A\") and physician names (\"Dr. X\") withheld as identifiers. Sex=\"male\" grounded in \"young man\" and \"He/his\"; no numeric age stated (\"young man\" is not a number) so age=null. No encounter date; \"pediatric neurology clinic\" is where prior treatment by Dr. X occurred (background), not this document's encounter department, so department=null. No vitals or labs (no test+value pairs). Medications: Flonase two sprays to each nostril once a day (currently on) and Zyrtec 10 mg a day (partial relief); route left null since \"nasal\" not explicitly written. Diagnoses: bulbar cerebral palsy and hypotonia (explicit \"diagnosis of\"), significant tonsillar hypertrophy (noted and confirmed), and chronic allergic rhinitis (explicit). Symptoms/findings (difficulty with mouth breathing, speech and swallowing problems) not recorded as diagnoses. Tonsillectomy is only being considered/asked about, not performed, so procedures empty. Penicillin allergy stated with no reaction or severity."
2052
+ }
2053
+ }
2054
+ ]
2055
+ }
training/env_versions.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "unsloth": "2026.6.9",
3
+ "unsloth_zoo": "2026.6.7",
4
+ "trl": "0.24.0",
5
+ "transformers": "5.5.0",
6
+ "peft": "0.19.1",
7
+ "accelerate": "1.14.0",
8
+ "datasets": "4.3.0",
9
+ "bitsandbytes": "0.49.2",
10
+ "torch": "2.10.0+cu128"
11
+ }
training/metrics.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "Qwen/Qwen3-4B-Instruct-2507",
3
+ "model_name": "Mira-3-v11",
4
+ "max_seq_length": 3072,
5
+ "lora_r": 16,
6
+ "lora_alpha": 32,
7
+ "epochs_target": 3,
8
+ "batch_size": 2,
9
+ "grad_accum": 8,
10
+ "lr": 0.0002,
11
+ "packing": true,
12
+ "use_unsloth": true,
13
+ "load_in_4bit": true,
14
+ "seed": 42,
15
+ "env_versions": {
16
+ "unsloth": "2026.6.9",
17
+ "unsloth_zoo": "2026.6.7",
18
+ "trl": "0.24.0",
19
+ "transformers": "5.5.0",
20
+ "peft": "0.19.1",
21
+ "accelerate": "1.14.0",
22
+ "datasets": "4.3.0",
23
+ "bitsandbytes": "0.49.2",
24
+ "torch": "2.10.0+cu128"
25
+ },
26
+ "elapsed_hours": 10.24,
27
+ "timestamp": "2026-07-02T00:28:21.448741",
28
+ "gpu": "Tesla T4",
29
+ "sm": 75,
30
+ "train_examples": 21000,
31
+ "epoch_reached": 3.0,
32
+ "global_step": 867,
33
+ "max_steps": 867,
34
+ "resumed_from_step": 453,
35
+ "training_complete": true
36
+ }