Compare commits

...

2 Commits

Author SHA1 Message Date
221399260f Add the M6 manuscript draft, figure script and number check
First full draft of the Volve-DIA paper in paper/ (13 LaTeX sections, 44 pages),
four figures built from outputs/ with assertions, a checker that traces every
number to plan.md or outputs/, and a source audit with its fixes. Correct the
pooled T2(b) values in the notes to the primary values and sync the plan, README,
overview and progress page.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-25 02:02:43 +00:00
8c924b7f0d Add protocol v6: planted-signal studies for T2 and T3
Locked protocol v6 (SHA-256 0376aa18...), cue lexicon, the 21_m5_synthetic
script with its module and 22 tests. Labels are drawn at random so the truth
is known; a signal of controlled strength is written into the model input.
Null checks pass for T2 f = 0.02 and T3 s = 0 and fail for T2 f = 0.10 under
the locked rule. A post-hoc diagnosis (--arm diagnose) shows that the failure
comes from the null definition (c = 0 < f makes the absence of a cue a
signal), and the true null c = f passes. The real masked T2 AP corresponds to
a cue rate of about 0.82 and the real T3 forecast AP to a depth hazard of
about 0.66. Docs, report and logs updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 01:50:28 +00:00
44 changed files with 5145 additions and 39 deletions

View File

@@ -4,7 +4,7 @@ Volve-DIA: a public benchmark and baselines for drilling-context recognition, NP
Read first: `docs/plan.md` (plan, gates, decisions; §1 data facts, §6 roadmap, §10 forbidden claims, §12 decision log), `README.md` (setup, scripts, logging), `docs/danh-gia-huong-NCKH-2026-10-29.md` (why this direction, competitors, references; local only, not in git), `docs/technical_overview.md` (a lecture for newcomers: drilling, DDR, leakage, tasks, labels, OCR, evaluation, code map). Progress page: `report.html`. These docs are in Vietnamese.
## Status (20/11/2026)
## Status (23/11/2026)
- **P0 (infrastructure) done and committed** (first commit on `main`, 29/10/2026). The project folder is `/home/jovyan/lamlvh/Volve-DIA`; remote `origin` `https://gitea.vts-ai.space/lamlvh/Volve-DIA` is **public**. `scripts/run_p0.sh` runs scripts 00–05 and the tests.
- **M1 machine work committed** (17/11/2026, `1791665`). The M1 driver generated the machine outputs; its final pytest
@@ -64,15 +64,15 @@ Read first: `docs/plan.md` (plan, gates, decisions; §1 data facts, §6 roadmap,
coverage (`scripts/16_m34_session.py prepare|regroup|status|collect`, batches of 15 T4 / 50 T2 items with `.txt` copies because
Read returns about 42k characters). `configs/protocol_v2.yaml` (+ `.sha256`) extends v1; never edit it while the VAI run
exists (its SHA is in every checkpoint). `g2` (v1) cannot be met; `g2_v2` needs VAI complete plus the v1 comparison baselines.
Track runs with `bash scripts/m34_status.sh`. 204 tests (20/11).
Track runs with `bash scripts/m34_status.sh`. 226 tests (23/11).
- **G2 v2 passed on 20/11/2026** (`outputs/m34/report.json` refreshed 06:32 UTC): `g2_v2.passed` True with no missing
classification or QA cells; `g2` (v1) False as expected. C4 coverage 1,376 paired questions, 1,293 without date-flagged
pages; `sha256sum -c configs/protocol_v2.yaml.sha256` OK. Headline T4 macro-family accuracy (well-scoped, mean of 3
repetitions, automatic scores) for DeepSeek: C4 XML 0.151, HTML 0.177, OCR 0.181; RAG 0.148; zero-shot 0.071; few-shot
0.151; tool_only 0.712; agent 0.618. Tool use over the XML-derived tables is far above retrieval and zero-shot. Qwen
(partial v1, seed 0): C4 XML 0.214, HTML 0.235, OCR 0.196, RAG 0.154. T2(b) masked AP by well: majority 0.179, lexicon
0.249, TF-IDF 0.461, DeepSeek zero-shot 0.405, Qwen zero-shot 0.261 (partial), DistilBERT 0.597; by wellbore DistilBERT
0.619, TF-IDF 0.484. Unmasked T2(b) by well: TF-IDF 0.994, DistilBERT 0.869. T3(b) masked AP by well: majority 0.114,
(partial v1, seed 0): C4 XML 0.214, HTML 0.235, OCR 0.196, RAG 0.154. T2(b) masked AP by well: majority 0.183, lexicon
0.251, TF-IDF 0.463, DeepSeek zero-shot 0.407, Qwen zero-shot 0.264 (partial), DistilBERT 0.593; by wellbore DistilBERT
0.618, TF-IDF 0.489. Unmasked T2(b) by well: TF-IDF 0.995, DistilBERT 0.873. T3(b) masked AP by well: majority 0.114,
TF-IDF 0.123, DistilBERT 0.121, about chance, so T3 stays a diagnostic.
- **Agents (user decision 19/11/2026, replaces 17/11):** writing code, code review and similar engineering or editing work is delegated to Opus. Model-run benchmark tasks that produce ratings or predictions without an API key (raters, judge, reference samples) use the lower models, Sonnet or Haiku, chosen per task. Do not use Fable.
@@ -113,13 +113,38 @@ Read first: `docs/plan.md` (plan, gates, decisions; §1 data facts, §6 roadmap,
section and formation follow depth in one field; cause overlap barely moves (0.70 random, 0.75 best). Neighbour forecast
over 4,894 T3 cells (k = 10, other wells): AP 0.150 (0.116–0.204) by depth, 0.135 with WITSML, prevalence 0.114.
T5 is outside G2 and stays a diagnostic.
- **Protocol v6: planted-signal studies done (20/11/2026, plan §1.9, §12 item 37).** `configs/protocol_v6.yaml`
(+ `.sha256`, extends v5; never edit it; cue phrases in `configs/synth_cues.yaml`) was locked before any planted score.
`scripts/21_m5_synthetic.py` (`volve_dia/m5_synthetic.py`, 22 tests) writes `outputs/m5/synthetic/`; five `m5_synthetic`
runs finished `ok` on 20/11 (four T2 shards marked dirty, T3 marked clean in `logs/index.csv`). Labels are drawn at random
(known exactly), then a signal of known strength is written into the model input; real labels are not used. 5 seeds,
well-cluster CIs, no gate, no replacement for H3. **Null checks:** pass for T2 f = 0.02 (AP 0.182, pi 0.183) and T3
s = 0 (0.118, pi 0.114); **fail for T2 f = 0.10** (AP 0.193, off by 0.0101 against the 0.01 tolerance, seed-0 CI does
not contain pi), so that sensitivity setting is not interpreted under v6 (the locked verdict stays). Post-hoc diagnosis (23/11,
`scripts/21_m5_synthetic.py --arm diagnose`, `null_diagnosis_t2.csv`): the cause is the null definition, not the
pipeline. At c = 0 < f the absence of an own cue already marks planted rows; the no-cue indicator alone gives AP 0.2004
(theory 0.199) at f = 0.10 and 0.185 at f = 0.02. The true null is c = f: AP 0.1819 at f = c = 0.10 (passes). Using the
f = 0.10 curve would need a new locked protocol with the null at c = f. T2 (f = 0.02): AP 0.182 at
c = 0 rising monotonically to 0.521 at c = 1; the real masked TF-IDF AP 0.463 corresponds to c about 0.82 (0.78-0.84):
a single planted phrase on about 82% of planted positives matches the real masked score in this calibration. The
frequency of cues in real DDR comments is unknown. T3: real depth forecast AP 0.150 corresponds to s about 0.66 (0.55-0.72), oracle about 0.21, a very
weak depth hazard. This bounds detectability; it does not validate the labels.
- **M6 draft and first review completed (23/11/2026, plan §12 items 38–39).** Sources are in `paper/` (LaTeX `article` + `natbib`);
the reviewed PDF is `outputs/paper/volve-dia-m6.pdf`. Spine: leakage in NPT labels
(T2, planted signal) plus T4/C4; T3, T5, label agreement (H3), EGS (H4) and OCR (H5) are reported as diagnostics or unsupported.
Style follows ML-Porosity (`docs/research/paper-style-survey.md` there) and the academic-humanizer skill. Opus agents drafted the
sections and `scripts/22_paper_figures.py`; `paper/check_numbers.py` finds every number of `paper/sections/` in plan.md or `outputs/`
(1,923 numbers; 3 allowlisted with reasons); `paper/provenance/*.md` trace claims. The source and wording review is
documented in `paper/audit_report.md`, with 108 source-to-table checks. Found while writing: the T2(b) values in older notes
were pooled over subsets; the primary values are from `classification.csv` (majority 0.183, TF-IDF 0.4635, DistilBERT 0.593).
Working tree only. Open: author details and declarations, OCR export model metadata, venue class and limits, release terms and the final novelty rescan.
## Next
Roadmap and gates: `docs/plan.md` §6, §12 item 1.
1. G2 v2, G3, the error taxonomy, RQ4 and T5 are done (20/11). Next: paper writing (M6) and release
terms at G4. T4 headline numbers stay automatic. No claim of a human, author or expert audit is allowed.
1. G2 v2, G3, the error taxonomy, RQ4, T5 and the planted-signal studies are done (20/11). M6 drafting and the first review are complete in
`paper/` (see Status). Next: author review and declarations, venue formatting, and release terms at G4. T4 headline numbers stay automatic. No claim of a human, author or expert audit is allowed.
2. C4 reports results with and without the 16 date-disagreement pages; the 7 unmatched reports are dropped.
3. Decided 17/11 (plan §12 item 21): WITSML suspect values (-999, -99999, 99999, 9999, |v| > 1e15) are missing at feature stage; formation picks file is the label source; 7 unmatched OCR reports are dropped from C4; G1 locked NPT (b) (+0.025 median weighted κ in the first pass).
4. At G4, confirm the release terms for this copy. Local `license.txt` states CC BY-NC-SA 4.0 and no resale,

View File

@@ -192,6 +192,28 @@ trên 4.894 ô T3. Kết quả ghi ở `outputs/m5/t5/`: `report.json`, `per_que
`knn_scores.parquet`. Kết quả ngày 20/11: depth nDCG@10 0,666, random 0,463, không biểu diễn nào hơn depth với CI loại 0
([plan §1.8](docs/plan.md#18-m5-t5-truy-xuất-khoảng-tương-đồng-ngày-20112026)).
### Tín hiệu cấy (protocol v6)
`configs/protocol_v6.yaml` (khóa bằng `.sha256`, mở rộng v5; cụm từ cue trong `configs/synth_cues.yaml`) cố định nhãn cấy,
cường độ, mô hình và kiểm tra null trước mọi điểm số cấy. Nhãn được bốc ngẫu nhiên nên biết chính xác; nhãn và văn bản thật
không dùng làm chân lý.
```bash
OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 \
scripts/runlog.sh -n m5_synthetic -- .venv/bin/python scripts/21_m5_synthetic.py --arm t3 # khoảng 4 phút
for i in 0 1 2 3; do # 4 tiến trình độc lập, mỗi tiến trình khoảng 2 giờ 30 phút; chạy nền bằng setsid nohup
OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 \
scripts/runlog.sh -n m5_synthetic -- .venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard $i/4
done
.venv/bin/python scripts/21_m5_synthetic.py --arm report # dựng lại report.json và bảng từ các lượt đã xong
.venv/bin/python scripts/21_m5_synthetic.py --arm diagnose # sau sự kiện: vì sao null c = 0 trượt khi f > 0 (khoảng 3 giây)
```
Kết quả ở `outputs/m5/synthetic/` (`report.json`, `settings_t2.csv`, `settings_t3.csv`, `seeds_t2.csv`, `seeds_t3.csv`,
`t3_scores.parquet`, `t2_runs/`). Kết quả ngày 20/11: kiểm tra null đạt ở T2 f = 0,02 và T3, không đạt ở T2 f = 0,10; điểm
TF-IDF T2 thật tương ứng c ≈ 0,82, điểm T3 thật tương ứng s ≈ 0,66. Lỗi null ở f = 0,10 là do thiết kế (null thật là c = f, đạt), xem `null_diagnosis_t2.csv`
([plan §1.9](docs/plan.md#19-m5-nghiên-cứu-tín-hiệu-cấy-planted-signal-ngày-20112026)).
## Ba phiên bản của một DDR và parser OCR
Mỗi DDR có ba phiên bản:
@@ -216,6 +238,20 @@ Dịch vụ OCR:
- Mỗi trang đọc xong được lưu ở `outputs/ocr/pages/<sha256[:16]>/pNNNN.json`. Khóa cache gồm model, hash prompt, DPI, `max_tokens`, temperature; đổi một giá trị thì mọi trang bị đọc lại.
- Script dừng trước khi gửi trang nào nếu dịch vụ không trả lời `/v1/models` hoặc không phục vụ model `chandra`. Script ngừng gửi khi 8 trang liên tiếp lỗi.
## Bài báo (M6)
Bản thảo ở `paper/` (LaTeX `article` + `natbib`; `paper/README.md` có sơ đồ phần, bảng tên gọi, quy tắc viết, các claim bị cấm và việc còn mở).
```bash
(cd paper && pdflatex main && bibtex main && pdflatex main && pdflatex main && pdflatex main)
/home/jovyan/lamlvh/ML-Porosity/.venv/bin/python scripts/22_paper_figures.py # bốn hình từ outputs/ (venv này có matplotlib)
.venv/bin/python paper/check_numbers.py --summary # mọi số trong paper/sections/ phải có trong plan.md hoặc outputs/ (allowlist: paper/number_allowlist.txt)
.venv/bin/python -m pytest tests/test_paper_numbers.py
```
Bản PDF đã rà soát nằm ở `outputs/paper/volve-dia-m6.pdf`. [Biên bản rà soát](paper/audit_report.md) ghi các sửa đổi và đối chiếu đầu ra.
`paper/provenance/*.md` ghi nguồn của từng phần. Văn phong theo mẫu ML-Porosity và skill academic-humanizer.
## Scripts
| Script | Việc |
@@ -241,6 +277,8 @@ Dịch vụ OCR:
| `scripts/18_m5_judge.py prepare\|status\|collect` | Hiệu chuẩn LLM-judge cho G3 theo protocol v3 → `outputs/m5/judge/` (report.json, judged.csv, disagreements.csv) |
| `scripts/19_m5_errors.py` | Phân loại lỗi theo họ câu hỏi và RQ4 (EGS so với điểm tự động) theo protocol v4 → `outputs/m5/errors/` |
| `scripts/20_m5_t5.py` | T5 truy xuất khoảng tương đồng và dự báo từ láng giềng theo protocol v5 → `outputs/m5/t5/` |
| `scripts/21_m5_synthetic.py` | Tín hiệu cấy cho T2 (cue văn bản) và T3 (hazard theo độ sâu) theo protocol v6 → `outputs/m5/synthetic/` |
| `scripts/22_paper_figures.py` | Bốn hình của bài từ `outputs/` (t4_modes, taxonomy, leakage, planted) → `paper/figures/`, kèm assert và `figures_provenance.md` |
| `scripts/runlog.sh` | Bọc một lệnh để ghi log và runtime |
| `scripts/run_m1.sh` | Chạy pipeline M1 trên nền P0: 04_ocr_hub, 05 `--source hub`, 06–09, pytest |
| `scripts/run_p0.sh` | Chạy toàn bộ P0: 00 `--check`, 01–05 (04 ở chế độ `--pilot`), pytest |

75
configs/protocol_v6.yaml Normal file
View File

@@ -0,0 +1,75 @@
# Protocol v6: planted-signal studies with known ground truth (T2 text cues, T3 depth hazard). Extends locked v5.
protocol: volve-dia
version: 6
status: locked
drafted: 2026-11-20
locked_before: any planted-signal score was computed; only the real masked T2 and T3 results (v1-v5) were known
extends:
file: configs/protocol_v5.yaml
sha256: c99bb91bdca9a4ab00ef065847ec095121944ddccbffde32c34dc6f8fc125047
deviation:
date: 2026-11-20
what: >-
H3 (label agreement with raters) was not met and the real T2/T3 labels are derived from the DDR activity codes, so
no result so far says whether the pipeline can recover a signal whose truth is known. v6 adds planted-signal
studies: the label is drawn by a fixed random rule and is therefore known exactly; a signal of controlled strength is
then written into the model input. The real labels and the real input text are not used as truth.
consequence: >-
The studies measure the null calibration and the power of the T2 and T3 pipelines and give an effective
signal strength for the real scores. They do not validate the real labels and do not replace H3. The planted
cues are synthetic phrases and the T3 hazard is a smooth function of depth, so they bound detectability, not realism.
unchanged:
- protocols v1 to v5 in full, including masking, splits, folds, regularisation grid and the real T2/T3 results
common:
seeds: 5 planting seeds, 20261117 + 0 ... 4 (numpy default_rng); one planting per seed and setting
split: leave-one-well-out as in v1 (primary grouping by well)
ci: whole-well cluster bootstrap, 2,000 resamples, seed 20261117, percentile 95% interval
reporting: mean and range over the 5 seeds, plus the pooled out-of-fold AP interval of seed 0
t2_cues:
universe: the 23,447 masked activities of outputs/labels/t2_inputs.parquet (all 11 wells)
planted_label: >-
y_i ~ Bernoulli(pi) independently per activity, pi = 0.183 (the real NPT (b) prevalence, 4,286 / 23,447); the real
code labels are never read
cue: >-
a planted activity receives, with probability c, one phrase chosen uniformly from configs/synth_cues.yaml appended
after its comment (one space); an unplanted activity receives a phrase with probability f (decoy rate). The phrase
class is independent of the real activity
settings:
c: [0.0, 0.1, 0.25, 0.5, 0.75, 1.0]
f_primary: 0.02
f_sensitivity: 0.10
model: >-
the T2 TF-IDF + logistic baseline of M3-M4 unchanged (configs/m34_baselines.yaml: word 1-2 grams, min_df 2, C chosen
by the same inner GroupKFold from [0.25, 1, 4]), leave-one-well-out, masked view plus the appended cue
metrics: pooled out-of-fold average precision (AP) with the interval above; AP lift over pi
null_check: >-
at c = 0 (any f) the mean AP over seeds lies within pi +/- 0.01 and the seed-0 95% interval contains pi; otherwise the
pipeline is reported as miscalibrated under the null and the cue results are not interpreted
effective_cue_rate: >-
the c at which the mean AP over seeds (f = 0.02) equals the real masked T2(b) TF-IDF AP by well (0.461 in the G2 v2
report), by linear interpolation between the grid points, reported with the range over seeds; if the real AP is
above the AP at c = 1 or below the AP at c = 0, the interpolation is reported as out of range
reading: >-
descriptive; no gate. The effective cue rate says what fraction of planted-NPT-like rows would have to carry an
explicit cue in the masked text to produce the real score. It is not a measure of label validity
t3_hazard:
universe: the 4,894 cells of outputs/m34/features_t3.parquet (10 wells)
covariate: z = (md_top - mean) / sd of md_top over the 4,894 cells
planted_label: >-
y_i ~ Bernoulli(p_i), p_i = sigmoid(a + s * z_i) with a solved by bisection so that mean(p) = pi = 0.114 (the real
NPT (b) cell prevalence 556 / 4,894); the real labels are never read
settings:
s: [0.0, 0.25, 0.5, 1.0, 2.0]
model: >-
the v5 neighbour forecast, depth representation (md_top; k = 10 nearest cells of the other wells, mean label), and
the oracle score p_i as the ceiling
metrics: pooled out-of-fold AP with the interval above; the oracle AP; AP lift over pi
null_check: at s = 0 the mean AP over seeds lies within pi +/- 0.01 and the seed-0 95% interval contains pi
effective_strength: >-
the s at which the mean AP of the depth forecast equals the real v5 depth forecast AP (0.150, NPT (b)), by linear
interpolation, with the range over seeds; out of range reported as such. Labels are independent across cells, so
the intervals of the real data (neighbouring cells of one episode) are not reproduced
code: scripts/21_m5_synthetic.py, volve_dia/m5_synthetic.py
outputs: outputs/m5/synthetic/
inputs_hashed:
configs/synth_cues.yaml: dfe395298a1f30b1fe6906a65bd03a06f83796206a19993beb530fa106b82107

View File

@@ -0,0 +1 @@
0376aa18ea7ace44fdb3fd1ccb4424aa3b8c5e89d44e04f160af38e036fd5f7c configs/protocol_v6.yaml

30
configs/synth_cues.yaml Normal file
View File

@@ -0,0 +1,30 @@
# Cue lexicon for the planted-signal T2 arm (protocol v6). Written before any planted-signal score; hashed in v6.
# Each phrase is appended to a masked activity comment. Phrases are generic drilling wording by cause class.
cues:
equipment:
- "Top drive failure, repair in progress."
- "Mud pump down, changed liner and swab."
- "Rig equipment breakdown, awaiting spare part."
- "Drawworks fault, troubleshooting."
- "Hydraulic leak on pipe handler, repaired."
- "BOP control system malfunction, tested again."
weather:
- "Waiting on weather, wind above operating limit."
- "Operations suspended due to high seas."
- "Standby for weather window, crane operations not possible."
- "Swell exceeded limit, held position."
stuck_fishing:
- "String stuck, worked pipe free."
- "Pack-off while pulling out, jarred to release."
- "Fishing operation to recover lost BHA component."
- "Lost tool in hole, ran fishing assembly."
well_control:
- "Well kick observed, shut in and circulated out."
- "Gas influx, killed well with weighted mud."
lost_circulation:
- "Partial losses to formation, pumped LCM pill."
- "Total losses while drilling, spotted cement plug."
waiting:
- "Waiting on orders from town."
- "Waiting on cement, standby."
- "Waiting on boat, delayed delivery."

View File

@@ -198,3 +198,12 @@ Nguồn: arXiv API, Crossref (gồm tiền tố SPE, OTC, IPTC, EAGE), OpenAlex,
- Ba file `license.txt` đi kèm bản dữ liệu có cùng SHA-256 và ghi CC BY-NC-SA 4.0. Điều khoản Equinor
công khai §3.1–3.3 cho phép dùng thương mại, cấm bán dữ liệu nguồn và yêu cầu ghi công. Phạm vi của từng
văn bản sẽ được xác nhận cho gói phát hành ở G4. [Điều khoản Equinor](https://cdn.equinor.com/files/h61q9gi9/global/de6532f6134b9a953f6c41bac47a0c055a3712d3.pdf).
## 7. Kiểm tra nguồn cho bản thảo M6 ngày 23/11/2026
- Trang workshop ICML xác nhận tên bài, tác giả và abstract của Mishra et al. về dựng báo cáo khoan từ chuỗi cảm biến.
Bản thảo dẫn ở mức tóm tắt. [Trang ICML](https://icml.cc/virtual/2026/71506).
- Tìm theo Volve, DDR QA, NPT, leakage, WITSML và OCR. Một dự án dự thi SPE GCS 2026 dùng XML và PDF qua OCR cho
trợ lý hỏi đáp trên Volve. Tài liệu công khai mô tả nguồn và cách truy xuất. Chưa thấy thí nghiệm ghép cặp ba
bản XML/HTML/OCR với cùng đáp án trong tài liệu đã đọc. Giữ việc quét cơ sở dữ liệu thư mục ở M6 trước khi nộp.
[Kho mã dự thi](https://github.com/gabrielserrao/spe-2026-challenge), [nguồn dữ liệu](https://github.com/gabrielserrao/spe-2026-challenge/blob/main/DATA_SOURCES.md).

View File

@@ -27,11 +27,11 @@ Nhãn trong tài liệu này:
| **Parser tài liệu** | chandra trên dịch vụ vLLM, request và prompt giống hệt vopec-chatbot (yêu cầu ngày 29/10/2026), cấu hình `configs/ocr.yaml`. OCR toàn tập do một đồng nghiệp chạy và xuất qua Dataset Hub (17/11/2026); `04_ocr_hub.py` ghép từng trang về DDR (mục 1.3, 12 ý 12). Độ trung thực đo theo hai bước, mục 5.1. |
| **Venue** | *Geoenergy Science and Engineering* trước. Kế tiếp *Computers & Geosciences*, *Journal of Petroleum Exploration and Production Technology*. Dự phòng MDPI (*Applied Sciences*, *Energies*, *Processes*), *Petroleum* (KeAi). Quartile tra lại trên SCImago khi nộp [XM]. |
| **Thời gian** | 6 tháng [ĐX]: M1 = 30/10–30/11/2026 đến M6 = 4/2027, nộp cuối 4/2027; preprint ở M4–M5 nếu venue cho phép (mục 6). |
| **Trạng thái và việc tiếp theo** | G1 đạt ngày 18/11/2026. SHA-256 xác nhận protocol đã khóa trước mọi baseline. T4 và C4 là trọng tâm. T1 đoạn khoan công bố là kết quả bổ trợ. T2–T3 dự đoán nhãn dựng từ DDR theo NPT (b), kèm độ nhạy (a). Chưa lớp nào đủ điều kiện báo điểm riêng. Ngày 19/11 dừng Qwen/Llama v1 (giữ checkpoint, báo là v1 chưa đầy đủ); protocol v2 (§12 ý 32): VAI DeepSeek là baseline API chạy toàn ma trận, Sonnet và Haiku thay Qwen và Llama trên mẫu cố định trong session. **Ngày 20/11/2026 G2 v2 đạt** (§12 ý 33): TF-IDF, DistilBERT (mọi shard), VAI DeepSeek (T4/C4 48.951/48.951, T2 70.341/70.341) và mẫu Sonnet/Haiku đều xong; G2 v1 không thể đạt. **G3 đạt ngày 20/11/2026** (protocol v3, §12 ý 34): Sonnet κ = 0,98 so với điểm tự động theo đáp án XML (không có người chấm); số chính của T4 vẫn là điểm tự động. Cùng ngày, protocol v4 (§12 ý 35) khóa trước khi tính phân loại lỗi theo họ câu hỏi và RQ4: bỏ trả lời là lỗi chính của truy xuất văn bản, tool chủ yếu sai giá trị dù trích đúng báo cáo; EGS (bản chuyển thể) có ρ Spearman 0,53–0,54 với điểm tự động nên H4 không được ủng hộ, nhưng tương quan chủ yếu đến từ các câu bỏ trả lời. T5 (truy xuất khoảng tương đồng, protocol v5, §12 ý 36) xong cùng ngày: độ sâu là baseline mạnh nhất (nDCG@10 0,666 so với ngẫu nhiên 0,463), không biểu diễn nào hơn độ sâu với CI loại 0. Việc còn lại: viết bài (M6), điều khoản phát hành ở G4. Xem §1.6, §1.7, §1.8 và §6. |
| **Trạng thái và việc tiếp theo** | G1 đạt ngày 18/11/2026. SHA-256 xác nhận protocol đã khóa trước mọi baseline. T4 và C4 là trọng tâm. T1 đoạn khoan công bố là kết quả bổ trợ. T2–T3 dự đoán nhãn dựng từ DDR theo NPT (b), kèm độ nhạy (a). Chưa lớp nào đủ điều kiện báo điểm riêng. Ngày 19/11 dừng Qwen/Llama v1 (giữ checkpoint, báo là v1 chưa đầy đủ); protocol v2 (§12 ý 32): VAI DeepSeek là baseline API chạy toàn ma trận, Sonnet và Haiku thay Qwen và Llama trên mẫu cố định trong session. **Ngày 20/11/2026 G2 v2 đạt** (§12 ý 33): TF-IDF, DistilBERT (mọi shard), VAI DeepSeek (T4/C4 48.951/48.951, T2 70.341/70.341) và mẫu Sonnet/Haiku đều xong; G2 v1 không thể đạt. **G3 đạt ngày 20/11/2026** (protocol v3, §12 ý 34): Sonnet κ = 0,98 so với điểm tự động theo đáp án XML (không có người chấm); số chính của T4 vẫn là điểm tự động. Cùng ngày, protocol v4 (§12 ý 35) khóa trước khi tính phân loại lỗi theo họ câu hỏi và RQ4: bỏ trả lời là lỗi chính của truy xuất văn bản, tool chủ yếu sai giá trị dù trích đúng báo cáo; EGS (bản chuyển thể) có ρ Spearman 0,53–0,54 với điểm tự động nên H4 không được ủng hộ, nhưng tương quan chủ yếu đến từ các câu bỏ trả lời. T5 (truy xuất khoảng tương đồng, protocol v5, §12 ý 36) xong cùng ngày: độ sâu là baseline mạnh nhất (nDCG@10 0,666 so với ngẫu nhiên 0,463), không biểu diễn nào hơn độ sâu với CI loại 0. Ngày 20/11 protocol v6 (§12 ý 37, §1.9) cấy tín hiệu biết trước vào T2 và T3 để đo pipeline: kiểm tra null đạt ở cấu hình chính (T2 f = 0,02, T3) nhưng **không đạt ở T2 f = 0,10** (lệch 0,0101), nên cấu hình đó không được diễn giải (điều tra 23/11: lỗi do thiết kế null c = 0 < f, null thật c = f đạt; §1.9); điểm TF-IDF T2 thật khớp tỷ lệ cue khoảng 82% trong các hàng dương mô phỏng, điểm T3 thật tương ứng hazard độ sâu rất yếu (s ≈ 0,66). Ngày 23/11 có bản thảo M6 và đã xong lượt rà soát đầu (§12 ý 38–39, `paper/audit_report.md`). Còn xác nhận thông tin tác giả, thể thức tạp chí và điều khoản phát hành ở G4. Xem §1.6, §1.7, §1.8, §1.9 và §6. |
---
## 1. Hiện trạng từ P0 đến M5
## 1. Hiện trạng từ P0 đến M6
Số liệu P0 lấy từ `outputs/{inventory,ddr,render_qc,ocr_qc}/summary.json` của lượt `20261029-105934_p0` (lượt trước `20261029-101523_p0` cho cùng số liệu). Số liệu M1 (OCR toàn tập, WITSML, nhãn, T4) lấy từ `outputs/{ocr/hub,ocr_qc,witsml,labels,t4}/summary.json` của các lượt ngày 17/11/2026 ghi ở mục 12.
@@ -253,9 +253,10 @@ trên những ngày thiếu `diaHole` vẫn chưa xác định.
| zero-shot / few-shot | 0,071 / 0,151 | — |
| tool_only / agent | 0,712 / 0,618 | — |
Truy vấn tool trên bảng dựng từ XML cao hơn hẳn truy xuất văn bản và zero-shot. AP T2(b) che mã theo giếng: majority
0,179, lexicon 0,249, TF-IDF 0,461, DeepSeek zero-shot 0,405, Qwen zero-shot 0,261 (chưa đầy đủ), DistilBERT 0,597;
theo wellbore DistilBERT 0,619, TF-IDF 0,484. Mở mã theo giếng: TF-IDF 0,994, DistilBERT 0,869. AP T3(b) che mã theo
Truy vấn tool trên bảng dựng từ XML cao hơn hẳn truy xuất văn bản và zero-shot. Các số T2(b) dưới đây là giá trị chính (tập đầy đủ, đầu vào XML, `classification.csv`); bản ghi trước ngày 23/11 trích trung bình gộp
nhiều tập con (majority 0,179, TF-IDF 0,461, DistilBERT 0,597 …) và đã được sửa. Protocol v6 đã khóa vẫn ghi 0,461 cho TF-IDF.
AP T2(b) che mã theo giếng: majority 0,183, lexicon 0,251, TF-IDF 0,463, DeepSeek zero-shot 0,407, Qwen zero-shot 0,264 (chưa đầy đủ), DistilBERT 0,593;
theo wellbore DistilBERT 0,618, TF-IDF 0,489. Mở mã theo giếng: TF-IDF 0,995, DistilBERT 0,873. AP T3(b) che mã theo
giếng: majority 0,114, TF-IDF 0,123, DistilBERT 0,121, xấp xỉ mức ngẫu nhiên, nên T3 vẫn chỉ là chẩn đoán.
### 1.7 M5: G3, phân tích kết quả cuối, phân loại lỗi và RQ4 ngày 20/11/2026
@@ -317,8 +318,8 @@ trên những ngày thiếu `diaHole` vẫn chưa xác định.
Lỗi chính của truy xuất văn bản là bỏ trả lời (54–68% mọi dự đoán), sau đó là nhầm wellbore. Họ aggregation gần như không
bao giờ đúng với văn bản (C4 0,017–0,027, RAG 0,016; khoảng 70% bỏ trả lời) nhưng đạt 0,726 với tool_only; multi_hop bỏ trả
lời 91–100% với C4/RAG, tool_only 0,723. Ở lookup, C4 XML đúng 0,089 so với 0,285 của HTML và OCR vì bỏ trả lời 0,762 so với
0,45: đây là lý do XML thấp nhất trong C4 (§1.7, H5). Họ comparison có nhầm wellbore 21–25% ở mọi chế độ, kể cả tool_only
(0,246), vì đáp án là một trong hai wellbore được hỏi nên chọn nhầm wellbore cũng là lớp này. Với tool_only và agent, lỗi còn
0,448 (HTML) và 0,462 (OCR). XML có điểm thấp nhất, đồng thời bỏ trả lời nhiều nhất. Chưa cô lập được nguyên nhân của sự khác biệt (§1.7, H5). Họ comparison có nhầm wellbore 21–25% ở C4, RAG và tool_only (tool_only 0,246; agent 0,120, zero-shot 0,130, few-shot 0,395; kiểm lại
với `taxonomy.csv` 23/11), vì đáp án là một trong hai wellbore được hỏi nên chọn nhầm wellbore cũng là lớp này. Với tool_only và agent, lỗi còn
lại chủ yếu là trích đúng báo cáo nhưng sai giá trị (0,14–0,15); agent có thêm 6,4% lỗi gọi (0,048–0,081 qua ba lượt). Qwen
(v1 chưa đầy đủ, seed 0) ít bỏ trả lời hơn (0,15–0,35) nhưng nhầm wellbore nhiều hơn: C4 XML 0,371, HTML 0,512, OCR 0,583,
RAG 0,482. Chỉ mô tả, không kiểm định.
@@ -372,6 +373,51 @@ trên những ngày thiếu `diaHole` vẫn chưa xác định.
là phân tích chẩn đoán.
- Mã `volve_dia/m5_t5.py`, 12 test; lượt `20261120-073123_m5_t5` (1 phút 36 giây).
### 1.9 M5: nghiên cứu tín hiệu cấy (planted signal) ngày 20/11/2026
- **Thiết kế** [KT, protocol v6 khóa SHA-256 `0376aa18…` trước mọi điểm số cấy, `configs/synth_cues.yaml` `dfe39529…`,
`scripts/21_m5_synthetic.py`, `outputs/m5/synthetic/`, §12 ý 37]. Lý do: H3 không đạt và nhãn T2/T3 thật dẫn xuất từ mã
hoạt động DDR, nên chưa có kết quả nào cho biết pipeline có tìm lại được một tín hiệu mà ta biết chắc là có hay không. Ở đây
nhãn được bốc ngẫu nhiên theo luật cố định (biết chính xác), rồi một tín hiệu cường độ biết trước được ghi vào đầu vào mô
hình; nhãn thật và văn bản thật không dùng làm chân lý. T2: 23.447 hoạt động đã che mã, nhãn Bernoulli(0,183); hoạt động
được cấy nhận một cụm từ nhân tạo với xác suất c ∈ {0; 0,1; 0,25; 0,5; 0,75; 1}, hoạt động không cấy nhận cụm từ "mồi" với
xác suất f (0,02 chính; 0,10 độ nhạy); mô hình là TF-IDF + logistic của M3–M4, giữ nguyên, leave-one-well-out. T3: 4.894 ô,
hazard p = sigmoid(a + s·z) theo độ sâu chuẩn hóa, s ∈ {0; 0,25; 0,5; 1; 2}, prevalence 0,114; mô hình là dự báo láng giềng
theo độ sâu của v5, kèm điểm oracle p làm trần. 5 seed, CI bootstrap theo giếng. Không có cổng.
- **Kiểm tra null (c = 0 hoặc s = 0; điều kiện: AP trung bình trong π ± 0,01 và CI seed 0 chứa π):**
| Cấu hình | AP trung bình | π | Kết quả |
| --- | --- | --- | --- |
| T2, f = 0,02 (chính) | 0,1821 | 0,183 | đạt; CI seed 0 0,179–0,195 chứa π |
| T2, f = 0,10 (độ nhạy) | 0,1931 | 0,183 | **không đạt**: lệch 0,0101 (> 0,01 một chút); CI seed 0 0,193–0,208 không chứa π |
| T3, s = 0 | 0,1177 | 0,1136 | đạt; CI seed 0 0,107–0,124 chứa π |
Theo protocol, cấu hình không đạt được báo là lệch chuẩn dưới null và kết quả cue của f = 0,10 **không được diễn giải**;
phán quyết khóa này giữ nguyên. Mọi diễn giải T2 dưới đây dùng f = 0,02.
- **Điều tra nguyên nhân (23/11/2026, sau khi biết kết quả, không thuộc protocol v6; `scripts/21_m5_synthetic.py --arm diagnose`,
`outputs/m5/synthetic/null_diagnosis_t2.csv`).** Lỗi nằm ở định nghĩa "null" của v6, không ở pipeline. Hàng được cấy nhận cue
với xác suất c, hàng không cấy với xác suất f; khi c = 0 < f thì **không có cue ở chính comment đã là bằng chứng** cho hàng
cấy (mọi hàng cấy đều không có cue, 10% hàng không cấy có), nên c = 0 chỉ là null khi f = 0, hoặc khi c = f. Chỉ báo "không
có cue" tự nó (không qua mô hình) cho AP 0,2004 ở f = 0,10, c = 0 (lý thuyết π/(π + (1 − π)(1 − f)) = 0,199) và 0,1848
ở f = 0,02 (lý thuyết 0,186), cao hơn cả mô hình (0,193 và 0,182): mô hình không khai thác hết tín hiệu cấu trúc này. Khi
c = f, tức null thật, AP là 0,1819 ở f = c = 0,10 (CI seed 0 0,176–0,188 chứa π; chỉ báo không-cue 0,1830), nằm trong ngưỡng.
Kết luận: pipeline hiệu chuẩn đúng dưới null thật; sai lệch +0,010 ở f = 0,10 là tín hiệu cấu trúc của thiết kế, và ở
f = 0,02 nó chỉ +0,003 nên kiểm tra chính vẫn có ý nghĩa. Đường cong f = 0,10 vẫn không được diễn giải theo v6; nếu cần dùng,
phải khóa một protocol mới với null đặt tại c = f. Đây là kết quả điều tra sau sự kiện, báo riêng với kết quả theo protocol.
- **T2 (f = 0,02), AP trung bình trên 5 seed:** c = 0: 0,182; 0,1: 0,201; 0,25: 0,258; 0,5: 0,363; 0,75: 0,440; 1,0: 0,521
(lift 0,99 đến 2,85). Tức pipeline tìm lại tín hiệu cấy đơn điệu theo c. **Tỉ lệ cue hiệu dụng:** AP thật của TF-IDF T2(b) che
mã theo giếng (0,463) tương ứng c = 0,82 (0,78–0,84 giữa các seed; nằm trong lưới, không ngoài khoảng). Trong mô phỏng, một cụm từ cấy ở khoảng 82% hàng dương cho điểm tương đương. Tỷ lệ cue trong comment thật và độ hợp lệ
của nhãn vẫn chưa được đo. Cue có thể lan sang hoạt động kề (mức phơi nhiễm ở hoạt động không cấy 0,35 khi c = 1), nhưng
phép hiệu chỉnh chưa cô lập tác động của hiện tượng này. Protocol v6 ghi mốc AP gộp 0,461. Report giữ cả nội suy ở mốc
đó và ở mốc chính 0,46346 trên XML theo giếng, xem Phụ lục A của bài.
- **T3 (s), dự báo theo độ sâu, AP trung bình / oracle:** s = 0: 0,118 / 0,115; 0,25: 0,119 / 0,139; 0,5: 0,131 / 0,176;
1: 0,191 / 0,283; 2: 0,379 / 0,489. **Cường độ hiệu dụng:** AP thật 0,150 của dự báo theo độ sâu tương ứng s ≈ 0,66
(0,55–0,72 giữa các seed; 2 trong 5 seed có đoạn nội suy không đơn điệu). Ở s ≈ 0,66 oracle chỉ khoảng 0,21, nên điểm thật
0,150 phù hợp với một hazard theo độ sâu rất yếu; T3 vẫn là chẩn đoán. Nhãn cấy độc lập giữa các ô nên CI hẹp hơn dữ liệu thật
(các ô kề nhau cùng một sự kiện).
- Mã `volve_dia/m5_synthetic.py`, 22 test; 5 lượt `m5_synthetic` ngày 20/11, tất cả `ok`. Theo `logs/index.csv`, lượt T3 chạy 3 phút 30 giây trên cây sạch.
Bốn shard T2 chạy khoảng 2 giờ 30 phút mỗi shard trên cây chưa commit (`dirty` = True, `code_sha` `2845ef75…`).
## 2. Research gap
### 2.1 Phát biểu
@@ -525,8 +571,8 @@ Ngưỡng các cổng chốt trong `protocol_v1` trước G1; sau đó ngưỡng
| **M1 Dữ liệu và nhãn** | 30/10 – 30/11/2026 (xong phần máy và chấm thử bằng LLM 17/11) | OCR toàn bộ DDR và QC toàn tập; parser WITSML; bảng ánh xạ mã → nhãn; nhãn T1–T3; template và SQL cho T4; chấm mù thử 100 dòng | DuckDB đủ bảng; `configs/labels.yaml`; bộ câu hỏi T4; `protocol_v1` bản nháp | — |
| **M2 Kiểm định và khóa protocol** | Xong và đạt G1 ngày 18/11/2026 | Chấm mù bằng ≥ 3 LLM rater (300 activity và 90 ngày T1, hai lượt); kiểm chéo DrillScribe, Anatoly5ms, TSPP; viết và khóa `protocol_v1` | `protocol_v1.yaml` + `.sha256`; báo cáo độ khớp nhãn | **G1 đạt:** khóa SHA-256 trước baseline. Giữ κ ≥ 0,60, ≥ 20 mục được chấm và ≥ 3 giếng có ≥ 5 mục mỗi giếng. 0 lớp đủ ngưỡng báo điểm riêng |
| **M3–M4 Baseline** | 18–20/11/2026 (xong phần chạy) | TF-IDF + logistic, DistilBERT (mọi shard, ba seed), VAI DeepSeek (toàn ma trận T4/C4 và T2, ba lượt lặp), mẫu Sonnet/Haiku; Qwen v1 dừng 19/11 (chưa đầy đủ), Llama không chạy | Bảng kết quả, ≥ 3 seed cho model ngẫu nhiên, CI theo giếng (`outputs/m34/report.json`) | **G2 v2 đạt 20/11** (protocol v2, §12 ý 32–33). G2 v1 không thể đạt vì Qwen và Llama dừng |
| **M5 Hiệu chuẩn judge và phân tích lỗi** | 20/11/2026 – 3/2027 | Dùng kết quả độ ổn định từ M2; T5 nếu kịp; phân tích lỗi; hiệu chuẩn LLM-judge; đối chiếu EGS | κ, agreement của judge, tương quan EGS | **G3:** chỉ dùng LLM-judge cho T4 khi κ giữa judge và điểm tự động theo đáp án XML đạt ≥ 0,6 (không có người chấm; protocol v3); không đạt thì T4 chỉ báo metric tự động và ghi rõ. **Đạt ngày 20/11/2026:** Sonnet κ = 0,98 (CI 0,947–1,0), Haiku 0,90; số chính T4 vẫn là điểm tự động (§1.7). Phân loại lỗi và RQ4 xong 20/11 (protocol v4, §12 ý 35). T5 xong 20/11 (protocol v5, §1.8, §12 ý 36) |
| **M6 Viết và nộp** | 4/2027 | Viết bài; đóng gói code, nhãn, protocol, hash sau khi xác nhận giấy phép phát hành ở G4; preprint; nộp | Bản nộp | **G4:** gói tái lập chạy lại được từ đầu; giấy phép các bộ nhãn bên thứ ba đã kiểm |
| **M5 Hiệu chuẩn judge và phân tích lỗi** | 20/11/2026 – 3/2027 | Dùng kết quả độ ổn định từ M2; T5 nếu kịp; phân tích lỗi; hiệu chuẩn LLM-judge; đối chiếu EGS | κ, agreement của judge, tương quan EGS | **G3:** chỉ dùng LLM-judge cho T4 khi κ giữa judge và điểm tự động theo đáp án XML đạt ≥ 0,6 (không có người chấm; protocol v3); không đạt thì T4 chỉ báo metric tự động và ghi rõ. **Đạt ngày 20/11/2026:** Sonnet κ = 0,98 (CI 0,947–1,0), Haiku 0,90; số chính T4 vẫn là điểm tự động (§1.7). Phân loại lỗi và RQ4 xong 20/11 (protocol v4, §12 ý 35). T5 xong 20/11 (protocol v5, §1.8, §12 ý 36). Tín hiệu cấy cho T2/T3 xong 20/11 (protocol v6, §1.9, §12 ý 37) |
| **M6 Viết và nộp** | Từ 23/11/2026, nộp 4/2027 | Viết bài (đã rà soát lượt đầu 23/11, `paper/`, §12 ý 38–39); đóng gói code, nhãn, protocol, hash sau khi xác nhận giấy phép phát hành ở G4; preprint; nộp | Bản nộp | **G4:** gói tái lập chạy lại được từ đầu; giấy phép các bộ nhãn bên thứ ba đã kiểm |
---
@@ -545,10 +591,12 @@ Ngưỡng các cổng chốt trong `protocol_v1` trước G1; sau đó ngưỡng
| `scripts/04_ocr_hub.py`, `06_parse_witsml.py`, `07_labels.py`, `08_t4_questions.py`, `08_t4_xml_check.py`, `09_audit.py`, `run_m1.sh` | Pipeline M1 (README) |
| `configs/labels.yaml`, `t4_templates.yaml`, `ocr_hub.yaml`, `protocol_v1.yaml` và `.sha256` | Bảng ánh xạ, 39 template T4, ghép OCR, protocol đã khóa tại G1 |
| `scripts/10_m2_*.py`, `scripts/run_m2.sh`, `configs/m2_validation.yaml` | Mẫu phân tầng, rater mở chạy cục bộ, kiểm chéo, thống kê độ đồng thuận và kiểm tra trước khi khóa G1 |
| `tests/` | 204 test đạt ngày 20/11 (gồm 8 test mock baseline v2, 3 test mẫu session, 5 test judge G3, 24 test phân loại lỗi/EGS và 12 test T5). Test cần dữ liệu mang marker `data` |
| `tests/` | 226 test đạt ngày 23/11 (gồm 8 test mock baseline v2, 3 test mẫu session, 5 test judge G3, 24 test phân loại lỗi/EGS, 12 test T5 và 22 test tín hiệu cấy). Test cần dữ liệu mang marker `data` |
| `scripts/18_m5_judge.py`, `volve_dia/m5_judge.py`, `configs/protocol_v3.yaml` và `.sha256` | Hiệu chuẩn LLM-judge cho G3 so với điểm tự động theo đáp án XML (§1.7, §12 ý 34) |
| `scripts/19_m5_errors.py`, `volve_dia/m5_errors.py`, `configs/protocol_v4.yaml` và `.sha256` | Phân loại lỗi theo họ câu hỏi và RQ4 (EGS so với điểm tự động) → `outputs/m5/errors/` (§1.7, §12 ý 35) |
| `scripts/20_m5_t5.py`, `volve_dia/m5_t5.py`, `configs/protocol_v5.yaml` và `.sha256` | T5 truy xuất khoảng tương đồng và dự báo từ láng giềng → `outputs/m5/t5/` (§1.8, §12 ý 36) |
| `paper/`, `scripts/22_paper_figures.py`, `paper/check_numbers.py`, `tests/test_paper_numbers.py` | Bản thảo bài (LaTeX, `sections/*.tex`, `provenance/*.md`), hình từ `outputs/` và bộ kiểm số (§12 ý 38) |
| `scripts/21_m5_synthetic.py`, `volve_dia/m5_synthetic.py`, `configs/protocol_v6.yaml` và `.sha256`, `configs/synth_cues.yaml` | Nghiên cứu tín hiệu cấy cho T2 (cue văn bản) và T3 (hazard theo độ sâu) → `outputs/m5/synthetic/` (§1.9, §12 ý 37) |
| `docs/technical_overview.md` | Bài giảng cho người mới (cấu trúc theo ML-Porosity): khái niệm, dữ liệu, thiết kế, kết quả, bản đồ code |
| `scripts/11_m34_classify.py`, `12_m34_qa.py`, `13_m34_report.py`, `14_m34_t2_llm.py`, `run_m34.sh`; v2: `15_m34_v2.py`, `16_m34_session.py`, `run_m34_v2.sh`, `m34_status.sh`, `volve_dia/m34_v2.py`, `configs/protocol_v2.yaml` | Đặc trưng và T1–T3, Qwen zero-shot T2, suy luận T4/C4, metric ghép cặp, kiểm độ phủ G2 |
| `volve_dia/m34_*.py`, `configs/m34_baselines.yaml` | Triển khai thiết kế baseline, điểm và CI. Cấu hình chạy nối với hash giao thức G1 |
@@ -610,8 +658,7 @@ Danh sách chính ở bản đánh giá mục 9. Ghi chú đọc và BibTeX: `do
## 12. Việc làm ngay và nhật ký quyết định
1. **Việc tiếp theo (từ 20/11/2026).**
1. G2 v2 (ý 33), G3 (ý 34), phân loại lỗi và RQ4 (ý 35), T5 (ý 36) đã xong. Tiếp theo là viết bài (M6); T4 vẫn báo điểm tự
động làm số chính. Không được gọi bất kỳ kết quả nào là audit của người, của tác giả hay của chuyên gia.
1. G2 v2 (ý 33), G3 (ý 34), phân loại lỗi và RQ4 (ý 35), T5 (ý 36), tín hiệu cấy (ý 37) đã xong. Đã viết và rà soát lượt đầu bản thảo M6 ngày 23/11 (ý 38–39). T4 vẫn báo điểm tự động làm số chính. Không được gọi bất kỳ kết quả nào là audit của người, của tác giả hay của chuyên gia.
2. Giữ cách xử lý 16 trang lệch ngày và 7 trang chưa ghép của OCR hub theo §12 ý 21.
3. Các bài EAGE và OnePetro chưa lấy được toàn văn trong lần kiểm tra ngày 18/11. Xác nhận điều khoản
phát hành Volve ở G4 theo §12 ý 23.
@@ -794,7 +841,7 @@ Danh sách chính ở bản đánh giá mục 9. Ghi chú đọc và BibTeX: `do
- Hệ quả: số chính của T4 vẫn là điểm tự động. Judge chỉ là cách đọc phụ trên mẫu; toàn ma trận không được chấm lại vì
không có API key. Giới hạn: quyền đọc file của subagent không bị chặn, judge cùng họ dữ liệu huấn luyện với các baseline
LLM, mẫu phân tầng nên κ không phải ước lượng cho toàn bộ câu trả lời văn bản tự do.
- Phân tích kết quả cuối ghi ở §1.7: agent kém tool_only, OCR không kém XML trên T4 (H5 không được ủng hộ), rò rỉ mã rõ ở
- Phân tích kết quả cuối ghi ở §1.7: agent kém tool_only, CI so sánh OCR với XML trên T4 chứa 0 (H5 không được ủng hộ), rò rỉ mã rõ ở
T2 và xấp xỉ 0 ở T3, DeepSeek không hơn TF-IDF trên T2 (CI chứa 0).
35. **20/11/2026. Protocol v4: phân loại lỗi theo họ câu hỏi và RQ4.**
@@ -818,3 +865,45 @@ Danh sách chính ở bản đánh giá mục 9. Ghi chú đọc và BibTeX: `do
wellbore). Comment của chính khoảng là góc nhìn mô tả, báo riêng.
- Kết quả ở §1.8: depth nDCG@10 0,666, random 0,463; text_pre 0,611; witsml_pre 0,495; rrf_pre 0,670 (+0,004 so với depth, CI
chứa 0). Dự báo từ láng giềng AP 0,150 (0,116–0,204) so với prevalence 0,114. T5 ngoài G2, không có cổng.
37. **20/11/2026. Protocol v6: nghiên cứu tín hiệu cấy cho T2 và T3.**
- Lệch so với kế hoạch: H3 không đạt và nhãn T2/T3 thật dẫn xuất từ mã DDR, nên chưa đo được khả năng pipeline tìm lại một
tín hiệu biết chắc. `configs/protocol_v6.yaml` (khóa SHA-256 `0376aa18…`, mở rộng v5, không sửa v1–v5; cụm từ cue trong
`configs/synth_cues.yaml` `dfe39529…`) cố định nhãn cấy, cường độ, mô hình, metric, kiểm tra null và cách tính cường độ
hiệu dụng trước mọi điểm số cấy; trước khi khóa chỉ biết kết quả thật của v1–v5. Không có cổng, không thay H3.
- Kết quả ở §1.9: null đạt ở T2 f = 0,02 (AP 0,182) và T3 s = 0 (0,118); **không đạt ở T2 f = 0,10** (AP 0,193, lệch 0,0101
so với π = 0,183, CI seed 0 không chứa π), nên kết quả f = 0,10 không được diễn giải. Điều tra sau (23/11, không thuộc
v6): nguyên nhân là thiết kế, vì ở c = 0 < f việc không có cue đã là tín hiệu (chỉ báo không-cue một mình cho AP 0,2004);
null thật là c = f và cho AP 0,1819 (đạt). Pipeline không lệch chuẩn; phán quyết khóa của v6 giữ nguyên. Cue hiệu dụng của điểm T2 thật
c ≈ 0,82 (0,78–0,84); cường độ hiệu dụng của điểm T3 thật s ≈ 0,66 (0,55–0,72), oracle ≈ 0,21. Đây là giới hạn phát hiện
được, không phải kiểm định nhãn.
38. **23/11/2026. M6: bản thảo đầu của bài.**
- Thư mục `paper/` (LaTeX `article` + `natbib`, vì `elsarticle` chưa cài; đổi lớp khi nộp). Cấu trúc: 1 Introduction, 2 Related work,
3 Data, 4 Benchmark design, 5 Baselines, 6 Results (T4, C4, lỗi và EGS, rò rỉ T1–T3, T3/T5, kiểm định nhãn, tín hiệu cấy),
7 Discussion (bảng các kiểm định không được ủng hộ), 8 Conclusion, Phụ lục A (hồ sơ protocol), B (nhãn). Khoảng 22.000 từ, 44 trang.
Văn phong học theo ML-Porosity (`docs/research/paper-style-survey.md` của dự án đó): kết quả nói bằng lời trước, đặt điều kiện ở
đầu câu, thất bại viết theo thứ tự trượt gì, vì sao, bài học; áp dụng skill academic-humanizer và scientific-writing.
- Phân công theo AGENTS.md: năm agent Opus viết các phần và mã hình; Discussion, Conclusion và Abstract do phiên chính viết.
Mỗi phần có `paper/provenance/*.md` (khẳng định, giá trị, nguồn). `paper/check_numbers.py` kiểm từng số trong bài có trong
plan.md hoặc `outputs/` (1.938 số, 3 số ghi trong `paper/number_allowlist.txt` kèm lý do); `scripts/22_paper_figures.py` vẽ bốn
hình chỉ từ `outputs/`, 107 phép assert đạt.
- Phát hiện khi viết (đã sửa trong tài liệu): các số T2(b) ở đoạn cuối §1.6 là trung bình gộp nhiều tập con, không phải kết quả chính;
số chính lấy từ `classification.csv` (majority 0,183; lexicon 0,251; TF-IDF 0,4635; DistilBERT 0,593; DeepSeek 0,407; Qwen 0,264;
theo wellbore DistilBERT 0,618 và TF-IDF 0,489; mở mã TF-IDF 0,995 và DistilBERT 0,873). Nhầm wellbore của họ comparison chỉ 21–25% ở
C4, RAG và tool_only. Protocol v6 và các checkpoint đã khóa không sửa.
- Xương sống của bài: đo định lượng rò rỉ mã trong nhãn NPT (T2) và bản chất của nhãn (tín hiệu cấy), kèm T4/C4 như benchmark có đáp
án kiểm được. T3, T5, kiểm định nhãn (H3 không đạt), EGS (H4), OCR (H5) báo như kết quả không được ủng hộ hoặc chẩn đoán.
- Còn mở: tên tác giả và các khai báo, lớp và giới hạn của tạp chí (tra trên trang Elsevier, lần tìm 23/11 không ra), điều khoản
phát hành (G4), quét lại novelty, bốn bài chưa có toàn văn. Chưa commit.
39. **23/11/2026. M6: hoàn tất lượt rà soát và biên dịch bản thảo.**
- Chỉnh Abstract, Introduction, Discussion và Conclusion theo mẫu ML-Porosity. Đưa thí nghiệm che/mở mã lên trước,
giải thích 82% là tỷ lệ cue trong mô phỏng và giữ các diễn giải OCR, T3, T5 trong phạm vi khoảng tin cậy.
- Chốt mẫu số 1.652 câu cho điểm T4 chính và 1.366 câu có phạm vi giếng cho C4. Sửa thứ tự phân loại lỗi và
AP trung bình T3 DistilBERT mở mã thành 0,1235. Chi tiết ở `paper/audit_report.md`.
- 108 đối chiếu trực tiếp giữa bảng và đầu ra đạt. Bộ kiểm số xử lý 1.923 số, 3 số có lý do trong allowlist.
231 test đạt và SHA-256 của sáu protocol khớp. PDF 44 trang ở `outputs/paper/volve-dia-m6.pdf`.
- Đã bổ sung khai báo AI dạng nháp theo chính sách Elsevier và xác minh tóm tắt workshop ICML của Mishra et al.
Hướng dẫn tác giả của tạp chí trả HTTP 403. Còn tác giả xác nhận khai báo, thông tin mô hình OCR, thể thức
tạp chí, toàn văn tài liệu còn mở, quét novelty lần cuối và điều khoản phát hành ở G4.

View File

@@ -241,12 +241,188 @@
in the project plan; confirm the applicable terms before release}
}
% --- Methods, models and benchmarks: added 23 Nov 2026 -------------------------------------------------------
% DOI entries: doi.org content negotiation (Accept: application/x-bibtex) checked against api.crossref.org/works.
% arXiv entries: export.arxiv.org API and the DataCite record of the 10.48550 DOI. Other sources as noted.
@article{cohen1960kappa,
author = {Cohen, Jacob},
title = {A Coefficient of Agreement for Nominal Scales},
journal = {Educational and Psychological Measurement},
year = {1960},
volume = {20},
number = {1},
pages = {37--46},
publisher = {SAGE Publications},
doi = {10.1177/001316446002000104},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{pedregosa2011sklearn,
author = {Pedregosa, Fabian and Varoquaux, Ga{\"e}l and Gramfort, Alexandre and Michel, Vincent and
Thirion, Bertrand and Grisel, Olivier and Blondel, Mathieu and Prettenhofer, Peter and Weiss, Ron and
Dubourg, Vincent and Vanderplas, Jake and Passos, Alexandre and Cournapeau, David and
Brucher, Matthieu and Perrot, Matthieu and Duchesnay, {\'E}douard},
title = {Scikit-learn: Machine Learning in {Python}},
journal = {Journal of Machine Learning Research},
year = {2011},
volume = {12},
number = {85},
pages = {2825--2830},
url = {https://jmlr.org/papers/v12/pedregosa11a.html},
eprint = {1201.0490},
archivePrefix = {arXiv},
annote = {Verified 23 Nov 2026: JMLR BibTeX (no DOI) and arXiv API record 1201.0490}
}
@misc{sanh2019distilbert,
author = {Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
title = {{DistilBERT}, a distilled version of {BERT}: smaller, faster, cheaper and lighter},
year = {2019},
publisher = {arXiv},
eprint = {1910.01108},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
doi = {10.48550/arXiv.1910.01108},
annote = {Verified 23 Nov 2026: arXiv API and DataCite record agree}
}
@inproceedings{cormack2009rrf,
author = {Cormack, Gordon V. and Clarke, Charles L. A. and Buettcher, Stefan},
title = {Reciprocal Rank Fusion Outperforms {Condorcet} and Individual Rank Learning Methods},
booktitle = {Proceedings of the 32nd International ACM SIGIR Conference on Research and Development in
Information Retrieval},
series = {SIGIR '09},
year = {2009},
pages = {758--759},
publisher = {ACM},
doi = {10.1145/1571941.1572114},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{jarvelin2002ndcg,
author = {J{\"a}rvelin, Kalervo and Kek{\"a}l{\"a}inen, Jaana},
title = {Cumulated Gain-Based Evaluation of {IR} Techniques},
journal = {ACM Transactions on Information Systems},
year = {2002},
volume = {20},
number = {4},
pages = {422--446},
publisher = {Association for Computing Machinery},
doi = {10.1145/582415.582418},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{kaufman2012leakage,
author = {Kaufman, Shachar and Rosset, Saharon and Perlich, Claudia and Stitelman, Ori},
title = {Leakage in Data Mining: Formulation, Detection, and Avoidance},
journal = {ACM Transactions on Knowledge Discovery from Data},
year = {2012},
volume = {6},
number = {4},
pages = {1--21},
publisher = {Association for Computing Machinery},
doi = {10.1145/2382577.2382579},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{roberts2017crossvalidation,
author = {Roberts, David R. and Bahn, Volker and Ciuti, Simone and Boyce, Mark S. and Elith, Jane and
Guillera-Arroita, Gurutzeta and Hauenstein, Severin and Lahoz-Monfort, Jos{\'e} J. and
Schr{\"o}der, Boris and Thuiller, Wilfried and Warton, David I. and Wintle, Brendan A. and
Hartig, Florian and Dormann, Carsten F.},
title = {Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure},
journal = {Ecography},
year = {2017},
volume = {40},
number = {8},
pages = {913--929},
publisher = {Wiley},
doi = {10.1111/ecog.02881},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@misc{yang2025qwen3,
author = {Yang, An and Li, Anfeng and Yang, Baosong and Zhang, Beichen and Hui, Binyuan and Zheng, Bo and
others},
title = {{Qwen3} Technical Report},
year = {2025},
publisher = {arXiv},
eprint = {2505.09388},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
doi = {10.48550/arXiv.2505.09388},
annote = {Verified 23 Nov 2026: arXiv API and DataCite record agree; 60 authors, first six listed}
}
@misc{grattafiori2024llama3,
author = {Grattafiori, Aaron and Dubey, Abhimanyu and Jauhri, Abhinav and Pandey, Abhinav and
Kadian, Abhishek and Al-Dahle, Ahmad and others},
title = {The {Llama} 3 Herd of Models},
year = {2024},
publisher = {arXiv},
eprint = {2407.21783},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
doi = {10.48550/arXiv.2407.21783},
annote = {Verified 23 Nov 2026: arXiv API and DataCite record agree; the v3 text states that all results
are for the Llama 3.1 models; 561 authors, first six listed}
}
@inproceedings{ouyang2025omnidocbench,
author = {Ouyang, Linke and Qu, Yuan and Zhou, Hongbin and Zhu, Jiawei and Zhang, Rui and Lin, Qunshu and
Wang, Bin and Zhao, Zhiyuan and Jiang, Man and Zhao, Xiaomeng and Shi, Jin and Wu, Fan and
Chu, Pei and Liu, Minghao and Li, Zhenxiang and Xu, Chao and Zhang, Bo and Shi, Botian and
Tu, Zhongying and He, Conghui},
title = {{OmniDocBench}: Benchmarking Diverse {PDF} Document Parsing with Comprehensive Annotations},
booktitle = {2025 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2025},
pages = {24838--24848},
publisher = {IEEE},
doi = {10.1109/CVPR52734.2025.02313},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree; also arXiv 2412.07626. Text is scored by
normalized edit distance to the reference annotation (project README)}
}
@misc{deepseekai2026v41flash,
author = {{DeepSeek-AI}},
title = {{DeepSeek-V4.1-Flash}: Pushing the Limits of {KV} Cache Compression},
year = {2026},
howpublished = {Technical report, Hugging Face repository \texttt{deepseek-ai/DeepSeek-V4.1-Flash}},
url = {https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash},
note = {Technical report, PDF dated 10 September 2026; not peer reviewed},
annote = {Title and author from the PDF and the repository citation block, read 23 Nov 2026 (repository head 314113f8a7da);
no DOI or arXiv record; not peer reviewed}
}
@misc{lu2026upstreambench,
author = {Lu, Rong},
title = {{UpstreamBench}: A 7,440-Question {LLM} Benchmark for Expert Upstream Petroleum and Subsurface
Reasoning},
year = {2026},
month = jul,
publisher = {MDPI AG},
howpublished = {Preprints.org},
doi = {10.20944/preprints202606.1410.v2},
note = {Preprint, version 2, posted 6 July 2026; not peer reviewed},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@misc{mishra2026timeseries,
author = {Mishra, Ankush and Buiting, Sebastiaan and Sengupta, Soumyadipta and Benzine, Abdallah},
title = {From Time-Series to Text: Multimodal and Agentic Approaches for Automated Drilling Report Generation},
year = {2026},
howpublished = {Workshop on Foundation Models for Structured Data, ICML 2026 (poster)},
url = {https://openreview.net/forum?id=X1s2qN24kX},
note = {Workshop poster; abstract only},
annote = {Title, authors and workshop read from the ICML 2026 virtual page (icml.cc/virtual/2026/71506) on
23 Nov 2026; OpenReview refused automated access; no DOI; abstract only}
}
% --- Not fully verified: do not cite before the missing fields are confirmed ---------------------------------
% EAGE 2026: "From Field Logs to Actionable Insights: A Multi-Agent LLM Approach for Factual Summarization of
% Drilling Operations", 87th EAGE Annual Conference & Exhibition, June 2026,
% https://www.earthdoc.org/content/papers/10.3997/2214-4609.2026101276
% Title and venue from a web-search snippet of the EarthDoc page; authors NOT obtained; the DOI
% 10.3997/2214-4609.2026101276 did not resolve at doi.org and was absent from Crossref on 17 Nov 2026.
% ICML 2026 workshop: Mishra, A., Buiting, S., Sengupta, S., Benzine, A., "From Time-Series to Text: Multimodal and
% Agentic Approaches for Automated Drilling Report Generation", Workshop on Foundation Models for Structured Data,
% ICML 2026, https://openreview.net/forum?id=X1s2qN24kX (metadata from the icml.cc virtual page only).
% 10.3997/2214-4609.2026101276 did not resolve at doi.org and was absent from Crossref on 17 Nov 2026,
% and still returned 404 at doi.org on 23 Nov 2026 (EarthDoc refuses automated access).

View File

@@ -14,7 +14,8 @@
- **Phân loại lỗi và RQ4 xong ngày 20/11/2026** (protocol v4): EGS tương quan vừa với điểm tự động (ρ 0,53–0,54),
chủ yếu vì tách câu có trả lời khỏi câu bỏ trả lời.
- **T5 xong ngày 20/11/2026** (protocol v5): truy xuất khoảng tương đồng theo độ sâu đạt nDCG@10 0,666 (ngẫu nhiên 0,463);
văn bản, WITSML hay kết hợp không hơn độ sâu. Còn lại: viết bài, điều khoản phát hành ở G4.
văn bản, WITSML và điểm kết hợp đều chưa cho thấy lợi thế so với độ sâu. Bản thảo đã qua lượt rà soát đầu ngày 23/11/2026.
Còn xác nhận thông tin tác giả, thể thức tạp chí và điều khoản phát hành ở G4. [Biên bản rà soát](../paper/audit_report.md).
**Bài giảng này dành cho ai.** Người chưa biết gì về khoan dầu khí, học máy hay mô hình ngôn ngữ lớn. Chỉ cần toán phổ thông: tỉ lệ, trung bình, xác suất đơn giản.
@@ -941,7 +942,7 @@ Mỗi baseline ngẫu nhiên chạy ba seed.
| M2 | 18/11/2026 | 300 activity, 90 báo cáo T1, hai lượt LLM rater, khóa protocol | G1 (**đạt**) | Khóa SHA-256 trước baseline. Không có lớp đạt đủ điều kiện báo điểm riêng |
| M3–M4 | Từ 18/11/2026, hạn 2/2027 | Baseline, trọng tâm T4 và C4, ablation T2/T3 | G2 v2 (**đạt** 20/11) | Báo đủ kết quả trong phạm vi đã khóa |
| M5 | Từ 20/11/2026, hạn 3/2027 | Phân tích lỗi, LLM-judge | G3 (**đạt** 20/11, κ 0,98) | LLM-judge khớp điểm tự động theo đáp án XML (κ ≥ 0,6)? Không đạt thì T4 chỉ báo metric tự động; đạt thì số chính vẫn là điểm tự động |
| M6 | 4/2027 | Viết và nộp bài | G4 | Gói tái lập chạy lại được từ đầu? Giấy phép đã kiểm? |
| M6 | Từ 23/11/2026, nộp 4/2027 | Viết và nộp bài (đã rà soát lượt đầu ngày 23/11, `paper/`) | G4 | Gói tái lập chạy lại được từ đầu? Giấy phép đã kiểm? |
Ngưỡng các cổng không bao giờ đổi; chỉ ngày có thể đổi.
@@ -1064,8 +1065,8 @@ Qwen agent và T2 seed 1 dở dang, Llama không chạy ngoài smoke. Ô baselin
lượt, câu thuộc giếng, điểm tự động): C4 XML 0,151, HTML 0,177, OCR 0,181; RAG 0,148; zero-shot 0,071;
few-shot 0,151; tool_only 0,712; agent 0,618. Nghĩa là khi model được truy vấn bảng dựng từ XML, nó trả lời đúng
nhiều hơn hẳn so với khi chỉ đọc văn bản truy xuất. Qwen v1 (seed 0, chưa đầy đủ): C4 XML 0,214, HTML 0,235, OCR 0,196,
RAG 0,154. AP T2(b) che mã theo giếng: majority 0,179, lexicon 0,249, TF-IDF 0,461, DeepSeek zero-shot 0,405,
Qwen zero-shot 0,261, DistilBERT 0,597; mở mã: TF-IDF 0,994, DistilBERT 0,869, cho thấy rò rỉ mã rất lớn. AP T3(b)
RAG 0,154. AP T2(b) che mã theo giếng: majority 0,183, lexicon 0,251, TF-IDF 0,463, DeepSeek zero-shot 0,407,
Qwen zero-shot 0,264, DistilBERT 0,593; mở mã: TF-IDF 0,995, DistilBERT 0,873, cho thấy rò rỉ mã rất lớn. AP T3(b)
che mã theo giếng: majority 0,114, TF-IDF 0,123, DistilBERT 0,121, xấp xỉ mức ngẫu nhiên, nên T3 chỉ là chẩn đoán.
Mẫu Sonnet/Haiku (300 câu T4, ngoài độ phủ G2) xem plan §12 ý 33. Không kết quả nào là audit của người hay chuyên gia.
Bootstrap lấy nguyên giếng, giữ cặp dự đoán giữa các phương thức.
@@ -1111,6 +1112,19 @@ Biểu diễn không được đọc mã, nguyên nhân, đoạn khoan hay forma
- Dự báo ô 10 m sắp gặp khó khăn bằng 10 ô láng giềng ở giếng khác: AP 0,150 theo độ sâu (prevalence 0,114). T3 và T5 vẫn
là phân tích chẩn đoán.
**Tín hiệu cấy (protocol v6, §1.9 của plan).** Vì H3 không đạt và nhãn T2/T3 thật dẫn xuất từ mã DDR, ta không biết pipeline có
tìm lại được một tín hiệu mà ta *biết chắc* là có hay không. Cách kiểm: tự bốc nhãn ngẫu nhiên (nên biết chính xác), rồi
ghi vào đầu vào một tín hiệu cường độ biết trước và xem điểm tăng bao nhiêu. Với T2, nhãn NPT cấy có xác suất 0,183 và mỗi hàng
được cấy nhận một cụm từ nhân tạo với xác suất c; với T3, xác suất NPT của ô phụ thuộc độ sâu với độ dốc s.
- **Kiểm tra null** (không cấy gì thì điểm phải bằng tần suất nền ± 0,01): T2 với 2% cụm từ mồi đạt (AP 0,182 so với 0,183); T3
đạt (0,118 so với 0,114); **T2 với 10% cụm từ mồi không đạt** (0,193; lệch 0,0101), nên kết quả của cấu hình đó không được diễn
giải theo v6. Điều tra sau cho thấy lỗi ở định nghĩa null, không ở pipeline: khi hàng cấy không nhận cue (c = 0) còn hàng
không cấy nhận cue với xác suất 10%, thì "không có cue" đã là dấu hiệu của hàng cấy (chỉ báo này một mình cho AP 0,200).
Null thật là c = f, và ở đó AP là 0,182, đạt.
- T2: AP tăng đơn điệu từ 0,182 (c = 0) lên 0,521 (c = 1). Trong mô phỏng, điểm thật 0,463 khớp với c ≈ 0,82, tức một cụm từ cấy xuất hiện ở khoảng 82% hàng dương mô phỏng.
Tỷ lệ cue trong comment thật và độ hợp lệ của nhãn chưa được đo.
- T3: điểm thật 0,150 tương ứng hazard theo độ sâu s ≈ 0,66, rất yếu (trần oracle khoảng 0,21).
---
## Bài 11. Được nói gì, không được nói gì
@@ -1182,6 +1196,7 @@ Danh sách đầy đủ ở [plan.md](plan.md) §10.
| Hiệu chuẩn judge G3 | [m5_judge.py](../volve_dia/m5_judge.py) |
| Phân loại lỗi, EGS và RQ4 | [m5_errors.py](../volve_dia/m5_errors.py) |
| T5 truy xuất khoảng tương đồng | [m5_t5.py](../volve_dia/m5_t5.py) |
| Tín hiệu cấy cho T2 và T3 | [m5_synthetic.py](../volve_dia/m5_synthetic.py) |
### 12.3 Chạy theo pha
@@ -1196,6 +1211,7 @@ Cài đặt và bảng mô tả từng script ở [README.md](../README.md).
| M5 | `scripts/18_m5_judge.py prepare\|status\|collect` | Mẫu G3, batch cho judge trong session, κ so với điểm tự động |
| M5 | `scripts/19_m5_errors.py` (khoảng 3 phút) | Phân loại lỗi theo họ câu hỏi, EGS và ρ Spearman với điểm tự động (protocol v4) |
| M5 | `scripts/20_m5_t5.py` (khoảng 2 phút) | T5 truy xuất khoảng tương đồng và dự báo từ láng giềng (protocol v5) |
| M5 | `scripts/21_m5_synthetic.py --arm t3` (khoảng 4 phút) và `--arm t2` (4 shard song song, khoảng 2 giờ 30 phút mỗi shard) | Tín hiệu cấy cho T3 và T2 (protocol v6) |
`run_m1.sh` chưa được chạy trọn một lần từ đầu đến cuối; các bước của nó đã chạy riêng lẻ.
@@ -1206,10 +1222,11 @@ Cài đặt và bảng mô tả từng script ở [README.md](../README.md).
### 12.4 Test quan trọng
- Test nằm trong [tests/](../tests/): 204 test đạt ngày 20/11. Test cần dữ liệu mang marker `data`.
- Test nằm trong [tests/](../tests/): 226 test đạt ngày 23/11. Test cần dữ liệu mang marker `data`.
- [test_m5_judge.py](../tests/test_m5_judge.py): rút mẫu G3 cố định, view che cho judge, kiểm phán quyết, κ và cổng.
- [test_m5_errors.py](../tests/test_m5_errors.py): nhận diện số đo và trích DDR, thứ tự luật phân loại lỗi, lọc lượt đủ, Spearman và cách đọc H4.
- [test_m5_t5.py](../tests/test_m5_t5.py): chuẩn hóa formation, điều kiện chọn khoảng, mức liên quan, nDCG/MRR, phá hòa, RRF, bootstrap theo giếng và kNN loại cả giếng.
- [test_m5_synthetic.py](../tests/test_m5_synthetic.py): nhãn cấy theo seed, cue và mức phơi nhiễm, hazard và bisection, kiểm tra null, nội suy cường độ hiệu dụng.
- [test_ddr_xml.py](../tests/test_ddr_xml.py): số lượng khóa (`EXPECTED`) và sentinel.
- [test_qc.py](../tests/test_qc.py): luật so và căn hàng của QC.
- [test_witsml.py](../tests/test_witsml.py): số lượng WITSML và ghép tên wellbore.

View File

@@ -163,3 +163,9 @@ run_id,parent,name,status,exit_code,start,end,wall_s,wall,device,git,dirty,code_
20261120-070705_m5_errors,,m5_errors,ok,0,2026-11-20T07:07:05+00:00,2026-11-20T07:10:16+00:00,190.6,0:03:11,,8cb55a31538a,False,5db8b1cd0e5847f9,runlog,.venv/bin/python scripts/19_m5_errors.py
20261120-071047_m5_errors,,m5_errors,ok,0,2026-11-20T07:10:47+00:00,2026-11-20T07:14:01+00:00,193.1,0:03:13,,8cb55a31538a,True,ac5a4107dcc4ad71,runlog,.venv/bin/python scripts/19_m5_errors.py
20261120-073123_m5_t5,,m5_t5,ok,0,2026-11-20T07:31:23+00:00,2026-11-20T07:32:59+00:00,95.8,0:01:36,,23e15ee27edf,False,bf9b78258e4f2df1,runlog,.venv/bin/python scripts/20_m5_t5.py
20261120-084041_m5_synthetic,,m5_synthetic,ok,0,2026-11-20T08:40:41+00:00,2026-11-20T08:44:11+00:00,209.6,0:03:30,,5f780bab67ac,False,c27944f1218db019,runlog,.venv/bin/python scripts/21_m5_synthetic.py --arm t3
20261120-084446_m5_synthetic-2,,m5_synthetic,ok,0,2026-11-20T08:44:46+00:00,2026-11-20T11:13:52+00:00,8946.0,2:29:06,,5f780bab67ac,True,2845ef75e9c05096,runlog,.venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 0/4
20261120-084446_m5_synthetic,,m5_synthetic,ok,0,2026-11-20T08:44:46+00:00,2026-11-20T11:14:40+00:00,8993.9,2:29:54,,5f780bab67ac,True,2845ef75e9c05096,runlog,.venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 1/4
20261120-084446_m5_synthetic-4,,m5_synthetic,ok,0,2026-11-20T08:44:46+00:00,2026-11-20T11:14:50+00:00,9004.1,2:30:04,,5f780bab67ac,True,2845ef75e9c05096,runlog,.venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 2/4
20261120-084446_m5_synthetic-3,,m5_synthetic,ok,0,2026-11-20T08:44:46+00:00,2026-11-20T11:14:54+00:00,9008.1,2:30:08,,5f780bab67ac,True,2845ef75e9c05096,runlog,.venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 3/4
20261123-014852_m5_synthetic_diagnose,,m5_synthetic_diagnose,ok,0,2026-11-23T01:48:52+00:00,2026-11-23T01:48:54+00:00,2.8,0:00:03,,5f780bab67ac,True,96de7594148b7fdb,runlog,.venv/bin/python scripts/21_m5_synthetic.py --arm diagnose
1 run_id parent name status exit_code start end wall_s wall device git dirty code_sha source cmd
163 20261120-070705_m5_errors m5_errors ok 0 2026-11-20T07:07:05+00:00 2026-11-20T07:10:16+00:00 190.6 0:03:11 8cb55a31538a False 5db8b1cd0e5847f9 runlog .venv/bin/python scripts/19_m5_errors.py
164 20261120-071047_m5_errors m5_errors ok 0 2026-11-20T07:10:47+00:00 2026-11-20T07:14:01+00:00 193.1 0:03:13 8cb55a31538a True ac5a4107dcc4ad71 runlog .venv/bin/python scripts/19_m5_errors.py
165 20261120-073123_m5_t5 m5_t5 ok 0 2026-11-20T07:31:23+00:00 2026-11-20T07:32:59+00:00 95.8 0:01:36 23e15ee27edf False bf9b78258e4f2df1 runlog .venv/bin/python scripts/20_m5_t5.py
166 20261120-084041_m5_synthetic m5_synthetic ok 0 2026-11-20T08:40:41+00:00 2026-11-20T08:44:11+00:00 209.6 0:03:30 5f780bab67ac False c27944f1218db019 runlog .venv/bin/python scripts/21_m5_synthetic.py --arm t3
167 20261120-084446_m5_synthetic-2 m5_synthetic ok 0 2026-11-20T08:44:46+00:00 2026-11-20T11:13:52+00:00 8946.0 2:29:06 5f780bab67ac True 2845ef75e9c05096 runlog .venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 0/4
168 20261120-084446_m5_synthetic m5_synthetic ok 0 2026-11-20T08:44:46+00:00 2026-11-20T11:14:40+00:00 8993.9 2:29:54 5f780bab67ac True 2845ef75e9c05096 runlog .venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 1/4
169 20261120-084446_m5_synthetic-4 m5_synthetic ok 0 2026-11-20T08:44:46+00:00 2026-11-20T11:14:50+00:00 9004.1 2:30:04 5f780bab67ac True 2845ef75e9c05096 runlog .venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 2/4
170 20261120-084446_m5_synthetic-3 m5_synthetic ok 0 2026-11-20T08:44:46+00:00 2026-11-20T11:14:54+00:00 9008.1 2:30:08 5f780bab67ac True 2845ef75e9c05096 runlog .venv/bin/python scripts/21_m5_synthetic.py --arm t2 --shard 3/4
171 20261123-014852_m5_synthetic_diagnose m5_synthetic_diagnose ok 0 2026-11-23T01:48:52+00:00 2026-11-23T01:48:54+00:00 2.8 0:00:03 5f780bab67ac True 96de7594148b7fdb runlog .venv/bin/python scripts/21_m5_synthetic.py --arm diagnose

81
paper/README.md Normal file
View File

@@ -0,0 +1,81 @@
# Manuscript draft (M6)
*Volve-DIA: A leakage-controlled benchmark for daily drilling reports and real-time drilling data.* One author.
Target venue: *Geoenergy Science and Engineering* (Elsevier). The journal guide was inaccessible on 23 November 2026.
The draft is plain LaTeX (`article` + `natbib`) because `elsarticle` is not installed on this server.
Build with `(cd paper && pdflatex main && bibtex main && pdflatex main && pdflatex main && pdflatex main)`.
The reviewed PDF is in `outputs/paper/volve-dia-m6.pdf`. [The M6 audit](audit_report.md) records the evidence and edits.
Figures: `scripts/22_paper_figures.py` writes `paper/figures/*.pdf` from `outputs/` only (run with the
ML-Porosity interpreter `/home/jovyan/lamlvh/ML-Porosity/.venv/bin/python`, which has matplotlib; the Volve-DIA venv has none).
## Section map and labels
| File | Section | Label |
|---|---|---|
| `00_abstract.tex` | Abstract | |
| `01_introduction.tex` | 1 Introduction | `sec:intro` |
| `02_related.tex` | 2 Related work | `sec:related`, `tab:positioning` |
| `03_data.tex` | 3 Data and the three versions of a report | `sec:data`, `tab:inventory`, `fig:overview` |
| `04_design.tex` | 4 Benchmark design | `sec:design`, `tab:tasks`, `sec:design:labels`, `sec:design:validation`, `sec:design:splits`, `sec:design:protocols` |
| `05_baselines.tex` | 5 Baselines and evaluation | `sec:baselines`, `tab:baselines` |
| `06_results.tex` | 6 Results | `sec:results`, `sec:res:t4`, `sec:res:c4`, `sec:res:errors`, `sec:res:leak`, `sec:res:diag`, `sec:res:labels`, `sec:res:planted` |
| `07_discussion.tex` | 7 Discussion | `sec:discussion`, `tab:lessons` |
| `08_conclusion.tex` | 8 Conclusion | `sec:conclusion` |
| `A_record.tex` | Appendix A: protocol record | `app:record`, `tab:protocols` |
| `B_labels.tex` | Appendix B: label mapping and T4 templates | `app:labels` |
Tables: `tab:t4main`, `tab:contrasts`, `tab:c4fidelity`, `tab:taxonomy`, `tab:egs`, `tab:leakage`, `tab:labelkappa`, `tab:t5`, `tab:planted`.
Figures: `fig:overview` (TikZ, in `03_data.tex`), `fig:t4`, `fig:taxonomy`, `fig:leakage`, `fig:planted` (files `t4_modes.pdf`,
`taxonomy.pdf`, `leakage.pdf`, `planted.pdf`).
## Terms in the paper and in the repository (keep the paper side)
| In the paper | Repository |
|---|---|
| masked / unmasked input (activity codes hidden / shown) | che mã / mở mã |
| NPT definition (a): interruption codes only; (b): interruption, `state = fail` or `stateDetailActivity` not success | NPT (a) / (b) |
| T1 section (hole section of a drilling day); T2 NPT activity; T3 NPT depth interval; T4 grounded question answering; T5 similar-interval retrieval | T1--T5 |
| C4 (document fidelity): the same T4 questions answered from XML, HTML or OCR text | C4 |
| text retrieval baselines: C4 XML, C4 HTML, C4 OCR; RAG; zero-shot; few-shot; tool-only; agent | c4, rag, zero_shot, few_shot, tool_only, agent |
| DeepSeek (the hosted DeepSeek-V4.1-Flash model, three repetitions) | VAI DeepSeek |
| Qwen3-8B (incomplete run, seed 0, reported as such) | Qwen v1 |
| session subagent samples (Sonnet, Haiku) | session sample |
| blind LLM raters (Qwen3-8B, Gemma 3 12B, Ministral 3 8B in M2; Sonnet, Opus, Haiku in the trial) | LLM rater |
| protocol v1--v6 | `configs/protocol_v*.yaml` |
| planted-signal study (cue fraction c, signal strength s) | synthetic, protocol v6 |
| well (11 fields' wells) / wellbore (26 sidetracks and parents) | giếng / wellbore |
## Writing rules (from ML-Porosity `docs/research/paper-style-survey.md` and the academic-humanizer skill)
1. Problem in one sentence, question in one sentence. Say the result in words first, symbols second.
2. First sentence of a paragraph states its conclusion. `\paragraph` titles are answers where possible.
3. Conditions at the start of a sentence, not in a trailing parenthesis. Physical quantities, not repository codes.
4. Numbers follow the idea, with unit and comparator, and lead with the strongest competitor. Ranges, not averages, unless the averaging is stated.
5. Each failure goes: what failed, why (evidence), lesson. If the cause was not tested, say so. Failures and successes get equal weight in Introduction, Discussion and Conclusion.
6. Process record (lock times, hashes, deviations) goes to Appendix A; the body keeps one sentence and a pointer.
7. No em-dashes. No "novel", "comprehensive", "extensive", "pivotal", "delve", "landscape", "leverage", "paves the way", "to the best of our knowledge". Sentences past about 30 words are split. Verbs never stronger than the evidence ("suggests", "is consistent with" where the evidence is that weak).
8. Quantities of a result carry their source: method, metric, baseline, interval.
## Forbidden claims (docs/plan.md Sec. 10), repeated because they are the main risk
- Never "first", "expert", "gold standard", "human-annotated", "human-audited", "author-audited" for labels or evaluation. The raters are LLMs; G3 measured consistency with the automatic scorer, not agreement with people.
- Never call DrillScribe or Bassey labels independent NPT labels. Never put PetroAgents numbers in a table with ours as if they shared a protocol.
- T4 headline numbers are the automatic scores. T2 and T3 are DDR-code diagnostics, not validated ground truth. H3 (label kappa >= 0.6) was not met; H4 and H5 were not supported; report that plainly.
- Qwen results are an incomplete v1 run (seed 0); Llama never ran. Say so wherever Qwen appears.
- Protocol v6 null check failed for T2 f = 0.10; the locked verdict stands and that setting is not interpreted. The 23/11 diagnosis is post hoc and is labelled so.
- Pilot OCR numbers must not be presented as full-corpus numbers. Tight well, HPHT, Bit Record End mMD come from XML only.
## Provenance
The files under `provenance/` trace quantities to their outputs or the plan. `check_numbers.py`
lists every number in `sections/*.tex` that is absent from `docs/plan.md` and the JSON/CSV reports it indexes. The list must be
empty or explained before submission. The audit also checks that metrics are attached to the correct outcomes and subsets.
## Open items (author)
- Author name, affiliation, corresponding address, funding, competing interests, CRediT roles and final AI-use disclosure. The disclosure follows the [Elsevier AI policy](https://www.elsevier.com/en-gb/about/policies-and-standards/generative-ai-policies-for-journals).
- OCR model name and version for the full-corpus export.
- Venue class, abstract limit, keywords and highlights. The [journal guide](https://www.sciencedirect.com/journal/geoenergy-science-and-engineering/publish/guide-for-authors) returned HTTP 403 on 23 November 2026.
- Release terms for the derived package (plan Sec. 12 item 23, gate G4) and the final novelty search before submission.
- Full texts still missing: EAGE 2026101276, SPE-236554-MS, SPE-235330-MS, IPTC-25191-MS. Statements about them rest on abstracts and are marked as such.

75
paper/audit_report.md Normal file
View File

@@ -0,0 +1,75 @@
# M6 manuscript audit, 23 November 2026
The audit read the local result files and implementation for the headline statements and tables. In the table below,
S1 denotes an error in a number, scope or implementation detail. S2 denotes an unsupported inference, S3 a
cross-section inconsistency and S4 an editorial issue. The revised text implements the recorded dispositions.
## Findings
| Severity | Location | Evidence | Disposition |
|---|---|---|---|
| S1 | Abstract and Conclusion, T4 accuracy | In m34/qa.csv, the non-C4 DeepSeek modes have 1,652 well-scoped questions. m34/report.json records 1,376 C4 pairs overall and the scored C4 rows in qa.csv have 1,366. | State the 1,652 denominator with tool-only, agent, RAG and zero-shot. State the 1,366 denominator with paired C4 scores. |
| S1 | Results, code-leakage table | Full XML, all rows, by well, definition (b), unmasked T3 DistilBERT AP averages 0.123532 across seeds in m34/classification.csv. | Report 0.1235. |
| S1 | Results, ordered error taxonomy | The function error_class in volve_dia/m5_errors.py checks an incorrect answer to an unanswerable item before abstention, wrong wellbore and citation rules. | List the rules in implemented order. The output table already held the computed values. |
| S1 | Results, C4 date flags | The OCR page matching code checks the dates extracted from the matched PDF text layer against OCR. m34/report.json gives 83 affected questions and 1,293 retained. | Describe a date from the PDF text layer missing in OCR. The sensitivity rebuilds the corpora and scores 1,284 well-scoped questions. |
| S1 | Protocol record and project plan, synthesis runs | logs/index.csv records five successful m5_synthetic runs on 20 November. The four T2 shards are dirty and the T3 run is clean. | Correct the count and describe the two working-tree states. |
| S1 | Baselines and Design, ablation scope | m34/classification.csv contains masked and unmasked TF-IDF and DistilBERT rows. DeepSeek and Qwen T2 rows are masked, and the rule baselines are deterministic. | Name the baselines that ran the paired code ablation. |
| S1 | Baselines, agent configuration | volve_dia/m34_qa.py uses the initial retrieved context and enables search for the agent. Both tool configurations run the fixed call loop. | Describe the initial context and tool choices. |
| S1 | T4 headline table, citation precision and wrong-wellbore rate | scoring_row in volve_dia/m34_qa.py counts out-of-scope citations or names and incompatible wellbore answers. The taxonomy includes reports cited even in prompts with no supporting records. | Use the implemented definition. Omit citation precision for the two modes without supporting records. |
| S2 | Abstract, Introduction, Discussion and Results, planted cues | m5/synthetic/report.json estimates the cue rate by interpolation of a simulated one-phrase response curve. It does not contain a count of actual comments with cues. | Report about 82% among planted positives. Treat possible cue spill as an unisolated effect. |
| S2 | Results and Discussion, OCR and agent interpretation | m34/qa_contrasts.csv gives OCR minus XML intervals spanning zero. Passage content varies with representation. The query and agent modes differ in context, tool choice and instructions. | Report the unresolved OCR effect and the observed differences in abstention and call failures. Leave the underlying mechanisms open. |
| S2 | Results, free-text judge | In m5/judge/report.json, Sonnet accepted one of 50 auto-incorrect items from a balanced, sampled set. No human judged the answers. | State the sampled disagreement. Keep the automatic score and avoid estimating scorer bias from it. |
| S2 | Results and Discussion, T3 and T5 | m34/classification_contrasts.csv gives paired T3 AP intervals spanning zero. m5/t5/report.json gives a paired interval spanning zero for the best fusion versus depth. | Describe near-prevalence AP and the unresolved differences. Attribute observed T5 performance to the measured formation-match pattern only as an interpretation. |
| S3 | Design and Discussion, H5 | The plan's H5 compares OCR effects on T4 and T2. T1 belongs to the broader sensitivity question. | Match the hypothesis to the plan and identify the component addressed by the paired T4 analysis. |
| S3 | Protocol record, planted calibration reference | Protocol v6 records the old pooled AP of 0.461. The synthetic report uses the full XML/well AP of 0.46346 and retains the planned-value interpolation. | Record both reference values in the protocol appendix and preserve the original null verdict. |
| S3 | Results and Data, hole diameter and TSPP | ddr/reports.parquet contains 990 null diaHole values. The placeholder accounts for the difference from the 989 non-placeholder fills in labels/summary.json. audit/m2_300/cross_checks/summary.json maps TSPP2, TSPP3 and TSPP4 to F-4, F-9 A and F-1, with 9, 14 and 15 activities. | Retain both counts with their scopes. The manuscript already uses the correct TSPP sites and activity counts. |
| S3 | Results, EGS pool | m5/errors/report.json includes the rebuilt C4 sensitivity runs in the pooled answerable, well-scoped predictions. The level-specific accuracies are micro averages. | Identify the population in the EGS text. |
| S4 | Abstract, Introduction, Discussion and Conclusion | The author-selected ML-Porosity sample leads with the finding and confines the protocol details to the record. | Lead with code exposure and table access, give comparators alongside scores, and move run history to Appendix A. |
| S4 | Design and Related work, citations | The AP implementation is in m34_report.py and can be defined directly. The ICML workshop page verifies Mishra et al. at abstract level. EAGE 2026101276 metadata remain incomplete. | State the AP calculation and cite the confirmed abstract. Retain the unresolved EAGE note. |
## Source checks
- T4 and C4. In m34/qa.csv, filter DeepSeek to well-scoped, macro-family rows and group by mode, modality and
repetition. T4 mean accuracy is 0.712, 0.618, 0.148 and 0.071 for tool-only, agent, RAG and zero-shot. The C4
means are 0.151, 0.177 and 0.181 for XML, HTML and OCR. Compare each repetition with qa_contrasts.csv for the
six paired rows in the main contrast table. The paired OCR evidence leaves H5 unsupported.
- T2 and T3. Filter m34/classification.csv to definition (b), XML, well and all items. Check T2 majority
0.183, lexicon 0.251, TF-IDF 0.463 masked and 0.995 exposed, DistilBERT 0.593 masked and 0.873 exposed,
DeepSeek 0.407 and partial Qwen 0.264. The paired contrast gives 0.531 for TF-IDF (0.480 to 0.580).
The comparable T3 APs stay near 0.114. The T3 TF-IDF AP contrast spans zero, while its IoU contrast
has a lower bound just above zero. The Results retain both.
- Error classes and EGS. The taxonomy values match m5/errors/taxonomy.csv family-macro rows. The code-based
wrong-wellbore indicator in the T4 table can be larger than the mutually exclusive taxonomy class. In the
pooled EGS report the correlations round to 0.538, 0.535 and 0.535 across repetitions. At score levels 0,
1/3 and 2/3 the repetition-0 counts are 6,242, 6,489 and 3,211. Micro accuracy is 0.013, 0.221 and 0.669.
- T5 and planted signal. Check the T5 retrieval table against m5/t5/report.json, retrieval.primary. Read the calibration
and null decisions from m5/synthetic/report.json. The full-subset T2 calibration is about 0.82. The 0.10
decoy-rate row failed the locked check. The 23 November result at equal cue rates is post hoc.
- Agreement and inventories. Check the medians and pass scope in audit/m2_300/agreement_pass{1,2}.json,
and the free-text scorer comparison in m5/judge/report.json. The report counts and C4 denominator come
from ddr/reports.parquet, t4/summary.json and m34/report.json. OCR rig-name counts of 1,378 out of 1,384
were independently recovered from the reference strings in ocr_qc_hub/items.parquet. Table checks
against the selected source rows passed 108 comparisons across the QA, contrast, taxonomy, EGS and T5 tables.
## Referee questions
| Question | Where the draft addresses it |
|---|---|
| Can the split establish transfer to a new field or operator? | Discussion, Scope. Held-out wells are within one field. Logs cover only 21 of 26 wellbores. |
| Do the T2 and T3 labels represent independently identified NPT? | Design and Discussion, NPT scores. The labels are computed from recorded activity codes. The rater study measures agreement with those codes and the cross-checks have limited independence. |
| Does tool-only performance show the ability to read DDR documents? | T4 Results and Discussion, question-answering scores. The query tool starts from the XML-derived reference tables. C4 evaluates the document representations. |
| Can the OCR comparison identify the effect of OCR errors on a stronger retriever or on scans? | C4 Results and Discussion, Scope. Intervals span zero, the modes score below 0.2, and the pages are born digital. No experiment isolates a specific abstention mechanism or scan degradation. |
| How far do the language-model comparisons generalize? | Baselines, T4 Results and Discussion, Scope. The full matrix is for one hosted model. Qwen is partial v1, and Sonnet and Haiku answer an auxiliary sample without enforced file isolation. |
| Does the planted result establish the share of activities with explicit cues? | Results, planted signal. The interpolation matches a score under a simulated mechanism and omits dependence among real activities. |
## Editorial verification remaining
The official ICML workshop listing confirms the Mishra title, authors and abstract. The manuscript marks the
Hussain, Bihani, Joshi, Boden, Idrus, Mbamarah, Aba Alharith and Cunedioglu descriptions as abstract-based.
The Cao dataset paper is also abstract-based, while the follow-up preprint was available. Access to EAGE
2026101276 and the pending OnePetro full-text items remains unresolved. A targeted web search surfaced related
Volve agent implementations. It leaves the planned database novelty search open before submission.
The publisher's journal guide returned HTTP 403 in this session. The general Elsevier AI policy was readable
and informed the draft declaration. The author still needs to confirm the journal-specific limits and class,
their declarations, the OCR export model and the release terms at G4.

436
paper/check_numbers.py Normal file
View File

@@ -0,0 +1,436 @@
#!/usr/bin/env python3
"""Check that every number in paper/sections/*.tex appears in the project's result registry.
python paper/check_numbers.py full report, grouped by file and line; exit 1 if anything is unmatched
python paper/check_numbers.py --summary counts per file only
Registry: every number in docs/plan.md, docs/technical_overview.md and AGENTS.md (Vietnamese formats are normalised:
0,151 -> 0.151 and 1.376 -> 1376; an ambiguous token such as 1.376 or 1,376 enters with both readings), and every
number in outputs/**/report.json, outputs/**/summary.json, outputs/m5/**/*.csv and outputs/m34/*.csv. A paper number
with d decimals matches a registry value r when |r| rounds to it at d decimals (signs are ignored, because the paper
writes differences with an explicit sign or a minus sign). A number marked as a percentage (15.1\\%, 15.1 per cent)
matches only when 100 * r rounds to it; a percentage in the docs (2,40%) enters as its fraction (0.024).
paper/number_allowlist.txt holds hand-checked derived values, one 'number # reason' per line.
Ignored in the .tex: comments, \\label, \\ref-like commands, citations, \\todo, \\includegraphics, \\input, \\url,
lengths (2pt, 0.8\\textwidth), tabular column specs, tikzpicture environments, dates (20/11/2026, 2026-11-20,
20 November 2026), version strings (3.11.2), well names (15/9-F-15) and digits glued to letters or underscores
(T4, v6, protocol_v1, hash fragments such as 3c8021f9). Standard library only.
"""
from __future__ import annotations
import argparse
import bisect
import csv
import json
import re
import sys
from dataclasses import dataclass, field
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
DOCS = ("docs/plan.md", "docs/technical_overview.md", "AGENTS.md")
JSON_GLOBS = ("outputs/**/report.json", "outputs/**/summary.json")
CSV_GLOBS = ("outputs/m5/**/*.csv", "outputs/m34/*.csv")
EPS = 1e-9
# ---------------------------------------------------------------- registry
DOC_TOKEN = re.compile(r"\d+(?:[.,]\d+)*")
def doc_readings(token):
"""All plausible values of a number written in English or Vietnamese style."""
seps = re.findall(r"[.,]", token)
groups = re.split(r"[.,]", token)
if not seps:
return {float(token)}
out = set()
if len(seps) == 1:
head, tail = groups
out.add(float(f"{head}.{tail}"))
if len(tail) == 3 and not head.startswith("0"): # 1.376 or 1,376 may be thousands
out.add(float(head + tail))
return out
if len(set(seps)) == 1:
if all(len(g) == 3 for g in groups[1:]) and not groups[0].startswith("0"):
out.add(float("".join(groups)))
else: # version-like (3.11.2): keep the components
out.update(float(g) for g in groups)
return out
last = max(token.rfind("."), token.rfind(","))
whole = re.sub(r"[.,]", "", token[:last])
out.add(float(f"{whole}.{token[last + 1:]}"))
return out
def numbers_from_text(text):
vals = set()
for m in DOC_TOKEN.finditer(text):
readings = doc_readings(m.group(0))
if DOC_PERCENT.match(text, m.end()): # 2,40% enters as the fraction 0.024 only
readings = {r / 100 for r in readings}
vals |= readings
return vals
DOC_PERCENT = re.compile(r"\s?(?:%|\\%|per ?cent\b|phần trăm)")
def numbers_from_json(obj, vals):
if isinstance(obj, bool) or obj is None:
return
if isinstance(obj, (int, float)):
if obj == obj and abs(obj) != float("inf"):
vals.add(float(obj))
elif isinstance(obj, str):
_strnum(obj, vals)
elif isinstance(obj, dict):
for k, v in obj.items():
_strnum(k, vals)
numbers_from_json(v, vals)
elif isinstance(obj, list):
for v in obj:
numbers_from_json(v, vals)
NUM_IN_CELL = re.compile(r"-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?")
def _strnum(s, vals):
if len(s) > 2000: # long free text (model answers) is not a result
return
for m in NUM_IN_CELL.finditer(s):
try:
vals.add(float(m.group(0)))
except ValueError:
pass
def numbers_from_csv(path, vals):
csv.field_size_limit(sys.maxsize)
with open(path, newline="", encoding="utf-8", errors="replace") as fh:
for row in csv.reader(fh):
for cell in row:
_strnum(cell, vals)
@dataclass
class Registry:
values: list = field(default_factory=list)
sources: dict = field(default_factory=dict)
missing: list = field(default_factory=list)
def finish(self, vals):
self.values = sorted({abs(v) for v in vals})
def contains(self, value, decimals):
"""True if some registry value rounds to |value| at the given number of decimals."""
half = 0.5 * 10 ** -decimals
lo, hi = abs(value) - half - EPS, abs(value) + half + EPS
i = bisect.bisect_left(self.values, lo)
return i < len(self.values) and self.values[i] <= hi
def build_registry(root=ROOT, docs=DOCS, json_globs=JSON_GLOBS, csv_globs=CSV_GLOBS):
reg, vals = Registry(), set()
root = Path(root)
for rel in docs:
p = root / rel
if not p.exists():
reg.missing.append(rel)
continue
found = numbers_from_text(p.read_text(encoding="utf-8", errors="replace"))
reg.sources[rel] = len(found)
vals |= found
for pattern, reader in [(g, "json") for g in json_globs] + [(g, "csv") for g in csv_globs]:
paths = sorted(root.glob(pattern))
if not paths:
reg.missing.append(pattern)
for p in paths:
found = set()
try:
if reader == "json":
numbers_from_json(json.loads(p.read_text(encoding="utf-8")), found)
else:
numbers_from_csv(p, found)
except (OSError, ValueError) as exc:
reg.missing.append(f"{p.relative_to(root)} ({exc.__class__.__name__})")
continue
reg.sources[str(p.relative_to(root))] = len(found)
vals |= found
reg.finish(vals)
return reg
# ---------------------------------------------------------------- LaTeX scanning
# command -> number of mandatory arguments to blank (optional [..] arguments before them are blanked too)
BLANK_COMMANDS = {
"label": 1, "ref": 1, "eqref": 1, "cref": 1, "Cref": 1, "autoref": 1, "pageref": 1, "nameref": 1, "vref": 1,
"cite": 1, "citep": 1, "citet": 1, "citealp": 1, "citealt": 1, "citeauthor": 1, "citeyear": 1, "citeyearpar": 1,
"parencite": 1, "textcite": 1, "nocite": 1, "todo": 1, "includegraphics": 1, "input": 1, "include": 1, "url": 1,
"href": 1, "hyperref": 0, "bibliography": 1, "bibliographystyle": 1, "usepackage": 1, "documentclass": 1,
"setcounter": 2, "addtocounter": 2, "setlength": 2, "addtolength": 2, "vspace": 1, "hspace": 1, "vskip": 0,
"linenumbers": 0, "multicolumn": 2, "multirow": 2, "cmidrule": 1, "cline": 1, "rule": 2, "resizebox": 2,
"scalebox": 1, "fontsize": 2, "color": 1, "textcolor": 1, "definecolor": 3, "colorbox": 1, "newcommand": 1,
"renewcommand": 2, "arraystretch": 0, "linespread": 1, "raisebox": 1, "makebox": 0, "parbox": 1,
"columnwidth": 0, "graphicspath": 1, "ding": 1, "cellcolor": 1, "rowcolor": 1,
}
ENV_ARGS = {"tabular": 1, "tabular*": 2, "tabularx": 2, "tabulary": 2, "longtable": 1, "array": 1, "minipage": 1,
"wrapfigure": 2, "subfigure": 1, "multicols": 1, "tblr": 1}
BLANK_ENVS = ("tikzpicture", "comment", "verbatim", "lstlisting", "filecontents")
MONTHS = ("January|February|March|April|May|June|July|August|September|October|November|December|"
"Jan|Feb|Mar|Apr|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec")
PATTERNS = [
re.compile(r"(?<!\\)%.*"), # comments
re.compile(r"\d*\.?\d+(?:pt|cm|mm|in|em|ex|bp|sp|pc)\b"), # lengths 2pt, 0.5em
re.compile(r"\d*\.?\d+\s*\\(?:textwidth|linewidth|columnwidth|textheight|baselineskip|paperwidth|hsize)"),
re.compile(r"\b\d{1,2}/\d{1,2}/(?:19|20)\d{2}\b"), # 20/11/2026
re.compile(r"\b(?:19|20)\d{2}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2})?)?\b"), # 2026-11-20
re.compile(rf"\b\d{{1,2}}(?:st|nd|rd|th)?(?:~|\s)+(?:{MONTHS})\.?(?:,?(?:~|\s)+(?:19|20)\d{{2}})?\b"),
re.compile(rf"\b(?:{MONTHS})\.?(?:~|\s)+\d{{1,2}}(?:,?(?:~|\s)+(?:19|20)\d{{2}})?\b"),
re.compile(rf"\b(?:{MONTHS})\.?(?:~|\s)+(?:19|20)\d{{2}}\b"),
re.compile(r"\b\d{1,2}:\d{2}(?::\d{2})?\s*(?:UTC|h)?\b"), # times 06:32 UTC
re.compile(r"\b\d+/\d+-(?:[A-Z]+-)?\d+(?:\s?(?:A|B|C|S|T2|BT2|SR|ST2|ST3)\b)?"), # well names 15/9-F-15 S
re.compile(r"\b\d+(?:\.\d+){2,}\b"), # versions 3.11.2
]
NUMBER = re.compile(r"(?<![\w.\\])(\d{1,3}(?:,\d{3})+(?!\d)|\d+)(\.\d+)?(?![\w])(?!\.\d)")
PERCENT_AFTER = re.compile(r"\s*(?:\\%|%|(?:~|\s)per(?:~|\s)?cent\b|(?:~|\s)percent\b)")
def _blank(chars, start, end):
for i in range(start, end):
if chars[i] != "\n":
chars[i] = " "
def _match_group(text, i, open_c, close_c):
"""Index just past the group starting at text[i] == open_c, honouring nesting and escapes."""
depth, j = 0, i
while j < len(text):
c = text[j]
if c == "\\":
j += 2
continue
if c == open_c:
depth += 1
elif c == close_c:
depth -= 1
if depth == 0:
return j + 1
j += 1
return len(text)
def _skip_args(text, j, mandatory):
"""Skip whitespace, *, [..] and (..) groups and `mandatory` {..} groups starting at j; return the new index."""
n = 0
while j < len(text):
k = j
while k < len(text) and text[k] in " \t":
k += 1
if k < len(text) and text[k] == "*":
j = k + 1
continue
if k < len(text) and text[k] == "[" and (n < mandatory or (mandatory == 0 and n == 0)):
j = _match_group(text, k, "[", "]")
n += mandatory == 0
continue
if k < len(text) and text[k] == "{" and n < mandatory:
j = _match_group(text, k, "{", "}")
n += 1
continue
break
return j
def mask_tex(text):
"""Return text of the same length with ignored material replaced by spaces (newlines kept)."""
chars = list(text)
for pat in PATTERNS[:1]:
for m in pat.finditer(text):
_blank(chars, m.start(), m.end())
text = "".join(chars)
for env in BLANK_ENVS:
for m in re.finditer(rf"\\begin\{{{re.escape(env)}\}}.*?\\end\{{{re.escape(env)}\}}", text, re.S):
_blank(chars, m.start(), m.end())
text = "".join(chars)
for m in re.finditer(r"\\begin\{([^}]+)\}", text):
env = m.group(1)
end = _skip_args(text, m.end(), ENV_ARGS.get(env, 0))
_blank(chars, m.start(), end)
for m in re.finditer(r"\\end\{[^}]+\}", text):
_blank(chars, m.start(), m.end())
text = "".join(chars)
for pat in PATTERNS[1:]: # lengths, dates, well names and versions, before control words are dropped
for m in pat.finditer(text):
_blank(chars, m.start(), m.end())
for m in re.finditer(r"\\([A-Za-z]+)", text):
name = m.group(1)
if name in BLANK_COMMANDS:
_blank(chars, m.start(), _skip_args(text, m.end(), BLANK_COMMANDS[name]))
elif chars[m.start()] == "\\": # other control words (\pm0.02, \times10): drop the name only
_blank(chars, m.start(), m.end())
return "".join(chars)
def _normalise(text):
"""Same-length rewrites: 1{,}376 and 23\\,447 become 1,376 / 23,447; \\_ becomes _ ; ~ becomes a space."""
text = re.sub(r"(\d)\{,\}(\d{3})", lambda m: m.group(1) + "," + m.group(2) + " ", text)
text = re.sub(r"(\d)\\,(\d{3})", lambda m: m.group(1) + "," + m.group(2) + " ", text)
text = re.sub(r"(\d)\{\.\}(\d)", lambda m: m.group(1) + "." + m.group(2) + " ", text)
return text.replace("\\_", "__").replace("~", " ")
TABLE = re.compile(r"\\begin\{(tabular\*?|tabularx|tabulary|longtable|tblr)\}(.*?)\\end\{\1\}", re.S)
def percent_columns(text):
"""Spans of table cells below a header cell that contains \\%, e.g. a 'CER (\\%)' column."""
spans = []
for t in TABLE.finditer(text):
cols, pos, body = set(), t.start(2), t.group(2)
for row in re.split(r"(\\\\)", body):
start, cells = pos, row.split("&")
pos += len(row)
if row == "\\\\" or not row.strip():
continue
if any("\\%" in c for c in cells):
cols = {i for i, c in enumerate(cells) if "\\%" in c}
continue
for i, c in enumerate(cells):
if i in cols:
spans.append((start, start + len(c)))
start += len(c) + 1
return spans
@dataclass
class Found:
file: str
line: int
token: str
value: float
decimals: int
percent: bool
context: str
status: str = ""
def extract_numbers(text, fname="<text>"):
masked = mask_tex(_normalise(text))
pct_cells = percent_columns(_normalise(text))
lines = text.split("\n")
starts = [0]
for ln in lines:
starts.append(starts[-1] + len(ln) + 1)
out = []
for m in NUMBER.finditer(masked):
raw = m.group(0)
int_part, frac = m.group(1), m.group(2) or ""
if "," in int_part and re.fullmatch(r"\d{1,3}(?:,\d{3})+", int_part) is None:
continue
# thousands written with spaces that _normalise turned into ', ' are not matched by NUMBER; fine
value = float(int_part.replace(",", "") + frac)
decimals = len(frac) - 1 if frac else 0
percent = bool(PERCENT_AFTER.match(masked, m.end())) or any(a <= m.start() < b for a, b in pct_cells)
line = bisect.bisect_right(starts, m.start()) - 1
src = lines[line]
col = m.start() - starts[line]
context = src[max(0, col - 50): col + len(raw) + 50].strip()
out.append(Found(fname, line + 1, raw, value, decimals, percent, context))
return out
# ---------------------------------------------------------------- allowlist and checking
def read_allowlist(path):
entries, problems = [], []
p = Path(path)
if not p.exists():
return entries, problems
for i, line in enumerate(p.read_text(encoding="utf-8").splitlines(), 1):
stripped = line.strip()
if not stripped or stripped.startswith("#"):
continue
num, _, reason = stripped.partition("#")
num, reason = num.strip(), reason.strip()
m = re.fullmatch(r"[-+−]?(\d+)(?:\.(\d+))?(\\?%)?", num.replace(",", ""))
if not m or not reason:
problems.append(f"{p.name}:{i}: expected 'number # reason', got {line!r}")
continue
entries.append((float(m.group(1) + ("." + m.group(2) if m.group(2) else "")), len(m.group(2) or "")))
return entries, problems
def classify(found, registry, allow):
if found.percent: # 15.1\% is the quantity 0.151 and nothing else
if registry.contains(found.value / 100, found.decimals + 2):
return "matched-percent"
elif registry.contains(found.value, found.decimals):
return "matched"
for value, decimals in allow:
if decimals == found.decimals and abs(value - found.value) < 0.5 * 10 ** -decimals - EPS:
return "allowlisted"
return "unmatched"
def check(tex_paths, registry, allow):
results = {}
for p in tex_paths:
p = Path(p)
items = extract_numbers(p.read_text(encoding="utf-8", errors="replace"), str(p))
for f in items:
f.status = classify(f, registry, allow)
results[str(p)] = items
return results
def report(results, registry, problems, summary, out=None):
out = out or sys.stdout
total = {"matched": 0, "matched-percent": 0, "allowlisted": 0, "unmatched": 0}
print(f"Registry: {len(registry.values)} distinct values from {len(registry.sources)} files.", file=out)
for miss in registry.missing:
print(f" warning: registry source not found: {miss}", file=out)
for prob in problems:
print(f" warning: allowlist entry ignored: {prob}", file=out)
if not results:
print("No .tex files found.", file=out)
for fname, items in results.items():
counts = {k: sum(f.status == k for f in items) for k in total}
for k in total:
total[k] += counts[k]
print(f"\n{fname}: {len(items)} numbers, {counts['matched'] + counts['matched-percent']} matched, "
f"{counts['allowlisted']} allowlisted, {counts['unmatched']} unmatched", file=out)
if summary:
continue
for f in items:
if f.status == "unmatched":
kind = " (percent)" if f.percent else ""
print(f" L{f.line}: {f.token}{kind} ... {f.context} ...", file=out)
print(f"\nTotal: {sum(total.values())} numbers, {total['matched'] + total['matched-percent']} matched, "
f"{total['allowlisted']} allowlisted, {total['unmatched']} unmatched", file=out)
return total["unmatched"]
def main(argv=None):
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
ap.add_argument("--root", type=Path, default=ROOT, help="repository root (registry sources are relative to it)")
ap.add_argument("--sections", type=Path, default=None, help="directory of .tex files (default paper/sections)")
ap.add_argument("--allowlist", type=Path, default=None, help="default paper/number_allowlist.txt")
ap.add_argument("--summary", action="store_true", help="counts per file only")
args = ap.parse_args(argv)
sections = args.sections or args.root / "paper/sections"
allowlist = args.allowlist or args.root / "paper/number_allowlist.txt"
registry = build_registry(args.root)
allow, problems = read_allowlist(allowlist)
tex = sorted(sections.glob("*.tex")) if sections.is_dir() else []
unmatched = report(check(tex, registry, allow), registry, problems, args.summary)
return 1 if unmatched else 0
if __name__ == "__main__":
sys.exit(main())

View File

@@ -0,0 +1,204 @@
# Figure provenance
Written by `scripts/22_paper_figures.py`; do not edit by hand. Every plotted value is read from the files below (sha256, first 16 hex). Checks against `docs/plan.md`: 107/107 within tolerance.
| Input | sha256 |
| --- | --- |
| `outputs/m34/report.json` | `cfa9612b5ec468dd` |
| `outputs/m5/errors/report.json` | `4e4aa52a0b52bd12` |
| `outputs/m5/synthetic/report.json` | `e2f2b70c2b5b7b77` |
| `outputs/m5/synthetic/settings_t2.csv` | `8a3e97ca68178008` |
| `outputs/m5/synthetic/settings_t3.csv` | `0a20db4f61312d51` |
## t4_modes.pdf
Source: `outputs/m34/report.json` key `qa`, model `vai-deepseek-v4-1-flash`, subset `well`, average `macro_families`, metric `correct`; one point and 95% well-cluster bootstrap CI per repetition (0, 1, 2); black tick = mean of the three estimates.
| Mode | n | Rep 0 | Rep 1 | Rep 2 | Mean |
| --- | ---: | ---: | ---: | ---: | ---: |
| Zero-shot | 1652 | 0.076 (0.036-0.123) | 0.066 (0.023-0.114) | 0.070 (0.024-0.130) | 0.071 |
| Few-shot | 1652 | 0.144 (0.092-0.206) | 0.154 (0.111-0.199) | 0.154 (0.106-0.206) | 0.151 |
| RAG (XML) | 1652 | 0.145 (0.108-0.188) | 0.151 (0.108-0.199) | 0.148 (0.109-0.194) | 0.148 |
| C4 XML | 1366 | 0.153 (0.067-0.248) | 0.154 (0.066-0.254) | 0.145 (0.065-0.240) | 0.151 |
| C4 HTML | 1366 | 0.176 (0.075-0.258) | 0.187 (0.095-0.256) | 0.169 (0.074-0.239) | 0.177 |
| C4 OCR | 1366 | 0.176 (0.085-0.261) | 0.182 (0.095-0.260) | 0.184 (0.087-0.266) | 0.181 |
| Tool-only | 1652 | 0.722 (0.705-0.759) | 0.704 (0.689-0.736) | 0.709 (0.675-0.747) | 0.712 |
| Agent | 1652 | 0.606 (0.564-0.679) | 0.629 (0.604-0.668) | 0.620 (0.553-0.705) | 0.618 |
## taxonomy.pdf
Source: `outputs/m5/errors/report.json` key `taxonomy_macro`, model `vai-deepseek-v4-1-flash`, family `macro` (macro over question families, mean of 3 repetitions, protocol v4 classes). The last segment merges `no_citation` and `answered_unanswerable`.
| Mode | n | Correct | Abstention | Wrong wellbore | Wrong report cited | Right report, wrong value | Call failure | No citation or answered unanswerable |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| Zero-shot | 1652 | 0.071 | 0.891 | 0.026 | 0.012 | 0.000 | 0.000 | 0.000 |
| Few-shot | 1652 | 0.151 | 0.739 | 0.079 | 0.009 | 0.000 | 0.000 | 0.022 |
| RAG (XML) | 1652 | 0.148 | 0.638 | 0.110 | 0.030 | 0.066 | 0.000 | 0.008 |
| C4 XML | 1366 | 0.151 | 0.678 | 0.095 | 0.026 | 0.047 | 0.000 | 0.002 |
| C4 HTML | 1366 | 0.177 | 0.535 | 0.190 | 0.025 | 0.072 | 0.000 | 0.001 |
| C4 OCR | 1366 | 0.181 | 0.580 | 0.137 | 0.026 | 0.074 | 0.000 | 0.003 |
| Tool-only | 1652 | 0.712 | 0.083 | 0.049 | 0.008 | 0.144 | 0.004 | 0.000 |
| Agent | 1652 | 0.618 | 0.129 | 0.026 | 0.014 | 0.146 | 0.064 | 0.003 |
## leakage.pdf
Source: `outputs/m34/report.json` keys `classification` (AP, `definition` b, `split` well, `modality` xml, `subset` all) and `classification_contrasts` (`unmasked_minus_masked`, subset all, paired 95% well-cluster bootstrap CI). Bars: TF-IDF single run, DistilBERT mean of seeds 0-2.
| Task | Method | Masked AP (CI) | Unmasked AP (CI) | Unmasked - masked (CI) |
| --- | --- | --- | --- | --- |
| T2(b) | TF-IDF | 0.463 (0.418 to 0.513) | 0.995 (0.991 to 0.999) | 0.531 (0.480 to 0.580) |
| T2(b) | DistilBERT | 0.579 (0.554 to 0.630); 0.596 (0.575 to 0.628); 0.603 (0.591 to 0.634) | 0.870 (0.834 to 0.904); 0.880 (0.839 to 0.907); 0.869 (0.826 to 0.902) | 0.291 (0.214 to 0.341); 0.283 (0.222 to 0.318); 0.266 (0.198 to 0.305) |
| T3(b) | TF-IDF | 0.1225 (0.0934 to 0.1953) | 0.1273 (0.0942 to 0.2031) | 0.0048 (-0.0005 to 0.0238) |
| T3(b) | DistilBERT | 0.1216 (0.0976 to 0.1692); 0.1175 (0.1023 to 0.1692); 0.1245 (0.0934 to 0.1648) | 0.1206 (0.0968 to 0.1563); 0.1189 (0.0979 to 0.1788); 0.1312 (0.0964 to 0.1807) | -0.0011 (-0.0240 to 0.0068); 0.0014 (-0.0204 to 0.0323); 0.0066 (-0.0135 to 0.0305) |
Reference lines (masked, by well, subset all): T2(b) majority 0.1828, lexicon 0.2511; T3(b) majority 0.1136.
**Discrepancy with plan Sec. 1.6 (final paragraph).** The values stated there equal the mean over the subsets `all` and `without_sidetrack` (and over XML and OCR for TF-IDF), not the primary subset `all`. The figure plots `all` (XML), the subset behind the earlier TF-IDF statement in plan Sec. 1.6, the DistilBERT deltas in Sec. 1.7 and the protocol v6 reference AP (`references.t2.source`).
| Mode / split / method | Plan value | Pooled mean (= plan) | Primary `all`, XML | Rows pooled |
| --- | ---: | ---: | ---: | ---: |
| masked/well/majority | 0.179 | 0.1792 | 0.1828 | 2 |
| masked/well/lexicon | 0.249 | 0.2493 | 0.2511 | 2 |
| masked/well/tfidf_logistic | 0.461 | 0.4606 | 0.4635 | 4 |
| masked/well/distilbert | 0.597 | 0.5974 | 0.5929 | 6 |
| masked/well/vai_deepseek_zero_shot | 0.405 | 0.4052 | 0.4074 | 6 |
| masked/well/qwen_zero_shot | 0.261 | 0.2608 | 0.2638 | 2 |
| masked/wellbore/distilbert | 0.619 | 0.6186 | 0.6183 | 6 |
| masked/wellbore/tfidf_logistic | 0.484 | 0.4844 | 0.4894 | 2 |
| unmasked/well/tfidf_logistic | 0.994 | 0.9945 | 0.9947 | 2 |
| unmasked/well/distilbert | 0.869 | 0.8690 | 0.8729 | 6 |
## planted.pdf
Sources: `outputs/m5/synthetic/settings_t2.csv` (rows f = 0.02; f = 0.10 is not drawn because its protocol v6 null check failed), `outputs/m5/synthetic/settings_t3.csv`, and `outputs/m5/synthetic/report.json` (`design.t2_pi`, `design.t3_pi`, `references.t2.ap`, `references.t3.ap`, `t2_cues.effective_cue_rate.reference_report`, `t3_hazard.effective_strength.reference_report`). Lines: mean over 5 seeds; bands: seed min-max.
| c | mean AP | min | max |
| ---: | ---: | ---: | ---: |
| 0 | 0.1821 | 0.1769 | 0.1884 |
| 0.1 | 0.2007 | 0.1952 | 0.2070 |
| 0.25 | 0.2581 | 0.2498 | 0.2657 |
| 0.5 | 0.3625 | 0.3584 | 0.3662 |
| 0.75 | 0.4395 | 0.4313 | 0.4527 |
| 1 | 0.5215 | 0.5163 | 0.5306 |
| s | depth AP mean | min | max | oracle AP mean | min | max |
| ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| 0 | 0.1177 | 0.1097 | 0.1247 | 0.1154 | 0.1107 | 0.1199 |
| 0.25 | 0.1185 | 0.1101 | 0.1270 | 0.1390 | 0.1316 | 0.1467 |
| 0.5 | 0.1306 | 0.1182 | 0.1427 | 0.1763 | 0.1612 | 0.1882 |
| 1 | 0.1909 | 0.1759 | 0.2058 | 0.2830 | 0.2526 | 0.3020 |
| 2 | 0.3794 | 0.3453 | 0.3987 | 0.4894 | 0.4832 | 0.4958 |
T2: prevalence 0.183, real masked TF-IDF AP 0.4635, effective cue fraction 0.823 (seed range 0.785 to 0.840). T3: prevalence 0.1136, real depth-forecast AP 0.1495, effective strength 0.657 (seed range 0.554 to 0.716).
## Checks against docs/plan.md
| Quantity | File | Plan | Tolerance | OK |
| --- | ---: | ---: | ---: | --- |
| T4 zero_shot/xml mean of 3 reps | 0.0710 | 0.071 | 0.002 | yes |
| T4 few_shot/xml mean of 3 reps | 0.1506 | 0.151 | 0.002 | yes |
| T4 rag/xml mean of 3 reps | 0.1479 | 0.148 | 0.002 | yes |
| T4 c4/xml mean of 3 reps | 0.1510 | 0.151 | 0.002 | yes |
| T4 c4/html mean of 3 reps | 0.1773 | 0.177 | 0.002 | yes |
| T4 c4/ocr mean of 3 reps | 0.1807 | 0.181 | 0.002 | yes |
| T4 tool_only/xml mean of 3 reps | 0.7118 | 0.712 | 0.002 | yes |
| T4 agent/xml mean of 3 reps | 0.6183 | 0.618 | 0.002 | yes |
| taxonomy zero_shot/xml correct | 0.0710 | 0.071 | 0.002 | yes |
| taxonomy zero_shot/xml abstained | 0.8910 | 0.891 | 0.002 | yes |
| taxonomy zero_shot/xml wrong_wellbore | 0.0261 | 0.026 | 0.002 | yes |
| taxonomy zero_shot/xml evidence_missed | 0.0119 | 0.012 | 0.002 | yes |
| taxonomy zero_shot/xml wrong_with_evidence | 0.0000 | 0 | 0.002 | yes |
| taxonomy zero_shot/xml failed | 0.0000 | 0 | 0.002 | yes |
| taxonomy few_shot/xml correct | 0.1506 | 0.151 | 0.002 | yes |
| taxonomy few_shot/xml abstained | 0.7395 | 0.739 | 0.002 | yes |
| taxonomy few_shot/xml wrong_wellbore | 0.0790 | 0.079 | 0.002 | yes |
| taxonomy few_shot/xml evidence_missed | 0.0093 | 0.009 | 0.002 | yes |
| taxonomy few_shot/xml wrong_with_evidence | 0.0000 | 0 | 0.002 | yes |
| taxonomy few_shot/xml failed | 0.0000 | 0 | 0.002 | yes |
| taxonomy rag/xml correct | 0.1479 | 0.148 | 0.002 | yes |
| taxonomy rag/xml abstained | 0.6384 | 0.638 | 0.002 | yes |
| taxonomy rag/xml wrong_wellbore | 0.1100 | 0.11 | 0.002 | yes |
| taxonomy rag/xml evidence_missed | 0.0300 | 0.03 | 0.002 | yes |
| taxonomy rag/xml wrong_with_evidence | 0.0656 | 0.066 | 0.002 | yes |
| taxonomy rag/xml failed | 0.0000 | 0 | 0.002 | yes |
| taxonomy c4/xml correct | 0.1510 | 0.151 | 0.002 | yes |
| taxonomy c4/xml abstained | 0.6782 | 0.678 | 0.002 | yes |
| taxonomy c4/xml wrong_wellbore | 0.0954 | 0.095 | 0.002 | yes |
| taxonomy c4/xml evidence_missed | 0.0259 | 0.026 | 0.002 | yes |
| taxonomy c4/xml wrong_with_evidence | 0.0475 | 0.047 | 0.002 | yes |
| taxonomy c4/xml failed | 0.0000 | 0 | 0.002 | yes |
| taxonomy c4/html correct | 0.1773 | 0.177 | 0.002 | yes |
| taxonomy c4/html abstained | 0.5346 | 0.535 | 0.002 | yes |
| taxonomy c4/html wrong_wellbore | 0.1898 | 0.19 | 0.002 | yes |
| taxonomy c4/html evidence_missed | 0.0253 | 0.025 | 0.002 | yes |
| taxonomy c4/html wrong_with_evidence | 0.0717 | 0.072 | 0.002 | yes |
| taxonomy c4/html failed | 0.0000 | 0 | 0.002 | yes |
| taxonomy c4/ocr correct | 0.1807 | 0.181 | 0.002 | yes |
| taxonomy c4/ocr abstained | 0.5805 | 0.58 | 0.002 | yes |
| taxonomy c4/ocr wrong_wellbore | 0.1367 | 0.137 | 0.002 | yes |
| taxonomy c4/ocr evidence_missed | 0.0257 | 0.026 | 0.002 | yes |
| taxonomy c4/ocr wrong_with_evidence | 0.0738 | 0.074 | 0.002 | yes |
| taxonomy c4/ocr failed | 0.0000 | 0 | 0.002 | yes |
| taxonomy tool_only/xml correct | 0.7118 | 0.712 | 0.002 | yes |
| taxonomy tool_only/xml abstained | 0.0827 | 0.083 | 0.002 | yes |
| taxonomy tool_only/xml wrong_wellbore | 0.0493 | 0.049 | 0.002 | yes |
| taxonomy tool_only/xml evidence_missed | 0.0082 | 0.008 | 0.002 | yes |
| taxonomy tool_only/xml wrong_with_evidence | 0.1445 | 0.144 | 0.002 | yes |
| taxonomy tool_only/xml failed | 0.0035 | 0.004 | 0.002 | yes |
| taxonomy agent/xml correct | 0.6183 | 0.618 | 0.002 | yes |
| taxonomy agent/xml abstained | 0.1285 | 0.129 | 0.002 | yes |
| taxonomy agent/xml wrong_wellbore | 0.0264 | 0.026 | 0.002 | yes |
| taxonomy agent/xml evidence_missed | 0.0136 | 0.014 | 0.002 | yes |
| taxonomy agent/xml wrong_with_evidence | 0.1464 | 0.146 | 0.002 | yes |
| taxonomy agent/xml failed | 0.0637 | 0.064 | 0.002 | yes |
| T2(b) TF-IDF masked AP | 0.4635 | 0.463 | 0.002 | yes |
| T2(b) TF-IDF unmasked AP | 0.9947 | 0.995 | 0.002 | yes |
| T2(b) TF-IDF unmasked-masked | 0.5313 | 0.531 | 0.002 | yes |
| T2(b) DistilBERT masked AP seed 0 | 0.5791 | 0.579 | 0.002 | yes |
| T2(b) DistilBERT masked AP seed 1 | 0.5964 | 0.596 | 0.002 | yes |
| T2(b) DistilBERT masked AP seed 2 | 0.6030 | 0.603 | 0.002 | yes |
| T2(b) DistilBERT unmasked-masked seed 0 | 0.2908 | 0.291 | 0.002 | yes |
| T2(b) DistilBERT unmasked-masked seed 1 | 0.2833 | 0.283 | 0.002 | yes |
| T2(b) DistilBERT unmasked-masked seed 2 | 0.2660 | 0.266 | 0.002 | yes |
| T2(b) majority masked AP (= prevalence) | 0.1828 | 0.183 | 0.002 | yes |
| T3(b) TF-IDF masked AP | 0.1225 | 0.1225 | 0.0002 | yes |
| T3(b) TF-IDF unmasked AP | 0.1273 | 0.1273 | 0.0002 | yes |
| T3(b) TF-IDF unmasked-masked | 0.0048 | 0.0048 | 0.0002 | yes |
| T3(b) DistilBERT masked AP mean | 0.1212 | 0.121 | 0.002 | yes |
| T3(b) majority AP (= prevalence) | 0.1136 | 0.114 | 0.002 | yes |
| plan pooled T2(b) masked/well/majority | 0.1792 | 0.179 | 0.002 | yes |
| plan pooled T2(b) masked/well/lexicon | 0.2493 | 0.249 | 0.002 | yes |
| plan pooled T2(b) masked/well/tfidf_logistic | 0.4606 | 0.461 | 0.002 | yes |
| plan pooled T2(b) masked/well/distilbert | 0.5974 | 0.597 | 0.002 | yes |
| plan pooled T2(b) masked/well/vai_deepseek_zero_shot | 0.4052 | 0.405 | 0.002 | yes |
| plan pooled T2(b) masked/well/qwen_zero_shot | 0.2608 | 0.261 | 0.002 | yes |
| plan pooled T2(b) masked/wellbore/distilbert | 0.6186 | 0.619 | 0.002 | yes |
| plan pooled T2(b) masked/wellbore/tfidf_logistic | 0.4844 | 0.484 | 0.002 | yes |
| plan pooled T2(b) unmasked/well/tfidf_logistic | 0.9945 | 0.994 | 0.002 | yes |
| plan pooled T2(b) unmasked/well/distilbert | 0.8690 | 0.869 | 0.002 | yes |
| planted T2 f=0.02 c=0.0 mean AP | 0.1821 | 0.182 | 0.002 | yes |
| planted T2 f=0.02 c=0.1 mean AP | 0.2007 | 0.201 | 0.002 | yes |
| planted T2 f=0.02 c=0.25 mean AP | 0.2581 | 0.258 | 0.002 | yes |
| planted T2 f=0.02 c=0.5 mean AP | 0.3625 | 0.363 | 0.002 | yes |
| planted T2 f=0.02 c=0.75 mean AP | 0.4395 | 0.44 | 0.002 | yes |
| planted T2 f=0.02 c=1.0 mean AP | 0.5215 | 0.521 | 0.002 | yes |
| planted T3 s=0.0 mean AP | 0.1177 | 0.118 | 0.002 | yes |
| planted T3 s=0.0 oracle AP | 0.1154 | 0.115 | 0.002 | yes |
| planted T3 s=0.25 mean AP | 0.1185 | 0.119 | 0.002 | yes |
| planted T3 s=0.25 oracle AP | 0.1390 | 0.139 | 0.002 | yes |
| planted T3 s=0.5 mean AP | 0.1306 | 0.131 | 0.002 | yes |
| planted T3 s=0.5 oracle AP | 0.1763 | 0.176 | 0.002 | yes |
| planted T3 s=1.0 mean AP | 0.1909 | 0.191 | 0.002 | yes |
| planted T3 s=1.0 oracle AP | 0.2830 | 0.283 | 0.002 | yes |
| planted T3 s=2.0 mean AP | 0.3794 | 0.379 | 0.002 | yes |
| planted T3 s=2.0 oracle AP | 0.4894 | 0.489 | 0.002 | yes |
| planted t2_pi | 0.1830 | 0.183 | 0.002 | yes |
| planted t2_real | 0.4635 | 0.463 | 0.002 | yes |
| planted c_eff | 0.8230 | 0.82 | 0.005 | yes |
| planted c_lo | 0.7846 | 0.78 | 0.005 | yes |
| planted c_hi | 0.8401 | 0.84 | 0.005 | yes |
| planted t3_pi | 0.1136 | 0.114 | 0.002 | yes |
| planted t3_real | 0.1495 | 0.15 | 0.002 | yes |
| planted s_eff | 0.6567 | 0.66 | 0.005 | yes |
| planted s_lo | 0.5541 | 0.55 | 0.005 | yes |
| planted s_hi | 0.7163 | 0.72 | 0.005 | yes |

BIN
paper/figures/leakage.pdf Normal file

Binary file not shown.

BIN
paper/figures/planted.pdf Normal file

Binary file not shown.

BIN
paper/figures/t4_modes.pdf Normal file

Binary file not shown.

BIN
paper/figures/taxonomy.pdf Normal file

Binary file not shown.

82
paper/main.tex Normal file
View File

@@ -0,0 +1,82 @@
% Volve-DIA manuscript. Target: Geoenergy Science and Engineering (Elsevier); the class elsarticle is not installed here,
% so the draft uses article + natbib (author-year), as paper_gp/ does in ML-Porosity. Swap the class at submission.
% Build: pdflatex main && bibtex main && pdflatex main && pdflatex main
% Every number in sections/ must be traceable to docs/plan.md or outputs/ (see README.md and check_numbers.py).
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\IfFileExists{lmodern.sty}{\usepackage{lmodern}}{}
\usepackage[margin=2.5cm]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{array}
\usepackage{xcolor}
\usepackage{url}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,fit,shapes.geometric}
\usepackage[authoryear,round]{natbib}
\usepackage{setspace}
\onehalfspacing
\usepackage{lineno}
\linenumbers
\usepackage[hidelinks]{hyperref}
\graphicspath{{figures/}}
\newcommand{\todo}[1]{\textcolor{red}{[TODO: #1]}}
\newcommand{\VolveDIA}{Volve-DIA}
\title{Volve-DIA: A leakage-controlled benchmark for daily drilling reports and real-time drilling data}
\author{\todo{author name, affiliation and corresponding address}}
\date{}
\begin{document}
\maketitle
\input{sections/00_abstract}
\noindent\textbf{Keywords:} daily drilling report; non-productive time; WITSML; Volve; label leakage; benchmark; large language models; optical character recognition
\input{sections/01_introduction}
\input{sections/02_related}
\input{sections/03_data}
\input{sections/04_design}
\input{sections/05_baselines}
\input{sections/06_results}
\input{sections/07_discussion}
\input{sections/08_conclusion}
\section*{Data and code availability}
Equinor provides the source Volve data through its \href{https://www.equinor.com/energy/volve-data-sharing}{Volve data-sharing page}.
The project code is in the \href{https://gitea.vts-ai.space/lamlvh/Volve-DIA}{Volve-DIA repository}.
\todo{Confirm the terms for releasing derived labels, OCR text and benchmark artifacts at gate G4. Add the archive identifier once assigned.}
\section*{CRediT authorship contribution statement}
\todo{Author to confirm contribution roles.}
\section*{Funding}
\todo{Author to confirm funding and funder role.}
\section*{Declaration of competing interest}
\todo{Author to complete.}
\section*{Acknowledgments}
We thank Equinor and the former Volve license partners for releasing the Volve data.
\todo{Confirm whether to acknowledge the contributor who ran the OCR export.}
\section*{Declaration of generative AI and AI-assisted technologies in the manuscript preparation process}
Claude Code (Anthropic) and Codex (OpenAI) assisted with drafting and reviewing the code and manuscript.
The methods describe the separate experimental use of language models as baselines, raters and judges.
\todo{Author to verify this disclosure, review and edit the manuscript, and confirm responsibility for the submitted text.}
\bibliographystyle{plainnat}
\bibliography{refs}
\appendix
\input{sections/A_record}
\input{sections/B_labels}
\end{document}

View File

@@ -0,0 +1,2 @@
1378 # derived: items with AE in the reference whose text is the rig name, outputs/ocr_qc_hub/items.parquet (provenance/06a.md)
42000 # AGENTS.md states about 42k characters per Read call (plan.md Sec. 12 item 32 gives about 42 nghin)

74
paper/provenance/01_02.md Normal file
View File

@@ -0,0 +1,74 @@
# Provenance: sections 01_introduction.tex and 02_related.tex
Sources: `docs/plan.md` (section numbers given), `outputs/` files, `docs/literature_notes.md` (LN) for literature
facts that `plan.md` does not repeat. "Derived" marks a value computed from listed source values.
## Introduction (01_introduction.tex)
| Claim | Value | Source |
| --- | --- | --- |
| DDR reports, wellbores, wells | 1,759; 26; 11 | plan §1.2; AGENTS Status |
| Activities | 23,447 | plan §1.2 |
| Wellbores with WITSML time logs; reports covered | 21; 1,384 | plan §1.1 |
| NPT (b) activities and share | 4,286 (18.3%) | plan §1.2 |
| PetroAgents leaked-code ablation | 0.355 to 0.431 on 30 examples | plan §2.2, §9; LN §2.1 |
| PetroAgents sample size per seed | 60 examples | plan §2.2 |
| Tight well / HPHT render bug | "Y" in all 1,759 HTML; 0 (N) in XML | plan §1.3 |
| OCR against HTML for all reports with complete OCR | CER 2.40%, WER 5.56% | outputs/ocr_qc_hub/summary.json (1,752 reports) |
| T4 questions and templates; three-way answer agreement | 1,662; 39; 100% | plan §1, §6 (M1); AGENTS Status |
| M2 raters, items | 3 LLM raters, 300 masked activities | plan §1.5 |
| Rater median weighted kappa NPT (b) | 0.283 (both passes) | plan §1.5 table |
| kappa threshold; classes qualified | 0.60; 0 | plan §6 (G1) |
| DrillScribe episode keys | 1,758/1,758 | plan §1.5 cross-checks |
| Judge kappa (Sonnet vs automatic score) | 0.98 | plan §1.7 (G3) |
| T4 main scope, C4 pairs and well-scoped C4 pairs | 1,652; 1,376 and 1,366; 1,293 and 1,284 without date flags | outputs/m34/qa.csv and report.json |
| DeepSeek T4 macro-family accuracy | tool_only 0.712, agent 0.618, RAG 0.148, zero-shot 0.071 | plan §1.6/§1.7 G2 table; outputs/m34/report.json |
| agent minus RAG (per repetition) | +0.461 to +0.479 | plan §1.7 (values +0.461/+0.479/+0.471) |
| agent minus tool_only (per repetition) | -0.075 to -0.116 | plan §1.7 (-0.116/-0.075/-0.089) |
| Abstention share, text retrieval | 0.535 to 0.678 | plan §1.7 error taxonomy (C4 HTML 0.535 ... C4 XML 0.678; RAG 0.638, OCR 0.580 inside range; zero-shot 0.891 excluded because it is not retrieval) |
| Wrong-wellbore rate text modes; tool modes | 0.198 to 0.381; about 0.05 | plan §1.7 (C4 XML 0.198, HTML 0.381, OCR 0.361, RAG 0.299; tool_only 0.050, agent 0.046) |
| OCR minus XML (per repetition), CI includes 0 | +0.023 to +0.038 | plan §1.7 (+0.023/+0.028/+0.038) |
| Code leakage T2 (b), TF-IDF | +0.531 | plan §1.6, §1.7 (CI 0.480-0.580) |
| Code leakage T2 (b), DistilBERT | +0.266 to +0.291 | plan §1.7 (+0.291/+0.283/+0.266) |
| Code leakage T3 about 0 | DistilBERT -0.001/+0.001/+0.007; TF-IDF +0.0048 | plan §1.7 |
| Masked T2 (b) AP DistilBERT by well, seeds | 0.579 to 0.603 | plan §1.6; outputs/m34/classification.csv (0.5790/0.5964/0.6030) |
| Masked T2 (b) AP TF-IDF by well | 0.463 | plan §1.6, §1.9; classification.csv 0.4634 |
| T2 prevalence | 0.183 | plan §1.9 (pi in planted study); derived 4,286/23,447 = 0.1828 |
| DeepSeek minus TF-IDF on T2 (b) | -0.055 to -0.058, CI includes 0 | plan §1.7 (-0.055/-0.058/-0.055) |
| Planted signal: cue fraction among simulated positives | about 82% (0.78–0.84 across seeds) | outputs/m5/synthetic/report.json, t2_cues.effective_cue_rate |
| Planted null failure setting | f = 0.10 (off by 0.0101) | plan §1.9 |
| T1 section rater agreement, published vs filled days | 0.707; 0.059 | plan §1.5 table (pass one) |
## Related work (02_related.tex)
| Claim | Value | Source |
| --- | --- | --- |
| TADI: tables, tools, question taxonomy | 12 DuckDB tables, 12 tools, 130 questions | plan §2.2; LN §2.2 |
| TADI: no quantitative result; EGS not computed | - | plan §2.2 |
| PetroAgents: tasks specified | 6 | plan §2.2 |
| PetroAgents: well-day examples, classes | 1,750; 7 | plan §2.2 |
| PetroAgents: per-seed sample | 60 | plan §2.2 |
| PetroAgents: split by wellbore, F-11 sub-wellbores separate | - | plan §2.2; LN §2.1 |
| PetroAgents macro-F1 | 0.464 (all), 0.442 (WITSML subset) | plan §2.2 |
| PetroAgents multi-agent gain | +0.048 (p = 0.22) | plan §2.2 |
| PetroAgents code ablation | 0.355 to 0.431 on 30 examples | plan §2.2 |
| Hussain and Reddy: DDRs | 1,266 (abstract only) | plan §2.2; LN §3 |
| Bihani et al.: DDRs; five knowledge organizations | 1,681; 5 (abstract only) | plan §2.2; LN §3 (the "five" is LN only) |
| Boden et al.: users | 75 (abstract only) | plan §2.2; LN §2.8 |
| DrillScribe text-only F1 | 0.866 | plan §2.2 |
| DrillScribe episode keys reproduced | 1,758 of 23,447 activities | plan §1.5 |
| Anatoly5ms interval size | 10 m | plan §1.5, §2.2 |
| Anatoly5ms post-event contamination | 53% to 4% (rate, not a score) | plan §9; LN §2.7 |
| Anatoly5ms text rules on T3 cells | 219 of 4,894; 72 of 478 (Jaccard 0.115); 83 of 556 (Jaccard 0.120) | plan §1.5 |
| Anatoly5ms rule groups | 4 | plan §1.5 |
| TSPP: stuck events; no label column; no licence | 3 | LN §2.5, §3 |
| TSPP: time-ordered split within a series; two case studies | - | LN §2.5 (0.7:0.1:0.2 split not quoted in text) |
| TSPP DDR rows in windows; stuck codes | 9, 14, 15; 0 | plan §1.5 |
| Mbamarah: wells, F1 | F-10 train, F-9 test; 0.436 (abstract only) | plan §2.2 |
| IPTC-25191: F1; validation; wells | 0.993; leave one well out; 4 wells (abstract only) | plan §9 (F1, LOWO); LN §3 ("4 wells" is LN only) |
| Bassey: events, production wells | 236; 6 | plan §2.2 |
| Planted / design facts cited by reference only | - | no number |
## Numbers not in plan.md (taken from literature_notes.md only)
- "five ways of organizing the knowledge" (Bihani et al.), "4 wells" (IPTC-25191-MS table row). Both are abstract-level facts in LN §3.

View File

@@ -0,0 +1,49 @@
# Provenance: Sections 3-5 and Appendices A-B
| Claim | Value | Source |
|---|---|---|
| DDR reports, wellbores, wells, activities | 1,759; 26; 11; 23,447 | `AGENTS.md` Status; `volve_dia` `EXPECTED`; `outputs/labels/summary.json` |
| Wellbores per well | 15/9-19 and F-15: 5; F-1 and F-11: 4; F-9: 2; six wells 1 | `docs/plan.md` §1 (line on well grouping) |
| Shared report dates; sibling vs other-well comment repeats | 16; 0.30% vs 0.96% | `docs/plan.md` §1 |
| WITSML coverage | 21 wellbores, 1,384 reports; name mismatches (F-15 S, two more) | `AGENTS.md` Status; `scripts/06_parse_witsml.py` `EXPECTED` |
| Suspect WITSML values missing at feature stage | -999, -99999, 99999, 9999, abs >= 1e15 | `configs/protocol_v1.yaml` `witsml_features`; plan §12 item 21 |
| Formation picks | 409; 24 wellbores own, 2 shared | `AGENTS.md` Status |
| OCR hub matching | 3,059/3,066 pages; 1,752/1,759 reports; 7 unmatched; 16 date disagreements | `AGENTS.md` Status; `scripts/04_ocr_hub.py` |
| Full-corpus OCR QC | CER 2.40%, WER 5.56%, exact 0.9181; depth exact 0.9241; rig exact 0.3385 | `docs/plan.md` §1 (OCR QC); `outputs/ocr_qc/by_field.csv` |
| Placeholder report | 15_9_19_A_1980_01_01; spud 25/7/1997 | `docs/plan.md` §1; `configs/labels.yaml` reports |
| diaHole missing including placeholder; with drilling activity | 990; 260 | `outputs/ddr/reports.parquet`, `docs/plan.md` §1 |
| T1 drilling days | 932 (672 published, 260 filled), 818 other days | `outputs/labels/summary.json` t1.scope, filled_by |
| T1 fill rule recovery | ffill 1.0000 tail, 0.9051 single; text 7/8, bit 23/30; leading 17 | `configs/labels.yaml` fill; `outputs/labels/summary.json` |
| T1 sections after fill (drilling days) | 8.5 in 404, 12.25 196, 17.5 151, 26 93, 36 57, 6 27, 9.875 4 | `outputs/labels/summary.json` t1.section.drilling_day |
| NPT (a) | 3,577 rows, 15.3%, 8,343 h, 21.2% of hours | `outputs/labels/summary.json` t2.npt_a |
| NPT (b) | 4,286 rows, 18.3%, 9,626 h, 24.4%; 709 not in (a) | `outputs/labels/summary.json` t2.npt_b |
| Cause groups (a)/(b) | Table tab:causes | `outputs/labels/summary.json` counts.t2_cause_a/b |
| Code/detail cause conflicts | 192 rows | `configs/labels.yaml` comments (precedence) |
| Operation classes | 15 classes, counts in App. B (sum 23,447) | `outputs/labels/summary.json` t1.op_class |
| T3 locatable NPT | 50.3% rows, 44.6% hours; depth 0: 9,116; above mud line 2,923 | `docs/plan.md` line on T3 (§1) |
| T3 grid | 8,757 cells; 844 (a) / 979 (b) positive; 191 inherited | `docs/plan.md` §1 |
| T3 own-hole universe | 4,894 cells; 556 (b), 478 (a) positive | `configs/protocol_v6.yaml`; `docs/plan.md` §1.5 |
| T4 | 1,662 questions (1,638/24), 39 templates, 3,915 candidates, 371 dropped (311 ambiguous) | `outputs/t4/summary.json` |
| T4 families (templates/questions) | lookup 16/825, aggregation 9/513, temporal 6/134, comparison 3/102, multi-hop 5/88 | `outputs/t4/summary.json` |
| T4 scope | 1,560 single, 92 pair, 10 field; median 3 evidence rows, max 488 | `outputs/t4/summary.json` |
| T4 tolerances | depth 1.0 m, density 0.01, inclination 0.1, hours 0.25, ROP 2%, size 0.01 in | `configs/t4_templates.yaml` |
| C4 questions | 1,376; 1,293 without date pages | `configs/protocol_v2.yaml` unchanged_from_v1 |
| T5 items | 410 (b), 373 (a); 19 wellbores, 10 wells; gain 0-3 | `configs/protocol_v5.yaml`; `AGENTS.md` Status |
| M2 rater sample | 300 activities (105/45/150, 225 strata), 90 T1 days (45/45); 1,170 ratings per pass | `configs/m2_validation.yaml`; `AGENTS.md` |
| G1 class rule | kappa >= 0.6, >= 20 items, >= 3 wells x 5 items; NPT margin 0.02, observed 0.025 | `configs/protocol_v1.yaml`; plan §12 item 24 |
| Judge (v3) | 100 answers; Sonnet primary, Haiku sensitivity; threshold 0.6 | `configs/protocol_v3.yaml` |
| Bootstrap | 2,000 resamples, 95%, seed 20261117 | `configs/protocol_v2.yaml` unchanged_from_v1 |
| Dev wells | 15/9-F-7, 15/9-F-9 | `configs/protocol_v2.yaml` session_sample |
| TF-IDF settings | C in {0.25, 1, 4}, min_df 2, 24 h history, thresholds 0.1-0.5, 10 WITSML channels | `configs/m34_baselines.yaml` |
| DistilBERT settings | 2 epochs, lr 2e-5, batch 32, 192 tokens, 3 seeds | `configs/m34_baselines.yaml` |
| QA settings | temperature 0.2, 320 tokens, 12,000 chars, 8 passages, 3 tool calls, 2 examples | `configs/m34_baselines.yaml`; `configs/protocol_v2.yaml` |
| DeepSeek full matrix | T4/C4 48,951, T2 70,341, 3 repetitions | `AGENTS.md` Status |
| Qwen partial v1 | T4/C4 10,214/16,317; agent 545/1,662; T2 seed 0 23,447, seed 1 17,827 | `configs/protocol_v2.yaml` deviation; `AGENTS.md` |
| Session sample | 300 T4 x 5 conditions, 500 T2, seed 20261117; batches 15/50 (planned 30/100); ~42,000 chars | `configs/protocol_v2.yaml`; `AGENTS.md` |
| EGS adaptation | (has_measurement + has_ddr_quote + 0)/3 | `configs/protocol_v4.yaml` egs |
| T5 representations, RRF k | random, depth, witsml_pre, text_pre, text_event, rrf; 1/(60 + rank) | `configs/protocol_v5.yaml` |
| Planted null failure | T2 f = 0.10, off by 0.0101 vs 0.01; diagnosis 23/11 post hoc | `AGENTS.md` Status; `docs/plan.md` §1.9 |
| Protocol hash prefixes | v1 fb11c6074b27 ... v6 0376aa18ea7a | `configs/protocol_v*.yaml.sha256` |
| v1 lock time | 2026-11-18T04:09 UTC | `configs/protocol_v1.yaml` locked_at_utc |
| Incidents | AP weight order, field pairing, runlog test 140+1 -> 145, JSON errors 1/1/4 | `docs/plan.md` §1.6, §12; `AGENTS.md` |
| OCR error examples (pilot) | 43 degree insertions, 207 of 393 spacing cases | `docs/plan.md` §1 (chandra error types) |

78
paper/provenance/06a.md Normal file
View File

@@ -0,0 +1,78 @@
# Provenance: sections/06a_results_qa.tex
DeepSeek = `vai-deepseek-v4-1-flash`, seeds 0-2. "qa.csv" rows use `subset == well`, `average == macro_families`.
Means and ranges over the three seeds are computed from those rows. Rounded to three decimals in the text.
| Claim | Value | Source |
|---|---|---|
| Well-scoped T4 questions; single / pair / field | 1,652; 1,560 / 92 / 10 | `outputs/m34/qa.csv` (`n`); plan.md §1.6 |
| Family sizes, well-scoped (lookup, aggregation, temporal, comparison, multi-hop) | 825, 513, 134, 92, 88 | `outputs/m5/errors/taxonomy.csv` (`n`, DeepSeek, non-C4 modes) |
| C4 family sizes (lookup, aggregation, comparison, temporal, multi-hop) | 731, 497, 92, 27, 19 (sum 1,366) | `taxonomy.csv` (`mode == c4`) |
| Bootstrap: 95% well-cluster, 2,000 resamples | 2,000 | `qa_contrasts.csv` (`finite_resamples`); plan.md §4.4 |
| Tool-only accuracy, mean [range] | 0.712 [0.704-0.722] | qa.csv |
| Agent accuracy | 0.618 [0.606-0.629] | qa.csv |
| C4 XML / HTML / OCR accuracy | 0.151 [0.145-0.154] / 0.177 [0.169-0.187] / 0.181 [0.176-0.184] | qa.csv (`mode == c4`) |
| RAG / few-shot / zero-shot accuracy | 0.148 [0.145-0.151] / 0.151 [0.144-0.154] / 0.071 [0.066-0.076] | qa.csv |
| Citation precision (report_precision), mean | tool 0.920, agent 0.878, C4 XML 0.506, HTML 0.415, OCR 0.433, RAG 0.352 | qa.csv |
| Wrong wellbore, mean | tool 0.050, agent 0.046, C4 XML 0.198, HTML 0.381, OCR 0.361, RAG 0.299, few 0.079, zero 0.026 | qa.csv |
| "about four times" | 0.712 / 0.181 = 3.93 | derived from qa.csv |
| Agent − RAG per rep [CI] | +0.461 [0.420, 0.544]; +0.479 [0.453, 0.514]; +0.471 [0.422, 0.551] | `outputs/m34/qa_contrasts.csv` (`agent_minus_rag`, subset well) |
| Agent − tool-only | −0.116 [−0.172, −0.063]; −0.075 [−0.112, −0.030]; −0.089 [−0.171, −0.024] | qa_contrasts.csv |
| Few-shot − zero-shot | +0.068 [0.052, 0.095]; +0.088 [0.080, 0.102]; +0.083 [0.073, 0.089] | qa_contrasts.csv |
| RAG − zero-shot | +0.069 [−0.016, 0.145]; +0.084 [−0.008, 0.173]; +0.078 [−0.016, 0.165] | qa_contrasts.csv |
| C4 OCR − XML (n 1,366) | +0.023 [−0.012, 0.067]; +0.028 [−0.011, 0.081]; +0.038 [−0.002, 0.085] | qa_contrasts.csv (`ocr_minus_xml`, well) |
| C4 OCR − XML without date flags (n 1,284, rebuilt corpus) | +0.011 [−0.012, 0.056]; +0.016 [−0.013, 0.066]; +0.027 [−0.002, 0.088] | qa_contrasts.csv (`ocr_minus_xml_clean`, well); matches plan.md §1.7 |
| C4 OCR − HTML range | −0.000 to +0.015 (all CIs include 0) | qa_contrasts.csv (`ocr_minus_html`); text writes −0.005 to +0.015 (seed 1 −0.0046) |
| Qwen OCR − XML; without date flags | −0.018 [−0.057, 0.012]; −0.009 [−0.065, 0.033] | qa_contrasts.csv (qwen, `ocr_minus_xml`, `ocr_minus_xml_clean`) |
| C4 without date flags accuracy XML / HTML / OCR | 0.156 / 0.170 / 0.175 | qa.csv (`mode == c4_clean`) |
| Qwen accuracy C4 XML / HTML / OCR / RAG | 0.214 / 0.235 / 0.196 / 0.154 | qa.csv (qwen, seed 0) |
| Aggregation correct: tool 0.726, RAG 0.016, C4 0.017-0.027, agent 0.451 | as stated | taxonomy.csv (family aggregation) |
| Multi-hop correct: tool 0.723, RAG 0.011; agent 0.636 | as stated | taxonomy.csv |
| Comparison correct: agent 0.688, tool 0.514; zero-shot 0.185, few-shot 0.576 | as stated | taxonomy.csv |
| Comparison abstention zero-shot 0.685, few-shot 0.029 | as stated | taxonomy.csv |
| Zero-shot temporal 0.159; lookup 0.011; aggregation and multi-hop 0 | as stated | taxonomy.csv; checked against `outputs/m5/errors/predictions.parquet` |
| Few-shot fabricated rate | 0.986 | qa.csv (`metrics.fabricated`); not interpreted; definition in `volve_dia/m34_qa.py` (numeric, incorrect, absent from context) |
| Few-shot ties C4 XML through macro weighting | (0 + 0.576 + 0.013 + 0 + 0.164) / 5 = 0.151 | derived from taxonomy.csv |
| 26 wellbores, 11 wells | 26 / 11 | plan.md §1; AGENTS.md |
| Retriever is TF-IDF without a wellbore filter | code | `volve_dia/m34_qa.py` (`Retriever.search`) |
| Qwen v1 stopped, C4 and RAG complete; Llama smoke only | as stated | plan.md §12 item 32; AGENTS.md |
| Judge sample: 100 items, 10 wells, 50 auto-correct | 100 / 10 / 50 | `outputs/m5/judge/report.json` |
| Sonnet κ 0.98 [0.947, 1.0], agreement 0.99; Haiku κ 0.90 [0.826, 0.966]; between κ 0.92 [0.833, 1.0] | as stated | judge report.json; plan.md §1.7 |
| Five disagreements (J008 sentence-form; J026, J027, J037, J071 OCR "MERSK INSPIRER") | 5 | judge report.json |
| Auto-incorrect answers accepted by Sonnet in the balanced sample | 1 / 50 | judge report.json, confusion matrix |
| Session sample: 300 questions, 11 wells, seed 20261117, one repetition | as stated | `outputs/m34/v2/session/{sonnet,haiku}/summary.json`; plan.md §12 item 32 |
| Session accuracy Sonnet / Haiku | C4 XML 0.123/0.083, HTML 0.177/0.147, OCR 0.187/0.150, RAG 0.128/0.098, zero-shot 0/0 | session summary.json |
| Sonnet C4 XML interval | 0.038-0.206 | sonnet summary.json |
| Batches of 15; no read isolation; outside G2 | as stated | AGENTS.md (session sample limitations) |
| C4 pairs 1,376; well-scoped 1,366; date-flagged 83; without flags 1,293 (1,284 well-scoped) | as stated | `outputs/m34/report.json` (`c4`); qa.csv `n` |
| 1,752 complete reports; 7 unmatched dropped; 16 date-disagreement pages | as stated | plan.md §1.3; AGENTS.md |
| OCR: 1,752 reports, 3,056 pages, 365,698 items, exact 0.9181, CER 2.4020%, WER 5.5560% | as stated | `outputs/ocr_qc_hub/summary.md` (full corpus, hub source; not the pilot) |
| Cells 280,995 / 0.9116 / 2.67%; Operations 140,322 / 0.8605 / 2.985%; Drilling Fluid 108,342 / 0.9648 / 1.093%; Survey 8,595 / 0.9944 / 0.239%; Casing 3,500 / 0.9394 / 4.717%; Bit Record 1,652 / 0.9576 / 1.428% | as stated | summary.md |
| Operations is half of all cells | 140,322 / 280,995 = 0.499 | derived |
| Fields 54,312 / 0.9280 / 2.999%; headers 3,504 / 0.9777 / 2.507%; texts 3,504 / 0.7740 / 0.527% | as stated | summary.md |
| depth mMD 0.9241 / 6.967%; mTVD 0.9418 / 5.421%; plug back 0.9578 / 7.452%; rig name 0.3385 / 5.162% | as stated | summary.md; `by_field.csv` |
| Pressure 50% (42 chars), temperature 33.3% (24 chars) | as stated | by_field.csv |
| Character errors: insert space 9,507; delete "-" 9,160; "-" to en dash 7,952; insert "°" 2,524; "Æ" to "E" 1,152 | as stated | `outputs/ocr_qc_hub/confusions.csv` |
| Æ occurs in 1,384 reference items, 1,378 of them rig name "MÆRSK INSPIRER" | 1,378 / 1,384 | derived from `outputs/ocr_qc_hub/items.parquet` (`ref` contains Æ) |
| Per-report CER median 0.93%, p90 4.98%, max 85.7%; 9 / 1,752 exact | as stated | plan.md §1.3 (from `doc_metrics.csv`) |
| Tight well / HPHT: XML N in 1,759, HTML Y in 1,759; OCR exact 0.9954 / 0.992 | as stated | plan.md §1.3; by_field.csv |
| Bit Record End mMD = bitRun_mdHoleStart, 16/16 rows, 90/90 T4 items | as stated | plan.md §1.3 |
| Render QC scope: header, fields, summaries, Operations | as stated | AGENTS.md (DDR XML bullet) |
| Abstention shares (macro, mean): C4 XML 0.678, HTML 0.535, OCR 0.580, RAG 0.638, zero 0.891, few 0.739, tool 0.083, agent 0.129 | as stated | taxonomy.csv (family macro) |
| Wrong wellbore class 0.095-0.190 (C4), RAG 0.110; tool 0.049, agent 0.026 | as stated | taxonomy.csv |
| Wrong report cited, wrong value, call failure, other | table values | taxonomy.csv (`evidence_missed`, `wrong_with_evidence`, `failed`, `no_citation` + `answered_unanswerable`) |
| Agent call failure range | 0.048-0.080 | taxonomy.csv (`failed_min`, `failed_max`) |
| Lookup: C4 XML correct 0.089 / abstained 0.762; HTML 0.285 / 0.448; OCR 0.285 / 0.462 | as stated | taxonomy.csv |
| Aggregation abstention C4 and RAG 0.69-0.71; C4 multi-hop abstention 0.912-1.0 | as stated | taxonomy.csv |
| Multi-hop wrong value: tool 0.254, agent 0.269 | as stated | taxonomy.csv |
| Comparison wrong wellbore: C4 0.210-0.225, RAG 0.214, tool 0.246, agent 0.120, zero 0.130, few 0.395 | as stated | taxonomy.csv |
| EGS definition (measurement + DDR citation, item 0, /3) | {0, 1/3, 2/3} | plan.md §1.7, §12 item 35; `configs/protocol_v4.yaml` |
| H4 rule ρ ≥ 0.3 means not supported | 0.3 | plan.md §12 item 35 |
| Pooled ρ 0.538 / 0.535 / 0.535; rep 0 CI 0.530-0.551; mean 0.536 | as stated | `outputs/m5/errors/report.json` (`rq4`, primary, pooled) |
| Pooled n (rep 0) and levels: 6,242 / 0.013; 6,489 / 0.221; 3,211 / 0.669 | as stated | report.json; accuracy is micro over predictions; pooled includes the `c4_clean` rows and excludes unanswerable questions |
| No-abstention pooled ρ 0.233 / 0.234 / 0.231; rep 0 CI 0.196-0.296; mean 0.232 | as stated | report.json (`no_abstentions`) |
| Within-mode ρ means and ranges (Table tab:egs) | as tabulated | derived: mean, min, max over seeds of report.json rows |
| Tool-only no-abstention ρ −0.095 [−0.133, −0.051], −0.073 [−0.134, −0.030], −0.097 [−0.157, −0.050] | as stated | report.json |
| Tool-only accuracy at EGS 1/3 vs 2/3, rep 0 | 0.787 vs 0.766 | report.json (`by_level`, primary) |
| Few-shot EGS 1/3 answers: 54 / 48 / 51, all wrong, measurement True, ddr_reference False | as stated | report.json; predictions.parquet |
| Qwen pooled ρ 0.331 [0.295, 0.372] | as stated | report.json (qwen, primary, pooled) |

163
paper/provenance/06b.md Normal file
View File

@@ -0,0 +1,163 @@
# Provenance: sections/06_results.tex and sections/06b_results_labels.tex
Conventions. `classification.csv` = `outputs/m34/classification.csv`; contrasts = `outputs/m34/classification_contrasts.csv`.
Unless stated, rows are task T2 or T3, definition (b), split `well`, input XML, subset `all`. DistilBERT = seeds 0-2;
DeepSeek = `vai-deepseek-v4-1-flash` repetitions 0-2; means and ranges over those runs are computed from the rows.
CIs are 95% well-cluster bootstrap intervals as written in the files. Rounded to three decimals (four for T3) in the text.
**Note on plan.md §1.6 / AGENTS.md headline T2 values.** The plan values are means over subsets `all` and
`without_sidetrack` (and XML + OCR input for TF-IDF), as `PLAN_POOLED` / `pooled_plan_check` in
`scripts/22_paper_figures.py` confirm. The paper uses the `all` subset on XML, so its values differ from the plan:
| Quantity | plan.md §1.6 | file (`all`) used in paper |
|---|---|---|
| Majority T2(b) masked | 0.179 | 0.183 |
| Lexicon | 0.249 | 0.251 |
| TF-IDF masked | 0.461 | 0.463 |
| DistilBERT masked (mean) | 0.597 | 0.593 |
| DeepSeek zero-shot (mean) | 0.405 | 0.407 |
| Qwen zero-shot seed 0 | 0.261 | 0.264 |
| DistilBERT by wellbore (mean) | 0.619 | 0.618 |
| TF-IDF by wellbore | 0.484 | 0.489 |
| TF-IDF unmasked | 0.994 | 0.995 |
| DistilBERT unmasked (mean) | 0.869 | 0.873 |
## 06_results.tex
| Claim | Value | Source |
|---|---|---|
| Intervals are 95% percentile well-cluster bootstrap | 95% | plan.md §4.4; contrasts (`ci_low`, `ci_high`); "percentile" assumed from the bootstrap code |
## Sec. res:leak (T2, T1)
| Claim | Value | Source |
|---|---|---|
| 11 wells, leave-one-well-out | 11 | plan.md §1; classification.csv (`split == well`) |
| T2 activities | 23,447 | classification.csv (`n`); AGENTS.md |
| T2(b) prevalence = majority AP | 0.183 | classification.csv (majority, masked) |
| DistilBERT T2(b) masked, 3 seeds | 0.579-0.603, mean 0.5928 | classification.csv (distilbert seeds 0-2) |
| TF-IDF T2(b) masked [CI] | 0.463 [0.418, 0.513] | classification.csv (tfidf) |
| Lexicon; comment length | 0.251; 0.162 | classification.csv (lexicon, length) |
| Lowest DistilBERT lower limit vs TF-IDF upper limit | 0.554 vs 0.513 | classification.csv (`ci_low` min over seeds; tfidf `ci_high`) |
| TF-IDF T2(b) unmasked [CI] | 0.995 [0.991, 0.999] | classification.csv (tfidf, unmasked) |
| TF-IDF unmasked - masked [CI] | +0.531 [0.480, 0.580] | contrasts (`unmasked_minus_masked`, tfidf) |
| DistilBERT unmasked - masked per seed; all CIs exclude 0 | +0.266 to +0.291 (mean 0.280) | contrasts (distilbert seeds 0-2) |
| DistilBERT unmasked | 0.869-0.880, mean 0.8729 | classification.csv |
| DeepSeek T2(b) masked, 3 reps | 0.406-0.408, mean 0.4074 | classification.csv (`t2_llm`, vai-deepseek) |
| DeepSeek - TF-IDF per rep; CI rep 0 | -0.055 to -0.058; [-0.134, 0.011] | contrasts (`llm_minus_tfidf`) |
| Qwen3-8B seed 0 [CI]; minus TF-IDF [CI] | 0.264 [0.206, 0.340]; -0.200 [-0.250, -0.152] | classification.csv; contrasts; AGENTS.md |
| Qwen seed 1 stopped | 17,827 / 23,447 | AGENTS.md; plan.md §12 item 32 |
| DistilBERT by wellbore, 3 seeds | 0.612-0.624 | classification.csv (`split == wellbore`) |
| DistilBERT wellbore - well per seed; all CIs include 0 | +0.015 to +0.040 | contrasts (`wellbore_minus_well`) |
| TF-IDF by wellbore; difference [CI] | 0.489; +0.026 [-0.001, 0.042] | classification.csv; contrasts |
| 26 wellbores in 11 wells | 26, 11 | AGENTS.md; plan.md §1 |
| Definition (a): majority; TF-IDF; DistilBERT; DeepSeek | 0.153; 0.437; 0.552-0.578; 0.389-0.391 | classification.csv (`definition == a`) |
| Definition (a) unmasked - masked: TF-IDF; DistilBERT | +0.563; +0.298 to +0.337 | contrasts (definition a) |
| TF-IDF (b) - (a) [CI] | +0.026 [-0.003, 0.068] | contrasts (`b_minus_a`, tfidf) |
| Sidetrack rows removed; rows left | 202; 23,245 | classification.csv (`subset == without_sidetrack`, `n`); 23,447 - 23,245 = 202 |
| Without sidetrack: TF-IDF; DistilBERT; DeepSeek | 0.457; 0.589-0.611; 0.401-0.404 | classification.csv (`without_sidetrack`) |
| TF-IDF on OCR input; rows | 0.464; 23,387 | classification.csv (`input == ocr`) |
| T1 days; published; filled | 932; 672; 260 | AGENTS.md; classification.csv (T1 `n`) |
| T1 TF-IDF published [CI]; majority | 0.621 [0.504, 0.742]; 0.286 | classification.csv (T1, published) |
| T1 TF-IDF filled; majority | 0.819; 0.815 | classification.csv (T1, filled) |
| T1 DistilBERT published; filled | 0.301-0.369 (mean 0.342); 0.754-0.808 | classification.csv (T1 distilbert seeds 0-2) |
| LLM-rater section κ published / filled | 0.707 / 0.059 | `outputs/audit/m2_300/agreement_pass1.json`; AGENTS.md |
| T1 TF-IDF OCR published | 0.625 | classification.csv (T1, `input == ocr`) |
## Table tab:leakage (beyond the above)
| Claim | Value | Source |
|---|---|---|
| T3 cells | 4,894 | classification.csv (T3 `n`); AGENTS.md |
| T3(b) majority (prevalence) | 0.1136 | classification.csv; 556 / 4,894 = 0.1136 |
| T3 TF-IDF masked [CI]; unmasked | 0.1225 [0.093, 0.195]; 0.1273 | classification.csv |
| T3 TF-IDF unmasked - masked [CI] | +0.0048 [-0.0005, 0.0238] | contrasts; AGENTS.md |
| T3 DistilBERT masked; unmasked | 0.1175-0.1245 (mean 0.1212); 0.1189-0.1312 (mean 0.1235) | classification.csv seeds 0-2 |
| T3 DistilBERT unmasked - masked per seed; all CIs include 0 | -0.0011 to +0.0066 | contrasts |
## Sec. res:diag (T3, T5)
| Claim | Value | Source |
|---|---|---|
| 10 m cells; 21 wellbores; 10 wells | 10, 21, 10 | plan.md §1; `configs/labels.yaml`; AGENTS.md (G1 preflight, 21 eligible wellbores) |
| T3(b) positive cells; prevalence | 556; 0.114 | `outputs/m5/t5/report.json` (knn prevalence); `cross_checks/summary.json` (`code_positive` b) |
| IoU TF-IDF; DistilBERT | 0.119 (0.1185); 0.108-0.124 | classification.csv (`iou`); AGENTS.md |
| TF-IDF IoU unmasked - masked [CI] | +0.017 [0.0003, 0.061] | contrasts (`iou`) |
| T3 TF-IDF by wellbore; difference [CI] | 0.141; +0.019 [-0.033, 0.043] | classification.csv; contrasts |
| Depth-neighbour forecast k; AP [CI] | 10; 0.150 [0.116, 0.204] | `outputs/m5/t5/report.json` (knn); plan.md §1.8 |
| With WITSML [CI] | 0.135 [0.110, 0.183] | t5 report.json |
| Definition (a): depth; WITSML; prevalence | 0.132; 0.120; 0.098 | t5 report.json (definition a); 478 / 4,894 = 0.098 |
| T5 queries; wellbores; wells | 410; 19; 10 | t5 report.json; plan.md §1.8 |
| Median candidates | 358 | t5 report.json / `per_query.parquet` |
| Gain 0-3 | 0-3 | `configs/protocol_v5.yaml` |
| Depth nDCG@10 [CI]; random | 0.666 [0.644, 0.685]; 0.463 | t5 report.json |
| Fusion pre-event; minus depth [CI] | 0.670; +0.004 [-0.010, 0.018] | t5 report.json; plan.md §1.8 |
| Text pre-event; minus depth [CI] | 0.611; -0.055 [-0.063, -0.048] | t5 report.json |
| WITSML pre-event; minus random [CI] | 0.495; +0.032 [0.008, 0.053] | t5 report.json |
| Text of the event | 0.528 | t5 report.json |
| Definition (a): depth; fusion - depth [CI] | 0.660; +0.005 [-0.012, 0.022] | t5 report.json (definition a) |
| Candidates by wellbore: depth; fusion - depth [CI] | 0.663; +0.003 [-0.012, 0.016] | t5 report.json (wellbore sensitivity) |
| Same formation in top 10: depth; random | 0.711 (71%); 0.234 (23%) | t5 report.json (shares) |
| Same section: pre-event text; depth | 0.576 (58%); 0.451 (45%) | t5 report.json |
| Shared cause share: random to best | 0.703 to 0.754 (text "0.70 ... at most 0.75") | t5 report.json |
| RRF k | 60 | `configs/protocol_v5.yaml` |
| tab:t5 all cells (nDCG, CI, Δ, MRR, P@10, shares) incl. fusion-all 0.661 / -0.005 / 0.434 / 0.217 / 0.546 / 0.540 / 0.746 | as in table | t5 report.json |
| Queries with a fully relevant candidate | 374 | t5 report.json / per_query.parquet |
## Sec. res:labels
| Claim | Value | Source |
|---|---|---|
| Trial: 100 items; raters Sonnet, Opus, Haiku | 100 | `outputs/audit/trial_100/raters.json`; AGENTS.md |
| Trial κ (weighted) per rater and median, all targets | table values | trial_100/raters.json |
| Trial operation class items 65; Haiku 2 unrated | 65; 2 | trial_100/raters.json |
| M2: 300 activities, 11 wells, 225 strata, 90 days (45/45) | as stated | `outputs/audit/m2_300/sample.json`; key_activity.csv (300 rows, npt_b 150 / 150) |
| M2 pass 1 κ per rater and median, all targets (Ministral NPT b 0.29150 -> 0.292) | table values | `m2_300/agreement_pass1.json` |
| M2 pass 2 medians | table values | `m2_300/agreement_pass2.json` |
| M2 operation class items | 195 | agreement_pass1.json |
| Fleiss NPT trial / M2 / M2 pass 2 | 0.662 / 0.512 / 0.528 | raters.json; agreement_pass1.json; agreement_pass2.json |
| Fleiss cause; operation; section (n = 77) | 0.644 / 0.392; 0.662 / 0.255; 0.480 | same files |
| Only Opus > 0.6 on NPT; Opus NPT (b) | 0.683 | raters.json |
| Within-rater pass 1 vs 2: Qwen; Gemma; Ministral | 0.912; 0.9999; 0.824 | agreement_pass2.json; AGENTS.md |
| Gap between passes | 25.6-29.2 min | plan.md §1.5 (`pass2_schedule.json` timestamps) |
| Weighted NPT-call rate, pass 2 | Qwen 0.4934, Gemma 0.2304, Ministral 0.2730 -> 23.0-49.3% | derived: ratings/pass2 joined with key_activity.csv `weight`, sum(weight x yes) / sum(weight) |
| Code (b) share of non-trial frame | 0.1814 (18.1%) of 23,347 | derived: 23,447 - 100 trial items = 23,347; npt_b mean over `outputs/labels/t2_labels.parquet` without trial act_ids |
| All three raters NPT on code-negative; not NPT on code-positive (pass 2) | 22 of 150; 34 of 150 | derived from `m2_300/disagreements_pass2.csv` (`target == npt_b`, all three equal and opposite to `code_label`) |
| A062 (casing_cement, npt_b False, all rate yes); A157 (interruption/sidetrack, npt_b True, all rate no) | items | disagreements_pass2.csv |
| Waiting activities outside interruption codes | 8; rated NPT by 7 / 4 / 6 | derived: key_activity.csv joined with pass-2 ratings (Qwen 7, Gemma 4, Ministral 6) |
| G1 rule margin; observed Δκ | 0.02; 0.025 | `configs/protocol_v1.yaml`; agreement_pass1.json; AGENTS.md |
| Leave-one-well-out Δκ; kept | 0.015-0.037; 10 of 11 | plan.md §1.5 (no output file) |
| Unweighted Δκ | 0.019 | plan.md §1.5 |
| Well bootstrap interval for Δκ | [-0.0095, 0.0741] | plan.md §1.5 |
| Strata with one item; Kish n | 185 of 225; about 126 | plan.md §1.5 |
| Class thresholds | κ 0.60, 20 items, 3 wells x 5 items | `configs/protocol_v1.yaml` |
| 12 1/4 in section 0.701 (18 items); drill_ream 0.655 (15); equipment 0.277 (62); downhole 0.173 (20); failed operation 0.009 (25) | as stated | `m2_300/g1_class_review_pass1.json` (`classes`) |
| DrillScribe episodes matched | 1,758 of 1,758; 23,447 activities | `m2_300/cross_checks/summary.json` (`drillscribe`) |
| Anatoly5ms strong-or-weak cells | 219 of 4,894 | cross_checks/summary.json (`cells_own_hole_with_witsml`) |
| Overlap (b): 83 of 556, Jaccard 0.120; (a): 72 of 478, 0.115 | as stated | cross_checks/summary.json |
| Strong only overlap (b); (a) | 36; 34 | cross_checks/summary.json (`strong`) |
| Four complication rules | lost circulation, well control, stuck pipe, wellbore instability | cross_checks/summary.json (`strength_by_rule`) |
| TSPP wells; ±3 h windows; activities | F-4, F-9 A, F-1; 3 h; 9, 14, 15 | `cross_checks/TSPP2-4_ddr.csv`; AGENTS.md |
| Equipment-failure codes in F-4 / F-9 A windows | 3 / 1 | TSPP2_ddr.csv, TSPP3_ddr.csv |
## Sec. res:planted
| Claim | Value | Source |
|---|---|---|
| T2 planted prevalence | 0.183 | `outputs/m5/synthetic/report.json`; `configs/protocol_v6.yaml` |
| k nearest cells; seeds | 10; 5 | protocol_v6.yaml |
| Null tolerance | 0.01 of π, seed-0 CI contains π | protocol_v6.yaml |
| T2 f = 0.02 null: mean AP; π; seed-0 CI | 0.182; 0.183; 0.179-0.195 | synthetic report.json; settings_t2.csv; seeds_t2.csv |
| T3 s = 0 null: mean AP; π; seed-0 CI | 0.118; 0.114; 0.107-0.124 | report.json; settings_t3.csv; seeds_t3.csv |
| T2 f = 0.10 null: mean AP; difference; seed-0 CI | 0.193 (0.19314); 0.0101; 0.193-0.208 | report.json; settings_t2.csv; seeds_t2.csv |
| Post hoc diagnosis date | 23 November 2026 | AGENTS.md; plan.md §1.9 |
| No-cue indicator AP f = 0.10 (theory); f = 0.02 (theory) | 0.2004 (0.1993); 0.1848 (0.1860) | `outputs/m5/synthetic/null_diagnosis_t2.csv` |
| c = f = 0.10: AP; seed-0 CI | 0.1819; 0.1760-0.1883 | null_diagnosis_t2.csv |
| T2 curve at f = 0.02: c = 0 / 0.25 / 0.5 / 1 | 0.182 / 0.258 / 0.363 / 0.521 | settings_t2.csv |
| c matching real TF-IDF 0.463 | 0.823 (text 0.82); per seed 0.7846-0.8401 | report.json (calibration); seeds_t2.csv; target 0.46346 |
| Unplanted rows exposed to cue at c = 1 | 0.347 (34.7%) | settings_t2.csv (`exposure_unplanted_mean`) |
| T3 curve s = 0 / 0.5 / 1 / 2 | 0.118 / 0.131 / 0.191 / 0.379 | settings_t3.csv |
| Oracle s = 0.5 / 1 / 2 | 0.176 / 0.283 / 0.489 | settings_t3.csv |
| s matching real depth forecast 0.150 | 0.6567 (text 0.66); per seed 0.554-0.716 | report.json; seeds_t3.csv; target 0.14952 |
| Oracle AP at s ≈ 0.66 | about 0.21 | derived: 0.1763 + (0.6567 - 0.5) / 0.5 x (0.2830 - 0.1763) = 0.2097 |
| "about four in five" | 0.82 | restatement of c ≈ 0.82 |

428
paper/refs.bib Normal file
View File

@@ -0,0 +1,428 @@
% Volve-DIA reference list.
% Every entry below was resolved on 17 Nov 2026 by DOI content negotiation (doi.org, Accept: application/x-bibtex;
% the method of .agents/skills/citation-management/scripts/doi_to_bibtex.py) and checked against the Crossref or
% DataCite record. Entries without a DOI (code repositories, data releases) were checked against the hosting API.
% Notes on what was read are in docs/literature_notes.md.
@misc{lu2026petroagents,
author = {Lu, Rong},
title = {{PetroAgents}: A Multi-Agent, Multi-Modal Large-Language-Model Framework for Integrated Upstream
Petroleum Asset Reasoning, Benchmarked on the {Equinor} {Volve} Open Dataset},
year = {2026},
month = jun,
publisher = {MDPI AG},
howpublished = {Preprints.org},
doi = {10.20944/preprints202606.1385.v1},
note = {Preprint, version 1, posted 18 June 2026; not peer reviewed}
}
@misc{lu2026tadi,
author = {Lu, Rong},
title = {{TADI}: Tool-Augmented Drilling Intelligence via Agentic {LLM} Orchestration over Heterogeneous
Wellsite Data},
year = {2026},
publisher = {arXiv},
eprint = {2605.00060},
archivePrefix = {arXiv},
doi = {10.48550/arXiv.2605.00060},
note = {Also posted as Preprints.org 10.20944/preprints202604.1820.v1}
}
@misc{bassey2026grounded,
author = {Bassey, Gospel and Bassey, Samuel and Fakiyesi, Vincent},
title = {Grounded Well-Condition Anomaly Detection on the {Volve} Field: Constructed Labels, a Baseline, and a
Dual-Head Model},
year = {2026},
publisher = {arXiv},
eprint = {2608.05685},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
doi = {10.48550/arXiv.2608.05685},
note = {Version 2, 12 August 2026}
}
@misc{bassey2026release,
author = {Bassey, Gospel},
title = {Grounded Anomaly Detection on the {Volve} Field: Dataset, Labels, and Models},
year = {2026},
howpublished = {Hugging Face repository \texttt{gospelgit/Anomaly\_Detection\_with\_Volve}},
url = {https://huggingface.co/gospelgit/Anomaly_Detection_with_Volve},
note = {Revision 75265537efde, 29 July 2026; CC BY-NC-SA 4.0}
}
@inproceedings{cao2024tspp,
author = {Cao, Bo and Song, Yu and Xu, Feng and Peng, Fukang},
title = {Development of Time Series Drilling Datasets for Stuck Pipe Prediction Using {Volve} Field Data},
booktitle = {Proceedings of the ASME 2024 43rd International Conference on Ocean, Offshore and Arctic Engineering.
Volume 8: Offshore Geotechnics; Petroleum Technology},
year = {2024},
month = jun,
publisher = {American Society of Mechanical Engineers},
doi = {10.1115/OMAE2024-128386},
note = {Paper OMAE2024-128386. The Crossref record lists given and family names in swapped order; the order
used here follows arXiv:2503.07440 by the same first authors}
}
@misc{cao2025crossformer,
author = {Cao, Bo and Song, Yu and Yang, Jin and Li, Lei},
title = {Early signs of stuck pipe detection based on {Crossformer}},
year = {2025},
publisher = {arXiv},
eprint = {2503.07440},
archivePrefix = {arXiv},
primaryClass = {cs.CE},
doi = {10.48550/arXiv.2503.07440}
}
@misc{cao2023tsppdata,
author = {Cao, Bo and others},
title = {Time-series-stuck-pipe-prediction ({TSPP}) dataset},
year = {2023},
howpublished = {GitHub repository \texttt{promiseeee/Time-series-stuck-pipe-prediction}},
url = {https://github.com/promiseeee/Time-series-stuck-pipe-prediction},
note = {Commit 1297d8b, 23 October 2023; no licence file. The repository names no author; it is attributed
here through the abstract of OMAE2024-128386 and Section 2.2 of arXiv:2503.07440, which give this URL}
}
@inproceedings{idrus2026cognitive,
author = {Idrus, S. Syed and Haikal, A. and Rahman, M. Abd and Zahid, A. and Redzuan, A. Ahmad and Isa, S. Mat and
Effendi, S. Mohd and Idris, M. and Parmar, H. and Singh, M. and Kiran, S.},
title = {Cognitive Drilling {AI}: Transforming Activity Logs into Actionable Insights},
booktitle = {Offshore Technology Conference Asia},
year = {2026},
month = mar,
publisher = {OTC},
doi = {10.4043/36422-MS},
note = {Paper OTC-36422-MS}
}
@inproceedings{boden2025rag,
author = {Boden, J. and Eckroth, J. and Gipson, S. and Myers, K. and Smith, R. and Schoen, E. and Keefe, J. and
Sequeira, P.},
title = {Building an Intelligent Research Assistant -- {RAG} Isn't All You Need},
booktitle = {SPE Annual Technical Conference and Exhibition},
year = {2025},
month = oct,
publisher = {SPE},
doi = {10.2118/228117-MS},
note = {Paper SPE-228117-MS}
}
@inproceedings{hussain2026similarity,
author = {Hussain, Syed Aaquib and Reddy, Babu Sai Sampath},
title = {When Similarity is Not Enough: Deterministic Retrieval Pathways for Wellbore-Accurate Knowledge
Synthesis on the {Volve} Field},
booktitle = {ADIPEC},
year = {2026},
month = nov,
publisher = {SPE},
doi = {10.2118/236554-MS},
note = {Paper SPE-236554-MS}
}
@inproceedings{bihani2026knowledge,
author = {Bihani, Anurag and Manikani, Sunil and Arabi, Hakim and Liu, Minyue},
title = {Knowledge Organization Matters: How Graph Design and Temporal Structure Shape Agentic {AI} Performance
on Drilling Activity Reports},
booktitle = {ADIPEC},
year = {2026},
month = nov,
publisher = {SPE},
doi = {10.2118/235330-MS},
note = {Paper SPE-235330-MS}
}
@inproceedings{mbamarah2026hierarchical,
author = {Mbamarah, Julia and Iyalla, Ibiye and Innocent, Prince},
title = {Hierarchical Phase-Adaptive Machine Learning Framework for Real-Time Non-Productive Time Prediction in
Offshore Drilling},
booktitle = {SPE Annual Technical Conference and Exhibition},
year = {2026},
month = oct,
publisher = {SPE},
doi = {10.2118/237272-STU},
note = {Paper SPE-237272-STU}
}
@inproceedings{joshi2025unified,
author = {Joshi, Amod and Singh, Vikas and Sutar, Suhel},
title = {A Unified Agentic and Generative {AI} Framework for Enhancing Drilling Intelligence Through {WITSML}
and Unstructured Data (pdfs) Interaction},
booktitle = {ADIPEC},
year = {2025},
month = nov,
publisher = {SPE},
doi = {10.2118/229435-MS},
note = {Paper SPE-229435-MS}
}
@inproceedings{abaalharith2026hybrid,
author = {Abaalharith, S. and Rachman, B. and Zumarah, B. and Otaibi, B.},
title = {Hybrid {AI} Framework for Predicting Geomechanical Risks and Hole Instability During Well Planning},
booktitle = {IPTC Summit on AI for the Energy Industry},
year = {2026},
month = jan,
publisher = {IPTC},
doi = {10.2523/IPTC-25191-MS},
note = {Paper IPTC-25191-MS}
}
@article{almamoori2025stuck,
author = {Al-Mamoori, Hasan N. and Tian, Jialin and Ma, Haifeng},
title = {Stuck Pipe Detection in Oil and Gas Drilling Operations Using Deep Learning Autoencoder for Anomaly
Diagnosis},
journal = {Applied Sciences},
year = {2025},
volume = {15},
number = {9},
pages = {5042},
doi = {10.3390/app15095042}
}
@inproceedings{cunedioglu2026practical,
author = {Cunedioglu, Y. and Baldino, S. and Ozbayoglu, M. E.},
title = {Practical, Rule-Based Approach for Real-Time Stand and Rig Activity Detection; A Complementary Tool to
Rig-State Identification},
booktitle = {SPE Europe Energy Conference and Exhibition},
year = {2026},
month = jun,
publisher = {SPE},
doi = {10.2118/233220-MS},
note = {Paper SPE-233220-MS}
}
@inproceedings{shah2026drillbench,
author = {Shah, A. and Jamal, M. and Wu, X. and Fu, X. and Chen, J.},
title = {{DrillBench}: A Sequential Decision-Making Benchmark for Drilling Operations with Cross-Stage Agent
Feedback},
booktitle = {SPE Annual Technical Conference and Exhibition},
year = {2026},
month = oct,
publisher = {SPE},
doi = {10.2118/234135-MS},
note = {Paper SPE-234135-MS}
}
@misc{wang2026petrobench,
author = {Wang, Xiang and Zhang, Tingting and Wang, Sen and Wu, Ying and Meng, Heng and Zhou, Peng and Li, Peng},
title = {{PetroBench}: A Benchmark for Large Language Models in Petroleum Engineering},
year = {2026},
publisher = {arXiv},
eprint = {2605.28032},
archivePrefix = {arXiv},
doi = {10.48550/arXiv.2605.28032}
}
@misc{paul2026drillscribe,
author = {Paul, Chinmoy},
title = {{DrillScribe}: Turning daily drilling reports into a non-productive-time ledger},
year = {2026},
howpublished = {GitHub repository \texttt{chinmoypaul8897/drillscribe}},
url = {https://github.com/chinmoypaul8897/drillscribe},
note = {Commit 0abca00, 7 August 2026; code under the MIT licence; not a peer-reviewed publication}
}
@misc{grigorovich2026complication,
author = {Grigorovich, Anatolii},
title = {Drilling Complication Prognostication},
year = {2026},
howpublished = {GitHub repository \texttt{Anatoly5ms/drilling\_complication\_prognostication}},
url = {https://github.com/Anatoly5ms/drilling_complication_prognostication},
note = {Commit a0e16ed, 19 October 2026; MIT licence; not a peer-reviewed publication}
}
@misc{equinor2018volve,
author = {{Equinor}},
title = {Volve field data set},
year = {2018},
howpublished = {Equinor open data},
url = {https://www.equinor.com/energy/volve-data-sharing},
note = {The local dataset has CC BY-NC-SA 4.0 notices. The public Equinor Open Data Licence is linked
in the project plan; confirm the applicable terms before release}
}
% --- Methods, models and benchmarks: added 23 Nov 2026 -------------------------------------------------------
% DOI entries: doi.org content negotiation (Accept: application/x-bibtex) checked against api.crossref.org/works.
% arXiv entries: export.arxiv.org API and the DataCite record of the 10.48550 DOI. Other sources as noted.
@article{cohen1960kappa,
author = {Cohen, Jacob},
title = {A Coefficient of Agreement for Nominal Scales},
journal = {Educational and Psychological Measurement},
year = {1960},
volume = {20},
number = {1},
pages = {37--46},
publisher = {SAGE Publications},
doi = {10.1177/001316446002000104},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{pedregosa2011sklearn,
author = {Pedregosa, Fabian and Varoquaux, Ga{\"e}l and Gramfort, Alexandre and Michel, Vincent and
Thirion, Bertrand and Grisel, Olivier and Blondel, Mathieu and Prettenhofer, Peter and Weiss, Ron and
Dubourg, Vincent and Vanderplas, Jake and Passos, Alexandre and Cournapeau, David and
Brucher, Matthieu and Perrot, Matthieu and Duchesnay, {\'E}douard},
title = {Scikit-learn: Machine Learning in {Python}},
journal = {Journal of Machine Learning Research},
year = {2011},
volume = {12},
number = {85},
pages = {2825--2830},
url = {https://jmlr.org/papers/v12/pedregosa11a.html},
eprint = {1201.0490},
archivePrefix = {arXiv},
annote = {Verified 23 Nov 2026: JMLR BibTeX (no DOI) and arXiv API record 1201.0490}
}
@misc{sanh2019distilbert,
author = {Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
title = {{DistilBERT}, a distilled version of {BERT}: smaller, faster, cheaper and lighter},
year = {2019},
publisher = {arXiv},
eprint = {1910.01108},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
doi = {10.48550/arXiv.1910.01108},
annote = {Verified 23 Nov 2026: arXiv API and DataCite record agree}
}
@inproceedings{cormack2009rrf,
author = {Cormack, Gordon V. and Clarke, Charles L. A. and Buettcher, Stefan},
title = {Reciprocal Rank Fusion Outperforms {Condorcet} and Individual Rank Learning Methods},
booktitle = {Proceedings of the 32nd International ACM SIGIR Conference on Research and Development in
Information Retrieval},
series = {SIGIR '09},
year = {2009},
pages = {758--759},
publisher = {ACM},
doi = {10.1145/1571941.1572114},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{jarvelin2002ndcg,
author = {J{\"a}rvelin, Kalervo and Kek{\"a}l{\"a}inen, Jaana},
title = {Cumulated Gain-Based Evaluation of {IR} Techniques},
journal = {ACM Transactions on Information Systems},
year = {2002},
volume = {20},
number = {4},
pages = {422--446},
publisher = {Association for Computing Machinery},
doi = {10.1145/582415.582418},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{kaufman2012leakage,
author = {Kaufman, Shachar and Rosset, Saharon and Perlich, Claudia and Stitelman, Ori},
title = {Leakage in Data Mining: Formulation, Detection, and Avoidance},
journal = {ACM Transactions on Knowledge Discovery from Data},
year = {2012},
volume = {6},
number = {4},
pages = {1--21},
publisher = {Association for Computing Machinery},
doi = {10.1145/2382577.2382579},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@article{roberts2017crossvalidation,
author = {Roberts, David R. and Bahn, Volker and Ciuti, Simone and Boyce, Mark S. and Elith, Jane and
Guillera-Arroita, Gurutzeta and Hauenstein, Severin and Lahoz-Monfort, Jos{\'e} J. and
Schr{\"o}der, Boris and Thuiller, Wilfried and Warton, David I. and Wintle, Brendan A. and
Hartig, Florian and Dormann, Carsten F.},
title = {Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure},
journal = {Ecography},
year = {2017},
volume = {40},
number = {8},
pages = {913--929},
publisher = {Wiley},
doi = {10.1111/ecog.02881},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@misc{yang2025qwen3,
author = {Yang, An and Li, Anfeng and Yang, Baosong and Zhang, Beichen and Hui, Binyuan and Zheng, Bo and
others},
title = {{Qwen3} Technical Report},
year = {2025},
publisher = {arXiv},
eprint = {2505.09388},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
doi = {10.48550/arXiv.2505.09388},
annote = {Verified 23 Nov 2026: arXiv API and DataCite record agree; 60 authors, first six listed}
}
@misc{grattafiori2024llama3,
author = {Grattafiori, Aaron and Dubey, Abhimanyu and Jauhri, Abhinav and Pandey, Abhinav and
Kadian, Abhishek and Al-Dahle, Ahmad and others},
title = {The {Llama} 3 Herd of Models},
year = {2024},
publisher = {arXiv},
eprint = {2407.21783},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
doi = {10.48550/arXiv.2407.21783},
annote = {Verified 23 Nov 2026: arXiv API and DataCite record agree; the v3 text states that all results
are for the Llama 3.1 models; 561 authors, first six listed}
}
@inproceedings{ouyang2025omnidocbench,
author = {Ouyang, Linke and Qu, Yuan and Zhou, Hongbin and Zhu, Jiawei and Zhang, Rui and Lin, Qunshu and
Wang, Bin and Zhao, Zhiyuan and Jiang, Man and Zhao, Xiaomeng and Shi, Jin and Wu, Fan and
Chu, Pei and Liu, Minghao and Li, Zhenxiang and Xu, Chao and Zhang, Bo and Shi, Botian and
Tu, Zhongying and He, Conghui},
title = {{OmniDocBench}: Benchmarking Diverse {PDF} Document Parsing with Comprehensive Annotations},
booktitle = {2025 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2025},
pages = {24838--24848},
publisher = {IEEE},
doi = {10.1109/CVPR52734.2025.02313},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree; also arXiv 2412.07626. Text is scored by
normalized edit distance to the reference annotation (project README)}
}
@misc{deepseekai2026v41flash,
author = {{DeepSeek-AI}},
title = {{DeepSeek-V4.1-Flash}: Pushing the Limits of {KV} Cache Compression},
year = {2026},
howpublished = {Technical report, Hugging Face repository \texttt{deepseek-ai/DeepSeek-V4.1-Flash}},
url = {https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash},
note = {Technical report, PDF dated 10 September 2026; not peer reviewed},
annote = {Title and author from the PDF and the repository citation block, read 23 Nov 2026 (repository head 314113f8a7da);
no DOI or arXiv record; not peer reviewed}
}
@misc{lu2026upstreambench,
author = {Lu, Rong},
title = {{UpstreamBench}: A 7,440-Question {LLM} Benchmark for Expert Upstream Petroleum and Subsurface
Reasoning},
year = {2026},
month = jul,
publisher = {MDPI AG},
howpublished = {Preprints.org},
doi = {10.20944/preprints202606.1410.v2},
note = {Preprint, version 2, posted 6 July 2026; not peer reviewed},
annote = {Verified 23 Nov 2026: doi.org BibTeX and Crossref agree}
}
@misc{mishra2026timeseries,
author = {Mishra, Ankush and Buiting, Sebastiaan and Sengupta, Soumyadipta and Benzine, Abdallah},
title = {From Time-Series to Text: Multimodal and Agentic Approaches for Automated Drilling Report Generation},
year = {2026},
howpublished = {Workshop on Foundation Models for Structured Data, ICML 2026 (poster)},
url = {https://openreview.net/forum?id=X1s2qN24kX},
note = {Workshop poster; abstract only},
annote = {Title, authors and workshop read from the ICML 2026 virtual page (icml.cc/virtual/2026/71506) on
23 Nov 2026; OpenReview refused automated access; no DOI; abstract only}
}
% --- Not fully verified: do not cite before the missing fields are confirmed ---------------------------------
% EAGE 2026: "From Field Logs to Actionable Insights: A Multi-Agent LLM Approach for Factual Summarization of
% Drilling Operations", 87th EAGE Annual Conference & Exhibition, June 2026,
% https://www.earthdoc.org/content/papers/10.3997/2214-4609.2026101276
% Title and venue from a web-search snippet of the EarthDoc page; authors NOT obtained; the DOI
% 10.3997/2214-4609.2026101276 did not resolve at doi.org and was absent from Crossref on 17 Nov 2026,
% and still returned 404 at doi.org on 23 Nov 2026 (EarthDoc refuses automated access).

View File

@@ -0,0 +1,17 @@
\begin{abstract}
Daily drilling reports record non-productive time (NPT) in both activity codes and comments. We ask how much the
codes inflate prediction scores and how well language models answer questions from the underlying records.
\VolveDIA{} uses 1,759 reports from 11 Volve wells and WITSML logs from 21 wellbores. The benchmark derives
its labels and answers from structured source records and holds out entire wells for supervised evaluation.
Showing the activity codes raised average precision for NPT activities from 0.463 to 0.995 for TF-IDF
logistic regression (paired increase 0.531, 95\% CI 0.480--0.580) and by 0.27--0.29 for DistilBERT.
Depth-interval prediction remained near prevalence. In the planted-cue calibration, the masked TF-IDF score
matched a cue rate of about 82\% among planted positives. Three blind language-model raters reached a median
sample-weighted $\kappa$ of 0.283 against the NPT code labels, so the NPT tasks remain diagnostics.
On 1,652 well-scoped questions, DeepSeek-V4.1-Flash reached a macro-family accuracy of 0.712 with typed queries,
0.618 with an agent, 0.148 with text retrieval and 0.071 with the question alone. On the 1,366 well-scoped
questions paired across document sources, the optical character recognition (OCR) minus XML differences ranged from $+0.02$ to $+0.04$, with
intervals spanning zero. OCR had a character error rate of 2.40\% against HTML text,
and two flags were wrong in all 1,759 HTML reports. These results distinguish direct code leakage, access to
structured evidence and fidelity of the reports a model reads.
\end{abstract}

View File

@@ -0,0 +1,56 @@
\section{Introduction}
\label{sec:intro}
A daily drilling report (DDR) records each activity using times, depths, a comment and a set of codes. The same
codes can define non-productive time (NPT) for a benchmark and give a model the label in its input. A second
problem arises when the model reads a printed report whose fields differ from the structured source.
We ask how much code access raises NPT scores and how access to different records affects answers to drilling
questions \citep{lu2026tadi,lu2026petroagents,hussain2026similarity,bihani2026knowledge}.
The Volve field release contains 1,759 DDRs with 23,447 activities on 26 wellbores of 11 wells
\citep{equinor2018volve}. WITSML time logs exist for 21 of those wellbores, which account for 1,384 reports.
Under the broader rule used here, three activity fields classify 4,286 activities (18.3\%) as NPT.
PetroAgents reported an increase from 0.355 to 0.431 macro-F1 when it exposed the activity codes in an ablation
on 30 well-day examples \citep{lu2026petroagents}. We measure the score change at activity level and hold out
entire wells. We also compare the structured records with the published renders. The \emph{Tight well} and
\emph{HPHT} flags print as \texttt{Y} in all 1,759 HTML reports even though the XML records negative values.
Across the 1,752 reports with complete optical character recognition (OCR), the character error rate (CER) and
word error rate (WER) against the HTML text were 2.40\% and 5.56\%, respectively (Section~\ref{sec:data}).
\VolveDIA{} defines benchmarks for hole-section classification and grounded question answering, with NPT
activity classification, NPT depth-interval forecasting and similar-interval retrieval reported as diagnostics.
The reference data come from DDR XML, WITSML and formation picks. All 1,662 question answers from 39 templates
agree across SQL, an independent pandas implementation and checks against the raw XML. The answering baselines
range from a question-only prompt to typed queries and an agent. The document comparison holds the questions
and reference answers fixed across XML, HTML and OCR text. It pairs 1,376 questions and repeats the comparison
on 1,293 after excluding questions whose evidence reports have a date flag and rebuilding the retrieval corpora
(Sections~\ref{sec:design} and \ref{sec:res:c4}). The protocols and deviations are recorded in
Appendix~\ref{app:record}.
Activity codes dominate NPT scores when supplied to the classifier. Showing them raised average precision (AP)
by 0.531 for TF-IDF and by 0.266 to 0.291 for DistilBERT. With the codes masked, DistilBERT reached 0.579 to
0.603, TF-IDF reached 0.463, and the prevalence was 0.183. The hosted zero-shot model scored 0.055 to 0.058
below TF-IDF, with intervals spanning zero. A planted phrase on about 82\% of planted positives produced
the same masked TF-IDF score under the calibration design. Depth-interval prediction stayed near prevalence,
and its depth-neighbour score matched a weak planted depth effect. The cue study also exposed a failure in its
design. At the larger decoy rate, $f = 0.10$, the locked null failed because the absence of a cue already carried
information about the class. A post hoc check with equal cue rates illustrates the mechanism
(Sections~\ref{sec:res:leak} and \ref{sec:res:planted}).
Access to XML-derived tables gave DeepSeek the highest question-answering scores. Macro-family accuracy over
three repetitions reached 0.712 with typed queries, 0.618 with an agent, 0.148 with retrieval-augmented
generation (RAG) and 0.071 with the question alone. The agent exceeded RAG by 0.461 to 0.479 and fell below
tool-only by 0.075 to 0.116 in paired comparisons. Abstentions accounted for 0.535 to 0.678 of the predictions
with text retrieval. Wrong-wellbore rates were 0.198 to 0.381 with text retrieval and about 0.05 with tools.
On paired document questions, OCR minus XML was $+0.023$ to $+0.038$, with confidence intervals spanning zero
(Sections~\ref{sec:res:t4}, \ref{sec:res:c4} and \ref{sec:res:errors}).
The NPT labels measure how the DDR records an activity. Agreement with independent drilling-engineer annotations
is unknown. Three blind language-model raters compared 300 masked activities to the broader code-based definition
and reached a median sample-weighted $\kappa$ of 0.283, below the 0.6 threshold. No class met the separate reporting
criteria. Reproducing all 1,758 DrillScribe episode keys checks parsing of a shared source
\citep{paul2026drillscribe}. Anatoly5ms provides a separate text-rule cross-check \citep{grigorovich2026complication}. For hole section, agreement was 0.707 on published days
and 0.059 on days with a filled value. The primary hole-section result uses published days. The primary language-model
judge agreed with the automatic free-text scorer at $\kappa = 0.98$ on the judged sample, and the headline T4
results use the automatic XML-based scores. The open-weight Qwen3-8B run covers only part of the planned matrix
(Sections~\ref{sec:res:t4} and \ref{sec:res:labels}).

View File

@@ -0,0 +1,63 @@
\section{Related work}
\label{sec:related}
Work on drilling records with language models has grown quickly, and most of it uses the Volve release \citep{equinor2018volve}. This section groups the studies by what they measure and asks, for each group, whether labels, splits and the reading step are controlled. Table~\ref{tab:positioning} summarizes the comparison. Several entries are conference papers whose full text we could not obtain; the table and the text mark them as \emph{abstract only}, and nothing is claimed about them beyond their abstracts.
\paragraph{Agentic systems on Volve have been specified more often than scored.}
TADI combines a DuckDB store of 12 tables with a ChromaDB vector index, exposes 12 tools to an orchestrating model, proposes an evidence grounding score (EGS) and gives a taxonomy of 130 questions \citep{lu2026tadi}. The paper reports no quantitative result, and EGS is defined but not computed on any question. Whether EGS tracks correctness was therefore open; Section~\ref{sec:res:errors} tests an adapted version against automatic scores. PetroAgents, by the same author, specifies a benchmark of six tasks and reports two of them \citep{lu2026petroagents}. Its NPT task labels 1,750 well-days in 7 classes derived from \texttt{stateDetailActivity} and \texttt{proprietaryCode}. Each seed scores a stratified sample of 60 examples, and the split groups by wellbore, so the sub-wellbores of well F-11 are kept apart. Macro-F1 was 0.464 over all wellbores and 0.442 on the subset with WITSML. The multi-agent system exceeded a single model by 0.048 on that subset ($p = 0.22$), which is not significant. The paper is also the only Volve study we found that measures code leakage: exposing the codes raised one baseline from 0.355 to 0.431, on 30 examples. It is a preprint without peer review. We take from it the observation that the codes leak, and we make masked input the primary mode. Because its unit, sample and split differ from ours, its numbers are not placed in a table with ours.
\paragraph{Two conference papers evaluate question answering on Volve reports, without labelling tasks or code control.}
Both are abstract only. \citet{hussain2026similarity} build a deterministic retrieval tree from field to wellbore, report and section over 1,266 Volve DDRs. They evaluate generated questions with recall, mean reciprocal rank, nDCG and a wrong-well rate. Their emphasis on wellbore accuracy matches an error class that dominates our retrieval results (Section~\ref{sec:res:errors}). \citet{bihani2026knowledge} run a ReAct agent over 1,681 Volve DDRs and a set of BSEE reports, compare five ways of organizing the knowledge, check answers by machine and judge outputs blind in pairs with a multiplicity correction. The abstracts describe document question answering. They provide no section, NPT or depth-interval task and no code-leakage comparison. They are the direct comparators of our T4. Our T4 differs in that answers are computed from the XML by three independent routes, and the same questions are answered from XML, HTML and OCR text. Other systems are described without public questions or numbers. \citet{joshi2025unified} present a commercial agent over WITSML and PDF reports tested on Volve, and \citet{boden2025rag} evaluate a closed research assistant with 75 users (both abstract only). \citet{idrus2026cognitive} classify activity logs on internal data and note that supervisors choose activity codes inconsistently (abstract only). That observation is one reason why code-derived labels need validation. \citet{mishra2026timeseries} study report generation from sensor time series using multimodal and
tool-augmented methods (workshop abstract). That task produces a report from signals.
\todo{Verify authors and publication metadata for EAGE 2026101276 before citing.}
\paragraph{Public NPT labels on Volve are transforms of the same activity codes.}
DrillScribe builds an NPT ledger of episodes from the DDR XML, groups its folds by well name and reports a text-only F1 of 0.866 \citep{paul2026drillscribe}. Its labels are a transform of \texttt{stateDetailActivity}. Our parser reproduces all 1,758 of its episode keys from the 23,447 activities. This agreement validates the parser, not the labels: both sides read the same field, so DrillScribe is not an independent label set. The repository of \citet{grigorovich2026complication} labels 10\,m measured-depth intervals with regular expressions and codes, and splits by well. It documents post-event feature leakage. The share of positive intervals whose drilling-fluid features were measured after the event began fell from 53\% to 4\% once features were taken when the bit entered the interval; this is a contamination rate, not a score. It ships no label file. We reimplemented its text rules on our 10\,m grid. They mark 219 of the 4,894 T3 cells and overlap with 72 of the 478 positive NPT~(a) cells (Jaccard 0.115) and with 83 of the 556 NPT~(b) cells (Jaccard 0.120). The rules target four trouble groups, while T3 covers all NPT, so low overlap is expected. Both repositories are code, not peer-reviewed publications. Both keep sidetracks with their parent well, which supports our choice of the well as the split unit.
\paragraph{Stuck-pipe and NPT prediction on Volve rests on few events or few wells.}
The TSPP dataset gives WITSML time series around stuck-pipe events on Volve \citep{cao2024tspp,cao2023tsppdata}; the dataset paper is abstract only. The full text of the follow-up study \citep{cao2025crossformer} shows three stuck events and no label column. It trains a Crossformer on normal drilling, splits each series in time, and reports two case studies, not an aggregate accuracy. The repository has no licence. In the DDR, the three event windows contain 9, 14 and 15 activities and no activity coded as stuck equipment. TSPP therefore serves as a qualitative case, not as a label set. \citet{mbamarah2026hierarchical} predict NPT from Volve DDRs by training on well F-10 and testing on F-9, with an F1 of 0.436 (abstract only). This is the only cross-well NPT number we found on Volve, and it rests on two wells. \citet{abaalharith2026hybrid} report an F1 of 0.993 for geomechanical risk on Volve wells with leave-one-well-out validation (abstract only). The abstract does not explain the near-perfect score, so we do not interpret it \todo{verify the split and feature timing of IPTC-25191-MS from the full text}. \citet{almamoori2025stuck} detect stuck pipe with an autoencoder; we have not verified its split design \todo{verify the data and split of Al-Mamoori et al. 2025 before characterizing it}. \citet{cunedioglu2026practical} detect rig and stand activity with rules on Volve and FORGE data (abstract only); rig-state rules of this kind produce context features rather than NPT labels.
\paragraph{Rule-built labels with provenance have a precedent outside drilling.}
\citet{bassey2026grounded} construct anomaly labels on Volve daily production data, not on drilling reports or WITSML. Rule-based candidates are confirmed against the plan for development and operation, giving 236 events on 6 production wells, released with provenance under CC BY-NC-SA \citep{bassey2026release}. The labels describe production days, so they cannot serve as a reference for drilling NPT. The study is a precedent for the method we follow: labels built by rules, released with the rule that produced each one, and evaluated across wells.
\paragraph{Domain benchmarks for language models test knowledge, not records.}
PetroBench poses petroleum-engineering questions to language models \citep{wang2026petrobench}, and a related benchmark from the PetroAgents author does the same in multiple-choice form \citep{lu2026upstreambench}. DrillBench evaluates sequential decisions on episodes from a geothermal drilling campaign \citep{shah2026drillbench}. None of these asks a model to recover facts or labels from the reports of a specific well, which is what \VolveDIA{} measures.
\paragraph{Leakage and split design decide what a drilling score means.}
Target leakage arises when a feature is a function of the label or is recorded after the event \citep{kaufman2012leakage}. In DDR tasks both forms are present: NPT status is a function of the activity codes, and fluid or survey records may postdate an event. A split by time window within one well also inflates scores, because adjacent windows share the formation, the bit run and the crew \citep{roberts2017crossvalidation}. On Volve a further dependence exists: sidetracks share the upper hole of their parent well. We therefore split by well, mask the codes in the primary input and keep T3 features strictly before the event (Section~\ref{sec:design:splits}).
\paragraph{Document-reading benchmarks measure text fidelity, not its downstream effect.}
OCR and document-parsing benchmarks score the transcribed text against a reference transcription \citep{ouyang2025omnidocbench}. A low character error rate does not show that an answer built on that text is correct, and a correct transcription of a faulty render carries the fault through. Volve provides both structured XML and rendered documents. The C4 comparison uses these parallel sources and holds the reference answer fixed.
\paragraph{Position of this work.}
Table~\ref{tab:positioning} compares studies by the source of their labels, the unit held out and the evaluations
they report. \VolveDIA{} measures code exposure on the same held-out wells, retains the provenance of each label and
answer, and measures the document contrast against a fixed XML reference. Blind language-model ratings quantify
agreement on code-derived labels. A separate language-model judge checks consistency with the automatic answer scorer.
\begin{table}[t]
\centering
\caption{Positioning of studies on Volve drilling records and related benchmarks. Entries marked $^{a}$ were read as abstracts only. Numbers from other studies follow their own protocols and are not comparable with ours.}
\label{tab:positioning}
\footnotesize
\setstretch{1}
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}>{\raggedright\arraybackslash}p{2.4cm}>{\raggedright\arraybackslash}p{2.4cm}>{\raggedright\arraybackslash}p{2.7cm}>{\raggedright\arraybackslash}p{2.0cm}>{\raggedright\arraybackslash}p{2.4cm}>{\raggedright\arraybackslash}p{2.8cm}@{}}
\toprule
Work & Data & Labels & Split & Leakage control & Evaluation \\
\midrule
\citet{lu2026tadi} & Volve DDR, WITSML, other files & None & None & None & None reported; EGS defined, not computed \\
\citet{lu2026petroagents} & Volve DDR, WITSML & Well-day NPT class from codes & By wellbore & Code ablation on 30 examples & Macro-F1 on 60-example samples; preprint \\
\citet{hussain2026similarity}$^{a}$ & 1,266 Volve DDRs & Generated questions & Not stated & Not stated & Retrieval metrics, wrong-well rate \\
\citet{bihani2026knowledge}$^{a}$ & 1,681 Volve DDRs, BSEE reports & Machine-checked answers & Not stated & Not stated & Blind pairwise judging \\
\citet{paul2026drillscribe} & Volve DDR XML & NPT episodes from \texttt{stateDetail}\allowbreak\texttt{Activity} & By well name & Codes not in input & Text-only F1; code repository \\
\citet{grigorovich2026complication} & Volve DDR, WITSML & 10\,m intervals from rules and codes; no label file & By well & Post-event features reduced & Code repository \\
\citet{cao2025crossformer} & Volve WITSML, 3 stuck events & Events named in text; no label column & In time, within a series & Not stated & Two case studies \\
\citet{mbamarah2026hierarchical}$^{a}$ & Volve DDR, 2 wells & NPT & Train F-10, test F-9 & Not stated & F1 \\
\citet{abaalharith2026hybrid}$^{a}$ & Volve, 4 wells & Geomechanical risk intervals & Leave one well out & Not stated & F1; source of score unclear \\
\citet{bassey2026grounded} & Volve production data & Rule-built production events with provenance & Leave one well out & Not applicable & Anomaly detection \\
\midrule
\VolveDIA{} (this work) & Volve DDR XML, HTML, OCR, WITSML & Built by code from XML and WITSML; public mapping; LLM agreement and source cross-checks & By well; leave one well out & Codes masked; pre-event features; masked and unmasked runs & T1--T5; three repetitions; well-cluster CIs; same questions from XML, HTML and OCR \\
\bottomrule
\end{tabular}
\end{table}

198
paper/sections/03_data.tex Normal file
View File

@@ -0,0 +1,198 @@
% Section 3: Data. Every number is traced in paper/provenance/03_05_AB.md.
\section{Data}\label{sec:data}
\VolveDIA{} is built from the daily drilling reports (DDRs), the WITSML real-time logs and the formation picks of the
Volve field data set \citep{equinor2018volve}. All counts in this section are computed by code from the local copy of
that release, and Table~\ref{tab:inventory} collects them. Figure~\ref{fig:overview} shows how the sources feed the
labels and the model inputs. The one rule the figure is meant to show is that labels and reference answers come only
from the XML and WITSML files; rendered and OCR text is model input and never a label source.
\begin{table}[t]
\centering
\caption{Inventory of the Volve sources used by \VolveDIA{}. Counts are from the parsed local copy; OCR figures are
for the full-corpus export, not the pilot.}
\label{tab:inventory}
\small
\begin{tabular}{@{}p{0.30\textwidth}p{0.62\textwidth}@{}}
\toprule
Item & Value \\
\midrule
Daily drilling reports & 1,759 reports on 26 wellbores of 11 wells; 6 (15/9-F-15 B) to 165 (15/9-F-12) per
wellbore \\
Formats per report & XML (WITSML \texttt{drillReport}), HTML and PDF for all 1,759 reports \\
Size on disk & XML 21.3 MB; HTML 31.0 MB; PDF 56.8 MB; WITSML 19.3 GB \\
Activities & 23,447 rows; 64 activity codes in 7 main groups \\
PDF pages & 3,066 (457 one-page, 1,297 two-page and 5 three-page reports); 83 near-empty last pages \\
Sentinel values set to missing & 9,164 in the DDR tables; 3,703 in the WITSML object files \\
WITSML coverage & 21 DDR wellbores with time logs (none for the five 15/9-19 wellbores); 1,384 reports on those
wellbores, 1,102 with at least 1 h and 983 with at least 23 h of log in the report period \\
WITSML volume & 2.25 billion time-log values; 45.4 million depth-log values; 1,744 mnemonics; 2.2 GB as Parquet \\
Formation picks & 409 picks on 35 wellbores; 24 DDR wellbores with their own picks, 2 with shared picks only \\
OCR export & 3,059 of 3,066 DDR pages matched; 1,752 of 1,759 reports complete; 16 pages with a date
disagreement \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[t]
\centering
\begin{tikzpicture}[
font=\small,
box/.style={draw, rounded corners=2pt, align=center, minimum height=9mm, text width=3.0cm, inner sep=3pt},
src/.style={box, fill=gray!12},
code/.style={box, fill=blue!8},
res/.style={box, fill=green!10},
arr/.style={-{Stealth[length=2.2mm]}, thick}]
\node[src] (xml) at (0,0) {DDR XML\\(1,759 reports)};
\node[src] (wits) at (0,-1.6) {WITSML logs and\\formation picks};
\node[src] (render) at (0,-3.8) {HTML and PDF\\renders};
\node[code] (code) at (3.75,-0.8) {Deterministic code\\(parser, \texttt{labels.yaml},\\SQL)};
\node[code] (ocr) at (3.75,-3.8) {OCR of\\page images};
\node[res] (lab) at (7.5,-0.8) {Labels and answers\\T1--T5, with provenance};
\node[box] (inp) at (7.5,-3.8) {Model input\\(masked text,\\WITSML features)};
\node[box, text width=1.6cm] (eval) at (10.9,-2.3) {Scoring\\by code};
\draw[arr] (xml) -- (code);
\draw[arr] (wits) -- (code);
\draw[arr] (code) -- (lab);
\draw[arr] (xml.west) -- ++(-3mm,0) |- (render.west) node[pos=0.25, left, align=right] {publisher\\render};
\draw[arr] (render) -- (ocr);
\draw[arr] (ocr) -- (inp);
\draw[arr] (code.south east) -- node[right, pos=0.5, align=left, font=\scriptsize] {masked XML\\text and tables}
(inp.north west);
\draw[arr] (lab.east) -| (eval.north);
\draw[arr] (inp.east) -| node[pos=0.25, below, font=\scriptsize] {predictions} (eval.south);
\draw[arr, dashed, red!70!black] (ocr.north) -- node[pos=0.5, font=\Large] {$\times$}
node[pos=0.5, left=3mm, align=right, font=\scriptsize, text=red!70!black] {OCR never\\creates a label} (code.south);
\end{tikzpicture}
\caption{Data flow of \VolveDIA{}. Labels and reference answers for tasks T1--T5 are computed by code from the DDR
XML, the WITSML logs and the formation picks. The HTML and PDF renders and their OCR text only reach the model input,
for example in the document-fidelity contrast C4; the crossed arrow marks the path that is never used.}
\label{fig:overview}
\end{figure}
\subsection{Daily drilling reports}
The DDR corpus has 1,759 reports on 26 wellbores of 11 wells, and every report exists in three versions. The XML file
follows the WITSML \texttt{drillReport} schema; the HTML and PDF files are renders of it by the publisher. We parse
the XML into 17 DuckDB tables that keep the WITSML element names as column names, so that every value can be traced
back to the schema. The report count per wellbore ranges from 6 (15/9-F-15 B) to 165 (15/9-F-12).
The activity table is the core of the corpus. It holds 23,447 rows, each with start and end times, an end depth in
metres measured depth (MD), a free-text comment, a proprietary activity code, a state and a state detail. The 64
codes fall into seven main groups: drilling (9,137 rows), plug and abandon (4,595), interruption (3,577), completion
(2,944), workover (2,221), formation evaluation (732) and moving (241). The state is \texttt{ok} on 22,967 rows and
\texttt{fail} on 480. The state detail is \texttt{success} on 20,802 rows; the remaining values are equipment failure
(1,975), operation failed (456), stuck equipment (109), circulation loss (92), mud loss (12) and injury (1). These
three fields are the source of the NPT labels in Sec.~\ref{sec:design:labels}, and they are masked in the model input
(Sec.~\ref{sec:design:splits}). The \texttt{phase} column holds only the values ``fixed'' (20,696) and ``wire line''
(2,751); it records the rig type, not a drilling phase, and is not used as a label. The text fields are short: a
comment has 114.3 characters on average and a 24-hour summary 173.2. The summary is the literal string ``None'' in 73
reports, and the forecast in 103.
The reports are internally consistent with few exceptions. The date in each file name equals the end of its reporting
period, and no (wellbore, date) pair repeats. The period lasts 24 h in 1,751 reports and 23 h or 25 h in four
reports each, at the daylight-saving changes. Between consecutive activities, 21,667 gaps are zero, 25 are positive
and 5 are negative (overlaps). Activity durations sum to the period length in 1,529 reports and fall short in 221
(2,605.01 h in total); none exceeds it. Nine reports have no activity. One of them, \texttt{15\_9\_19\_A\_1980\_01\_01},
is a placeholder for five tie-in survey stations with a default date in 1980, while its wellbore was spudded in
1997. It is excluded from T1--T3 and kept in the published data that T4 queries.
\subsection{Sentinels, units and missing fields}
Missing values in the DDR XML are written as sentinels, which the parser turns into nulls. We found 9,164 values equal
to $-999.99$, $-999.25$ or $-9999$ and set each to missing, with a per-column count kept in a \texttt{sentinels}
table. Two header fields are sentinels in all 1,759 reports: the planned depth (\texttt{mdPlanned}) and the current
rate of penetration (\texttt{ropCurrent}). Rate of penetration therefore cannot be read from the report header. The
drilled distance (\texttt{distDrill}) is a sentinel in 1,247 reports, and the bit record gives an average rate of
penetration in only 88 values over 80 reports on 21 wellbores. Questions about rate of penetration must state which
of these sources they use, and the T4 templates do. Each column carries a single unit, recorded in a \texttt{units}
table of 105 rows. The parsed hole diameter (\texttt{diaHole}) is missing in 990 reports, including the placeholder report. Most of them are
completion, workover or abandonment days, but 260 of them, on 24 wellbores, still contain drilling activities
(2,618 rows). The bit table covers only 25 of these 260 reports, so the section label of T1 needs a fill rule
(Sec.~\ref{sec:design:labels}).
\subsection{WITSML real-time data and formation picks}
WITSML time logs exist for 21 of the 26 DDR wellbores; the five 15/9-19 wellbores have none. The 1,384 reports of the
21 wellbores are the scope of the parts of the benchmark that need real-time data: T3, T5 and the WITSML features of
T1. Of these reports, 1,102 have at least one hour of log data in their period and 983 have at least 23 hours. Three
wellbore names differ between WITSML and DDR: WITSML \texttt{15/9-F-15 S} is DDR 15/9-F-15, WITSML 15/9-F-15 is DDR
15/9-F-15 A, and WITSML 15/9-F-15A is DDR 15/9-F-15 C. We resolved them from the wellbore identifier, the final
report depth, the survey stations and the total depth, not from the names. A pipeline that joins the two sources by
name assigns the logs of these wellbores to the wrong DDRs.
The parser stores the logs in long format, one Parquet file per wellbore: 2.25 billion time-log values and 45.4
million depth-log values over 1,744 mnemonics, 2.2 GB in total. The logs come from two service companies with
different layouts. The 2013--2016 logs have 78 channels at a 3.0~s step. The 2007--2009 logs have 42 to 252 channels
with a median step of 3.97~s. Within a log, 2.9 million values are duplicated, all with identical values and no
conflict; we rank duplicates across logs and delete none. In the WITSML object files, 3,703 sentinel values are set to
missing. Further suspect values stay in the stored logs and are counted, and protocol v1 treats them as missing at
the feature stage: $-999$, $-99999$, $99999$, $9999$ and magnitudes above $10^{15}$. The rule follows what the values
are: $-999$ fills MWD channels (224,841 values), $99999$ sits almost entirely in one annular-velocity channel
(279,676 of 279,866 values), and $9999$ appears in timer channels. The object counts reproduce those reported for
TADI \citep{lu2026tadi}: 161 BHA runs, 2,882 mud-log intervals and 11,134 messages. The trajectory count does not:
we parse 5,561 stations against 4,217 in TADI, and we have not found the cause.
Formation tops come from the field's well-pick file, with 409 picks on 35 wellbores. Matching by name finds picks
for 23 of the 26 DDR wellbores. Three mappings close the gap: \texttt{15/9-19 SR} is DDR 15/9-19 ST2; DDR 15/9-19 S
inherits the four picks of SR above the kick-off point at 1,493~m; and 15/9-F-9 A inherits two picks of 15/9-F-9.
After mapping, 24 DDR wellbores have their own picks and 2 have shared picks only. The DDRs also list formation tops
(\texttt{stratInfo}). Against them, 130 picks match by name, with a median difference of 0.0~m and 97 within 5~m.
The other 33 differ by up to 1,093~m. The largest differences occur where the DDR lists two different depths for the
same formation, so we keep the pick file as the single source of formation labels and use \texttt{stratInfo} only as
a cross-check.
\subsection{Fidelity of the rendered reports}
The renders are not faithful copies of the XML. We compared 272,544 printed items of the 1,759 HTML reports with the
XML values: the header, 31 report fields, the two 24-hour summaries and the Operations table. All items agree except
two flags. \emph{Tight well} and \emph{HPHT} are 0 (no) in the XML of all 1,759 reports and are printed as ``Y'' in
all 1,759 renders. A third error came to light when we checked T4 answers: the ``End mMD'' column of the Bit Record
table prints the hole depth at the \emph{start} of the bit run (\texttt{bitRun\_mdHoleStart}). We confirmed this on
16 of 16 rows by hand and on 90 of 90 rows through T4; the ``Form ROP'' column of the same table prints the average
rate of penetration correctly (88 of 88). The other 13 tables of the HTML report were not compared. A pipeline that
reads only the PDF inherits these errors, and no OCR system can correct them, because the page itself is wrong.
\VolveDIA{} therefore takes these fields from the XML only, and the C4 contrast (Sec.~\ref{sec:res:c4}) starts from
the fact that a born-digital render can already differ from its source.
\subsection{OCR of the rendered pages}
The PDFs are born-digital, with a text layer. OCR matters when a DDR archive exists only as page images, and to
measure what it does to the benchmark tasks, the pages were read as images by an OCR model. \todo{name and version of
the OCR model
used for the full-corpus export} The PDFs have 3,066 pages; 83 near-empty pages (fewer than 50 characters) are all last
pages of a report. A colleague ran OCR on 3,639 PDF pages, of which 3,066 are DDR pages, and exported the result through
a data hub in COCO format (3,502 images, 33,489 text blocks). The export did not keep file names, so we matched each
page to its report by content. A TF-IDF filter proposes candidate pages; an idf-weighted token F1 of at least 0.7
accepts a match for pages with at least 50 tokens; a thumbnail correlation of at least 0.9 decides pages without
text. Of the 3,066 DDR pages, 3,059 were matched, including all 49 blank pages, and 1,752 of the 1,759 reports are
complete. The seven unmatched pages have thumbnail correlations of 0.69--0.94 with their best candidate, and their
seven reports are dropped from the OCR experiments. A second check compares the dates printed on a page with the dates
the OCR read. Of the 1,753 pages that carry a date, 16 disagree. All 16 have a text F1 of at least 0.91 and a
thumbnail correlation of at least 0.94, so the page match is probably right and the OCR misread a digit or dropped the
period line; we have not inspected them page by page. C4 reports results with and without these 16 pages.
The OCR quality was measured on the full export, not on a sample. The QC parses the HTML and the OCR blocks into the
same structure (header, fields, paragraphs and tables) and compares them item by item. Only whitespace is normalised;
a missing item counts as a deletion and an extra OCR item as an insertion. The OCR parser undoes the pagination of
the PDF before the comparison: it joined tables broken across pages 1,136 times and merged continuation rows 151 times,
a repair that never fires on the HTML. Over 1,752 reports, 3,056 pages and 365,698 content items, the exact-match
rate is 0.9181, the character error rate (CER) 2.40\% and the word error rate (WER) 5.56\%. Table cells (280,995
items) reach an exact-match rate of 0.9116 and a CER of 2.67\%; the Operations table (140,322 cells) is weaker, at
0.8605 and 2.99\%. Header fields reach 0.9280 and 3.00\%. The fields that matter most for drilling questions are the
weakest. The depth field (metres MD) has an exact-match rate of 0.9241 and a CER of 6.97\%, the hole diameter has a CER
of
5.4\%, and the rig name has an exact-match rate of only 0.3385. In the pressure and temperature fields the OCR
inserts units that the page does not print. The per-report CER has a median of 0.93\%, a 90th percentile of 4.98\% and
a maximum of 85.7\%, and only 9 of the 1,752 reports are read without any error. The most frequent character errors
are an inserted space (9,507), a dropped hyphen (9,160), a hyphen read as an en dash (7,952), an inserted degree sign
(2,524) and \AE{} read as E (1,152).
These rates understate the risk for drilling use. In a pilot of 26 reports (47 pages), each error was checked against
the page image, and the error types are listed in Appendix~\ref{app:labels}. The OCR fills empty unit brackets, invents
a printed-date line, silently corrects typing errors of the source, misreads proper names, merges table columns, and in
one report shifts a depth value one field down. The last error type produces a value that looks valid and is wrong.
The pilot pages come from a different OCR run (3.97\% of their characters differ from the export), so the pilot
illustrates the error types; all rates in this paper are full-corpus rates.
The release terms for the labels and tables derived from this copy of the data are still to be settled.

View File

@@ -0,0 +1,181 @@
% Section 4: Benchmark design. Every number is traced in paper/provenance/03_05_AB.md.
\section{Benchmark design}\label{sec:design}
\VolveDIA{} defines five tasks on the data of Sec.~\ref{sec:data} and one contrast (Table~\ref{tab:tasks}). Their
roles differ, and the roles were fixed in protocol v1 before any baseline ran. Grounded question answering (T4) and the
document-fidelity contrast C4 are the headline analyses. The hole-section task T1 on days with a published hole size
supports them. The two NPT tasks, T2 and T3, are diagnostics: they test how well a model recovers the DDR activity
codes from masked text and data, which is not the same as detecting non-productive time as an engineer would. T5 is an
optional retrieval diagnostic added later under its own protocol. All labels and answers come from code
(Sec.~\ref{sec:design:labels}); validation without a human rater is described in Sec.~\ref{sec:design:validation}, the
split and leakage rules in Sec.~\ref{sec:design:splits}, and the locked protocols in Sec.~\ref{sec:design:protocols}.
\begin{table}[t]
\centering
\caption{Tasks of \VolveDIA{}. NPT (b) is the primary definition and (a) the sensitivity definition. ``Masked'' means
that the activity code, state and state detail are removed from the input.}
\label{tab:tasks}
\small
\begin{tabular}{@{}p{0.12\textwidth}p{0.19\textwidth}p{0.19\textwidth}p{0.17\textwidth}p{0.20\textwidth}@{}}
\toprule
Task & Unit and size & Input & Metric & Leakage control \\
\midrule
T1 hole section & Report day; 932 drilling days (672 published, 260 filled) & DDR text of the day and WITSML
statistics & Pooled out-of-fold accuracy per label source & Hole-size, bit-size and casing-size fields withheld \\
T2 NPT activity & Activity; 23,447 rows, 4,286 NPT (b), 3,577 NPT (a) & Comment, neighbouring comments, 24-hour
summary & Average precision & Codes masked; unmasked run as ablation \\
T3 NPT depth interval & 10~m cell; 4,894 own-hole cells on 21 wellbores & Activity history, WITSML, formation
distance & Interval IoU; average precision per cell & Features end before the interval starts; codes masked \\
T4 grounded QA & Question; 1,662 (1,638 answerable, 24 unanswerable), 39 templates & Question plus mode-specific
evidence & Accuracy within tolerance; citation precision; wrong-wellbore rate & Answers by SQL; few-shot examples
from development wells \\
C4 fidelity & Paired T4 question; 1,376 (1,293 without date-flagged pages) & Same retrieval over XML, HTML or OCR
text & T4 metrics, paired by question & Labels from XML in every condition \\
T5 similar interval & Query interval; 410 (b), 373 (a) & Depth, WITSML and masked text before the interval &
nDCG@10, MRR, P@10 & Candidates from other wells; no code, cause, section or formation read \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Labels by code}\label{sec:design:labels}
Every label is computed by code from the DDR XML tables, the WITSML logs or the pick file, and every derived value
carries its provenance. The mapping from source fields to labels is a public configuration file. A check compares
the code and state counts written in that file with the data and reports every difference. No person and no language
model
creates a label, and rendered or OCR text is never a label source. The full mapping is summarised in
Appendix~\ref{app:labels}.
\paragraph{T1: hole section.} The section of a report day is its published hole diameter. The diameter is missing in
990 reports, 260 of which contain drilling activities, so a fill rule was needed for those days. We evaluated
candidate rules by hiding known diameters and asking each rule to recover them. The chosen rule, a forward fill of the
most recently opened section of the wellbore, recovers 1.0000 of the values when the second half of a run is hidden
(the pattern of the real gaps, and correct by construction) and 0.9051 when single reports are hidden. On the real
gaps, it agrees with the hole size named in the text on 7 of 8 reports and with the bit record on 23 of 30. The 17
reports before the first known diameter of a wellbore take the first section and carry a flag. The benchmark scores
the 932 drilling days, 672 with a published and 260 with a filled label, and reports the two sources apart; the 818
non-drilling days are not scored. The 6-inch and 9.875-inch sections fail the evaluability rule and are not scored as
separate classes. A second T1 label, the operation class of an activity, maps the code to one of 15 classes; it is
used only in the label audit.
\paragraph{T2: NPT activity.} Two NPT definitions are computed side by side. Definition (a) marks the rows with an
interruption code: 3,577 rows (15.3\%), 8,343~h or 21.2\% of the reported hours. Definition (b) is the union of an
interruption code, \texttt{state = fail} and a state detail other than \texttt{success}: 4,286 rows (18.3\%), 9,626~h
or 24.4\% of the hours. Protocol v1 chose (b) as the primary definition by the rule in
Sec.~\ref{sec:design:validation}, and (a) is the sensitivity definition. Each NPT row also receives a cause group. The
code decides when it names a cause, the state detail decides otherwise, and \texttt{unspecified} is the default. The
two sources name different groups on 192 rows; these rows keep the code's group and are retained for the audit.
\paragraph{T3: NPT depth interval.} The depth of an activity is its end depth, one value per row, which is not
necessarily the depth of the problem in the hole. Only rows below the mud line can be placed in depth. Of the 23,447
activities, 9,116 have a depth of zero and 2,923 lie above the mud line, so only 50.3\% of the NPT rows (44.6\% of the
NPT hours) can be located. The located rows are mapped onto a 10~m MD grid, and a cell is positive when it holds at
least one NPT activity. Over all 26 wellbores the grid has 8,757 cells, 844 positive under (a) and 979 under (b).
Touching positive cells merge into intervals. The scored universe is the own hole of each of the 21 wellbores with
WITSML: 4,894 cells, of which 556 are positive under (b) and 478 under (a). Cells above the own-hole top of a sidetrack
belong to the parent wellbore, and the 191 positive cells there are reported apart and not scored.
\paragraph{T4: grounded questions.} Each of 39 templates has three SQL queries over the DDR tables: one enumerates the
instances, one computes the answer and one returns the evidence rows. The templates produced 3,915 candidate
instances. Of these, 371 were dropped by rule, most for an ambiguous value (311), and 1,662 questions were sampled from
the rest: 1,638 answerable and 24 with the reference answer ``not reported''. The five question families are lookup
(825 questions), aggregation (513), temporal event (134), comparison (102) and multi-hop (88). Of the 1,662 questions,
1,560 concern one wellbore, 92 compare two wellbores of one well and 10 concern the whole field. Three independent
implementations give the same answers: SQL, a separate pandas version and a direct reading of the raw XML agree on all
1,662 questions. A question has a median of 3 evidence rows (maximum 488). Questions about
trouble use the published codes, not either NPT definition. Numeric answers match within a tolerance that was fixed
per quantity before any model ran: 1.0~m for depth, 0.01~g/cm$^3$ for density, 0.1$^\circ$ for inclination, 0.25~h for
durations, 2\% for rate of penetration and 0.01~in for sizes; counts and dates must match exactly.
\paragraph{T5: relevance.} A query is an own-hole T3 interval with a known section and formation: 410 intervals under
(b) and 373 under (a), on 19 wellbores of 10 wells. The formation of an interval is the deepest pick at or above its
top. A candidate interval receives a gain $g$ from 0 to 3: one point each for the same section, the same formation and
a shared cause group. It is fully relevant when $g = 3$.
\subsection{Label validation without a human rater}\label{sec:design:validation}
No human rater was available for this benchmark, so no label in it has been checked by a person. Validation therefore
rests on three layers, none of which creates labels. Their results are in Sec.~\ref{sec:res:labels}.
\paragraph{Blind LLM raters.} Language models from different families rated masked items without seeing the codes or
each other's answers. A trial of 100 activities, rated by Claude Sonnet, Opus and Haiku, served as a pipeline check
and was not used for any decision. The decision sample was drawn before any rating: 300 activities outside the trial,
stratified by NPT zone, cause or operation class and well (105 rows positive under
(a), 45 positive under (b) only and 150 negative, in 225 strata), plus 90 T1 days (45 with a published and 45 with a
filled section). Three open-weight models, Qwen3-8B, Gemma 3 12B and Ministral 3 8B, ran locally with fixed weights and
one conversation per item. Each rated every item twice on the same day, 1,170 ratings per pass.
The decision statistic is the median over raters of Cohen's $\kappa$ \citep{cohen1960kappa} against the code label,
weighted by the inverse inclusion probability of each item, from the first pass. The second pass measures short-term
repeatability. The statistic served two decisions. First, (b) became the primary NPT definition because its median
$\kappa$ exceeded that of (a) by at least 0.02. Second, a class qualified for a separate score only with
$\kappa \geq 0.6$, at least 20 rated items and at least 3 wells with 5 items each. The raters are language models.
They may share training data or conventions with the LLM baselines, so agreement with the code labels is evidence
of consistency with one reading of the text. It is not a check by drilling engineers and not evidence that the labels
are
correct.
\paragraph{Cross-checks with third-party work.} No public NPT label set on Volve is independent of the DDR codes. We
re-ran three checks. DrillScribe \citep{paul2026drillscribe} builds episodes from the same state-detail field, so
matching its episode keys tests our parsing, not our labels. The text rules of \citet{grigorovich2026complication},
re-implemented with attribution, flag trouble intervals from comments and give a check on T3 that is partly
independent of the codes. The three stuck-pipe cases of the TSPP data set \citep{cao2023tsppdata,cao2024tspp}, on
15/9-F-4, 15/9-F-9 A and 15/9-F-1, are read case by case against what the DDR records in the same windows.
\paragraph{Calibrated judge for free text.} Free-text T4 answers (string, enumeration and list types; 233 of the 1,662
questions) are hard to score by string matching. Protocol v3 tested an LLM judge on 100 answers sampled before any
verdict. The planned reference, the author's own scores, was replaced by the automatic score against the XML answer,
because no human rater exists. The judge sees the question, the reference and the candidate answer, and never the
model, mode, source, citations or automatic score. Claude Sonnet is the primary judge and Claude Haiku the sensitivity
judge, and the statistic is unweighted Cohen's $\kappa$ with the threshold $\kappa \geq 0.6$ of gate G3. A pass shows
that the judge is consistent with the automatic scorer, not that it agrees with a person. T4 headline numbers remain
automatic scores.
\subsection{Splits and leakage control}\label{sec:design:splits}
The primary split groups items by well, because wellbores of one well share data. The 26 wellbores belong to 11 wells:
15/9-19 and 15/9-F-15 have five wellbores each, 15/9-F-1 and 15/9-F-11 four each, 15/9-F-9 two, and six wells one each.
Sixteen report dates are shared by two wellbores of the same well. A sidetrack inherits the upper hole of its parent,
and 191 of the 844 positive T3 cells under (a) lie in such inherited sections. Verbatim repetition of comments of at
least 40 characters is rare both between sibling wellbores (0.30\%) and across wells (0.96\%), so it is the shared
dates and inherited hole, not text duplication, that motivate the grouping. Both third-party repositories we compared
against also keep sidetracks with the parent well. The outer loop leaves one well out (11 folds). The inner loop for
tuning uses five-fold grouped cross-validation by well, and scores are computed on the pooled out-of-fold predictions.
A split by wellbore (26 folds) is a sensitivity analysis; its inner loop still groups by well, so the sibling wellbores
of a test wellbore never enter tuning. Nothing is chosen on a test well: no hyperparameter, prompt, threshold, class
merge or few-shot example. Systems that need prompt development use the two wells with the fewest reports, 15/9-F-7 and
15/9-F-9.
For T2 and T3, the activity code, its main and sub parts, the state and the state detail are masked in the input view,
which raises an error if a masked column appears. The equipment-failure table and the schedule fields
\texttt{daysAhead} and \texttt{daysBehind} are withheld as well, since they record NPT almost directly. TF-IDF and DistilBERT also run on unmasked input for T2 and T3. Their paired score changes measure the effect of exposing the codes. For T3,
a forecast is issued for the whole grid of a wellbore at its first in-hole activity and uses only data that end before
that time, within a 24-hour history window. The code checks that no forecast time is later than the start of the
interval it is scored against. For T1, the hole-size, pilot-size, bit-size and casing-size fields are withheld; sizes
named
in the free text stay in the input, because they are the evidence a reader would use.
\paragraph{Metrics and statistics.} For T2 and T3, average precision sums the precision at each distinct score threshold, weighted by the
increase in recall at that threshold. The reporting code computes this sum directly from the pooled held-out predictions. T3 also reports interval IoU: the length of the intersection of the
predicted and reference intervals on the 10~m grid divided by the length of their union, pooled over wellbores. T4
reports accuracy within the template tolerance, macro-averaged over the five families on the questions scoped to one
well; field questions are scored on a separate line. Citation precision is computed at the report level. The
wrong-wellbore rate counts predictions that name or cite a wellbore outside the question scope, or name a wellbore
other than the reference when the reference answer specifies one. T5 reports
nDCG@10 with linear gain $g$ \citep{jarvelin2002ndcg}, MRR and precision at 10. Confidence intervals come from 2,000 bootstrap
resamples of whole wells (95\%, seed 20261117), and comparisons are paired on the same items. Stochastic models run
with three seeds or repetitions for the complete baseline matrix. Appendix~\ref{app:record} records partial runs.
\subsection{Locked protocols, hypotheses and gates}\label{sec:design:protocols}
Each analysis was fixed in a protocol file that was locked by its SHA-256 hash before the results it governs were
computed. Protocol v1 fixed the splits, masking, NPT definition, class rules, metrics, seeds and gate thresholds before
the first baseline run. Protocols v2--v6 each extend the previous one by checksum and leave it unchanged. They cover
the replacement of two baselines, the judge, the error taxonomy with the evidence-grounding score, T5 and the
planted-signal studies. Five hypotheses were stated before G1. H1: on masked T2, the advantage of a zero-shot LLM over
TF-IDF with logistic regression is unclear. H2: unmasking the codes raises T2 and T3 scores. H3: blind raters reach
$\kappa \geq 0.6$ on binary NPT, with lower values for cause classes. H4: the evidence-grounding score correlates only
weakly with correctness. H5: OCR lowers T4 more than T2 because T4 needs exact values. T1 section is included in the document sensitivity analysis. Gates G1--G3 control the
protocol lock, baseline coverage and judge use. A threshold is never relaxed: a
change of plan goes into a new protocol with a recorded deviation. Appendix~\ref{app:record} and
Table~\ref{tab:protocols} give the lock dates, hashes, what was known before each lock, the gate outcomes and every
deviation.

View File

@@ -0,0 +1,99 @@
% Section 5: Baselines. Every number is traced in paper/provenance/03_05_AB.md.
\section{Baselines}\label{sec:baselines}
The baselines range from a constant predictor to a tool-using language model (Table~\ref{tab:baselines}). They were
fixed in protocol v1, except for the replacement of the two local language models described in
Sec.~\ref{sec:baselines:deviation}. No baseline is tuned on a test well, and every run that started is reported,
including the stopped ones. Results are in Sec.~\ref{sec:results}.
\begin{table}[t]
\centering
\caption{Baselines and their runs. ``Repetition'' marks independent API calls whose seed is sent but not verified.
Partial v1 runs are reported as partial and are not part of the G2 coverage.}
\label{tab:baselines}
\small
\begin{tabular}{@{}p{0.25\textwidth}p{0.17\textwidth}p{0.22\textwidth}p{0.28\textwidth}@{}}
\toprule
System & Tasks & Runs & Notes \\
\midrule
Majority (prevalence) & T1--T3 & deterministic & Reference score \\
Lexicon & T2 & deterministic & Public NPT keyword rules \\
TF-IDF + logistic regression & T1--T3 & deterministic & $C \in \{0.25, 1, 4\}$ chosen in the inner loop \\
DistilBERT & T1--T3 & 3 seeds & Fine-tuned; masked and unmasked \\
DeepSeek-V4.1-Flash & T4 (5 modes), C4 (3 sources), T2 zero-shot & 3 repetitions & Protocol v2, full matrix \\
Qwen3-8B & T4, C4, T2 zero-shot & stopped 19/11/2026 & Partial v1 \\
Llama 3.1 8B & T4, C4 & never ran beyond a smoke test & Retired in protocol v2 \\
Claude Sonnet, Claude Haiku & T4 (300 questions, 5 conditions), T2 (500 items) & 1 repetition & Session subagents,
auxiliary sample \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Classification baselines}
Four non-generative baselines cover T1--T3. The majority baseline uses the training-fold majority class and a constant ranking score for the binary tasks.
On these tasks, its average precision equals the prevalence. The lexicon baseline flags a masked T2 comment that matches the public NPT keyword rules of the
label configuration (Appendix~\ref{app:labels}); a comment-length score is also reported as a trivial reference. TF-IDF
with logistic regression \citep{pedregosa2011sklearn} uses
word features with a minimum document frequency of 2. The inverse regularisation strength $C$ is chosen from
$\{0.25, 1, 4\}$ by the inner grouped cross-validation. For T3, the input concatenates the masked activity text of the
previous 24~h with WITSML statistics of ten channels: \texttt{RPM}, \texttt{WOB}, \texttt{TORQ}, \texttt{SPPA},
\texttt{ROP}, \texttt{HKLD}, \texttt{RPMAV}, \texttt{WOBA}, \texttt{RPMA} and \texttt{ROPA}. T3 forecasts are cut at
thresholds
from 0.1 to 0.5 in steps of 0.1 to form intervals for IoU. DistilBERT \citep{sanh2019distilbert} is fine-tuned from the
uncased base
checkpoint at a fixed revision for two epochs, with learning rate $2 \times 10^{-5}$, batch size 32 and at most 192
tokens. It runs with three seeds for both NPT definitions, masked and unmasked, and for both splits.
\subsection{Language-model baselines}
DeepSeek-V4.1-Flash \citep{deepseekai2026v41flash} is the API baseline of protocol v2. It runs through an
OpenAI-compatible gateway with thinking disabled, temperature 0.2, at most 320 output tokens and a JSON answer with the
fields answer, unit and citations. Each call is repeated three times with the repetition index sent as the seed. The
gateway does not confirm that the seed is honoured, so the three runs are repetitions, not seeded replicates. The full
matrix has 48,951 T4 and C4 predictions and 70,341 T2 predictions, and all of them were collected.
T4 is run in five modes. Zero-shot gives the model only the question. Few-shot adds two question--answer examples from
the development wells, in a fixed order. RAG retrieves up to eight passages of the XML-derived text, within 12,000
characters. Tool-only gives the model a parameterised query tool over the DDR tables without a retrieved context.
The agent adds an initial retrieved context and a search tool. Both modes allow up to three tool calls. C4 runs the RAG mode over the XML, HTML
or OCR text of the same reports, on the 1,376 paired questions and again on the 1,293 questions without
date-disagreement pages.
Qwen3-8B \citep{yang2025qwen3} and Llama 3.1 8B \citep{grattafiori2024llama3} were the local open-weight baselines of protocol v1,
run as 4-bit quantised GGUF files. Qwen completed T2 seed 0 (23,447 predictions) and reached 17,827 of 23,447 for
seed 1. For T4 and C4, it completed seed 0 for the C4, date-clean C4 and RAG modes, with 10,214 of 16,317 predictions
over all modes, and its agent mode stopped at 545 of 1,662. Llama ran only a smoke test. These runs are partial v1
results. They do not enter the comparison that gate G2 requires.
Claude Sonnet and Claude Haiku run as subagents of the Claude Code session, because no API key was available for them.
They answer a fixed auxiliary sample drawn with seed 20261117 over all 11 wells before any answer existed: 300 T4
questions in five conditions (zero-shot, RAG over XML text, and C4 over XML, HTML and OCR text) and 500 masked T2
items, with one repetition. The prompts are built by the same code as the DeepSeek prompts. The sample has three
limitations, which Sec.~\ref{sec:results} carries. The subagents were told to read only their batch file, but file
access was not enforced, and some agents listed the directory. Group outputs were quarantined and rerun as one batch
per agent. The batches held 15 T4 questions or 50 T2 items, not the 30 and 100 of the protocol, because the reading tool
returns about 42,000 characters.
\subsection{Deviation: replacement of the local models}\label{sec:baselines:deviation}
On 19/11/2026, after the v1 runs had started, the project owner stopped Qwen3-8B and Llama 3.1 8B and locked protocol
v2.
The change was not driven by a test-well result. DeepSeek-V4.1-Flash
fills the API cell of v1 on the full matrix. Claude Sonnet and Claude Haiku replace the local models on the auxiliary
sample. All v1 checkpoints stay unchanged and are reported as partial. Appendix~\ref{app:record} records the deviation
and the two drafts that were replaced before any v2 call.
\subsection{Later analyses}
Three later analyses were locked before their scores in protocols v4--v6. Protocol v4 fixed an ordered error taxonomy,
assigned by the earliest matching rule for each T4 prediction, and an evidence-grounding score (EGS). EGS is adapted from TADI
\citep{lu2026tadi} to the JSON answer: one third for a number followed by a TADI drilling unit, one third for a
citation that resolves to a known DDR report, and zero for sections, which the format does not have.
Protocol v5 fixed the T5 representations, none of which reads codes, causes, labels, sections or formations: random
order, depth, WITSML statistics and masked text before the interval, text after it (reported apart) and
reciprocal-rank fusion \citep{cormack2009rrf} with $k = 60$. Protocol v6 fixed a planted-signal study.
Labels are drawn at random with the real prevalence, and a signal of
controlled strength is written into the model input: a cue phrase in the masked T2 text, or a depth hazard for T3. This
bounds what TF-IDF and the depth forecast can detect. Their
results are in Secs.~\ref{sec:res:errors}, \ref{sec:res:diag} and \ref{sec:res:planted}.

View File

@@ -0,0 +1,9 @@
\section{Results}
\label{sec:results}
The results cover question answering and document fidelity, NPT code exposure, and the diagnostic tasks.
The depth-interval labels derive from DDR codes. Similar-interval relevance also uses hole section and formation.
Unless stated otherwise, intervals are 95\% percentile intervals from a bootstrap over whole wells.
\input{sections/06a_results_qa}
\input{sections/06b_results_labels}

View File

@@ -0,0 +1,362 @@
% Results, part A: T4 grounded QA, C4 reading fidelity, error taxonomy and EGS (RQ4).
% Input from 06_results.tex; no \section here. Numbers: paper/provenance/06a.md.
\subsection{Grounded question answering (T4)}\label{sec:res:t4}
T4 is scored on the 1,652 well-scoped questions: 1,560 ask about one wellbore and 92 compare two. The 10 field-level
questions are kept in the record (Appendix~\ref{app:record}) and left out of the headline. Accuracy is the automatic
score against the answer computed from the XML, within the tolerance of each template. It is averaged within each
of the five families (lookup 825 questions, aggregation 513, temporal event 134, comparison 92, multi-hop 88) and
then across families, so that the lookup questions do not set the result alone. Citation precision is the share of
cited DDR reports that belong to the evidence of the question. An answer counts as wrong-wellbore when it cites or
names a wellbore outside the question, or names a wellbore other than the one in the answer. DeepSeek values are
the mean of three repetitions, with the range across repetitions. Contrasts are paired within a repetition and carry
95\% well-cluster bootstrap intervals (2,000 resamples), reported for each repetition separately because the three
repetitions answer the same questions. The C4 rows use the 1,366 well-scoped questions whose evidence is printed in all
three sources (Section~\ref{sec:res:c4}); the non-C4 modes use all 1,652. Table~\ref{tab:t4main} and
Figure~\ref{fig:t4} give the results; Table~\ref{tab:contrasts} gives the paired contrasts.
\begin{table}[t]
\centering
\small
\caption{T4 results on well-scoped questions by answering mode. Accuracy is macro-family accuracy (automatic score
against the XML answer); citation precision is the share of cited reports that are evidence reports; wrong wellbore
counts predictions that name or cite a wellbore outside the question scope, or name a wellbore inconsistent with a wellbore-valued reference answer. DeepSeek: mean of three repetitions, range
in brackets. Qwen3-8B: incomplete v1 run, seed 0, C4 and RAG modes only; these cells are not used in any
comparison. Zero-shot and few-shot receive no supporting records, so we omit their citation precision.}
\label{tab:t4main}
\begin{tabular}{@{}lrlccc@{}}
\toprule
& & \multicolumn{3}{c}{DeepSeek (3 repetitions)} & Qwen3-8B \\
\cmidrule(lr){3-5}\cmidrule(l){6-6}
Mode & $n$ & Accuracy & Citation prec. & Wrong wellbore & Accuracy (incomplete) \\
\midrule
Tool-only & 1,652 & 0.712 [0.704--0.722] & 0.920 & 0.050 & -- \\
Agent & 1,652 & 0.618 [0.606--0.629] & 0.878 & 0.046 & -- \\
C4 XML & 1,366 & 0.151 [0.145--0.154] & 0.506 & 0.198 & 0.214 \\
C4 HTML & 1,366 & 0.177 [0.169--0.187] & 0.415 & 0.381 & 0.235 \\
C4 OCR & 1,366 & 0.181 [0.176--0.184] & 0.433 & 0.361 & 0.196 \\
RAG (XML) & 1,652 & 0.148 [0.145--0.151] & 0.352 & 0.299 & 0.154 \\
Few-shot & 1,652 & 0.151 [0.144--0.154] & -- & 0.079 & -- \\
Zero-shot & 1,652 & 0.071 [0.066--0.076] & -- & 0.026 & -- \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[t]
\centering
\includegraphics[width=0.9\linewidth]{t4_modes.pdf}
\caption{T4 macro-family accuracy on well-scoped questions by answering mode (DeepSeek, three repetitions). Tool-only
and agent read typed tables built from the same XML that defines the reference answers; the other modes read
retrieved text passages or no records at all.}
\label{fig:t4}
\end{figure}
\paragraph{Typed queries attain the highest observed accuracy.}
Tool-only reaches 0.712 (0.704--0.722 across repetitions) and the agent 0.618 (0.606--0.629). The best text mode,
C4 OCR, reaches 0.181, and RAG over the full XML corpus 0.148. The paired agent minus RAG difference is $+0.461$,
$+0.479$ and $+0.471$ in the three repetitions, and no interval comes closer to zero than $+0.420$. The gap is widest
on questions that combine many rows. On aggregation, tool-only scores 0.726 against 0.016 for RAG and 0.017--0.027
for C4; on multi-hop it scores 0.723 against 0.011 for RAG. An aggregate query can count events across reports even when the fixed passage budget leaves relevant records outside
the retrieval context (Section~\ref{sec:baselines}). The query tool uses keyed tables from the same XML that supplies
the SQL references. Tool-only accuracy measures query construction and interpretation under direct access to those tables.
\paragraph{The agent scores below the query-only configuration.}
The agent minus tool-only difference is $-0.116$ ($-0.172$ to $-0.063$), $-0.075$ ($-0.112$ to $-0.030$) and
$-0.089$ ($-0.171$ to $-0.024$); all three intervals exclude zero. The error classes
(Section~\ref{sec:res:errors}) place most of the loss in call failures, 0.064 of agent predictions (0.048--0.080)
against 0.004 for tool-only, and in abstentions, 0.129 against 0.083. The share of answers with the right report and
a wrong value is nearly equal (0.146 and 0.144). The agent does better on comparison questions (0.688 against
0.514) and worse on aggregation (0.451 against 0.726). Both configurations use a fixed tool-call budget. Their differences combine initial context, tool choice and prompt instructions.
\paragraph{Retrieval over the XML does not separate from answering without records.}
RAG minus zero-shot is $+0.069$ ($-0.016$ to $0.145$), $+0.084$ ($-0.008$ to $0.173$) and $+0.078$ ($-0.016$ to
$0.165$); every interval includes zero. Few-shot, which also sees no records, beats zero-shot by $+0.068$ to $+0.088$,
with intervals that exclude zero. Several answers can be guessed from the question itself, especially when it names the possible wellbores. Zero-shot accuracy comes almost
entirely from comparison questions (0.185), where the answer is one of two named wellbores, and from temporal-event
questions (0.159); on lookup, aggregation and multi-hop it is at most 0.011. The two few-shot examples, drawn from
development wells, show the answer format, and the model then picks a wellbore instead of abstaining: comparison
accuracy rises to 0.576 and the abstention share on that family falls from 0.685 to 0.029. Because the macro average
gives the 92 comparison questions one fifth of the weight, few-shot ties C4 XML at 0.151. The few-shot
fabricated-number rate (0.986) is not comparable with the evidence modes and is not interpreted. Without a context,
every wrong number counts as absent from the context by construction.
\paragraph{Text modes cite the wrong wellbore far more often than tool modes.}
The wrong-wellbore share is 0.299 for RAG, 0.381 for C4 HTML, 0.361 for C4 OCR and 0.198 for C4 XML, against 0.050
for tool-only and 0.046 for the agent. Citation precision follows the same split: 0.920 and 0.878 for the tool
modes, 0.352--0.506 for the text modes. The 26 wellbores come from 11 wells, so sidetracks share the name of their
parent well. The retriever ranks passages by lexical similarity without a wellbore filter. The query tool can filter
on the wellbore column. The effect of a wellbore filter in text retrieval remains untested.
\paragraph{The Qwen3-8B cells are not compared.}
The Qwen3-8B run under protocol v1 was stopped after seed 0, with only the C4 and RAG modes complete. Its cells in
Table~\ref{tab:t4main} (C4 XML 0.214, HTML 0.235, OCR 0.196, RAG 0.154) are shown for completeness. They come from
one seed of a different model, and we draw no ranking from them. Llama never ran
beyond a smoke test.
\paragraph{Blind judges agree with the automatic score on free-text answers.}
Under protocol v3 (Section~\ref{sec:design:protocols}), 100 free-text answers of DeepSeek repetition 0 from 10
wells, half scored correct by the automatic scorer, were judged blind by two session subagents. Sonnet, the primary
judge, reaches Cohen's $\kappa = 0.98$ with the automatic score (well bootstrap interval 0.947--1.0; raw agreement
0.99). Haiku reaches $\kappa = 0.90$ (0.826--0.966), and the two judges agree with each other at $\kappa = 0.92$
(0.833--1.0). Five items differ. In one, a sentence-form answer that contains the right wellbore name was missed by
the string scorer and accepted by both judges. In the other four, OCR answers give the rig as ``MERSK INSPIRER'' for
``M\AE RSK INSPIRER''; Haiku accepted them, while Sonnet and the scorer did not. Sonnet accepted one of the fifty sampled answers that the automatic scorer marked wrong. The judges are language
models and no person rated these answers. The $\kappa$ values measure consistency with the automatic scorer, not
agreement with people, and all T4 figures in this paper remain automatic scores.
\paragraph{An auxiliary session sample shows the same ordering of sources.}
Sonnet and Haiku, run as session subagents, answered a fixed sample of 300 T4 questions drawn over all 11 wells
(seed 20261117) in five conditions, one repetition each. Macro-family accuracy, Sonnet then Haiku, is 0.123 and 0.083
for C4 XML, 0.177 and 0.147 for C4 HTML, 0.187 and 0.150 for C4 OCR, 0.128 and 0.098 for RAG, and 0 for zero-shot.
Every zero-shot answer of both models was ``not reported'', as the answering rules require when the records do not
establish an answer; DeepSeek's zero-shot score above comes from guesses that these models did not make. Within C4,
XML is again the lowest source. With 300 questions the intervals are wide (Sonnet C4 XML 0.038--0.206). The sample
lies outside the G2 coverage, the batches held 15 questions, and the agents were not isolated from each other's
files. It uses a different question set from Table~\ref{tab:t4main}, so no ranking across models is drawn.
\begin{table}[t]
\centering
\small
\caption{Paired contrasts in T4 macro-family accuracy, well-scoped questions. Each cell gives the difference and its
95\% well-cluster bootstrap interval (2,000 resamples) for one DeepSeek repetition. ``Without date flags'' removes
the questions whose evidence report has a page where the OCR missed a date in the PDF text layer and rebuilds each
retrieval corpus. Qwen3-8B rows: incomplete v1 run, seed 0, not interpreted.}
\label{tab:contrasts}
\providecommand{\ciCell}[2]{\begin{tabular}[t]{@{}c@{}}#1\\[-1pt]{\scriptsize #2}\end{tabular}}
\begin{tabular}{@{}lrccc@{}}
\toprule
Contrast & $n$ & Repetition 0 & Repetition 1 & Repetition 2 \\
\midrule
Agent $-$ RAG & 1,652 & \ciCell{$+0.461$}{[0.420, 0.544]} & \ciCell{$+0.479$}{[0.453, 0.514]}
& \ciCell{$+0.471$}{[0.422, 0.551]} \\
Agent $-$ tool-only & 1,652 & \ciCell{$-0.116$}{[$-0.172$, $-0.063$]} & \ciCell{$-0.075$}{[$-0.112$, $-0.030$]}
& \ciCell{$-0.089$}{[$-0.171$, $-0.024$]} \\
Few-shot $-$ zero-shot & 1,652 & \ciCell{$+0.068$}{[0.052, 0.095]} & \ciCell{$+0.088$}{[0.080, 0.102]}
& \ciCell{$+0.083$}{[0.073, 0.089]} \\
RAG $-$ zero-shot & 1,652 & \ciCell{$+0.069$}{[$-0.016$, 0.145]} & \ciCell{$+0.084$}{[$-0.008$, 0.173]}
& \ciCell{$+0.078$}{[$-0.016$, 0.165]} \\
C4 OCR $-$ C4 XML & 1,366 & \ciCell{$+0.023$}{[$-0.012$, 0.067]} & \ciCell{$+0.028$}{[$-0.011$, 0.081]}
& \ciCell{$+0.038$}{[$-0.002$, 0.085]} \\
C4 OCR $-$ C4 XML, without date flags & 1,284 & \ciCell{$+0.011$}{[$-0.012$, 0.056]}
& \ciCell{$+0.016$}{[$-0.013$, 0.066]}
& \ciCell{$+0.027$}{[$-0.002$, 0.088]} \\
\midrule
\multicolumn{5}{@{}l}{\emph{Qwen3-8B, incomplete v1 run (seed 0 only)}} \\
C4 OCR $-$ C4 XML & 1,366 & \ciCell{$-0.018$}{[$-0.057$, 0.012]} & -- & -- \\
C4 OCR $-$ C4 XML, without date flags & 1,284 & \ciCell{$-0.009$}{[$-0.065$, 0.033]} & -- & -- \\
\bottomrule
\end{tabular}
\end{table}
\subsection{Document-reading fidelity (C4)}\label{sec:res:c4}
C4 asks whether the source a model reads changes T4 accuracy when the questions and the reference answers stay
fixed. It pairs 1,376 questions that are answerable from the printed version and whose evidence is present in the
XML, the HTML render and the OCR text; 1,366 of them are well-scoped. The three corpora cover the same 1,752 reports
with complete OCR, and the 7 reports with unmatched pages are dropped. Of the paired questions, 83 rely on a report
with one of the 16 pages whose OCR omitted a date found in the PDF text layer. The sensitivity analysis removes them and
rebuilds each corpus, leaving 1,293 questions (1,284 well-scoped). The C4 question set is not the T4 set in
miniature. It holds 731 lookup, 497 aggregation, 92 comparison, 27 temporal-event and 19 multi-hop questions, so the
macro average gives 19 multi-hop questions one fifth of the weight.
\begin{table}[t]
\centering
\small
\caption{Reading fidelity and its effect on T4. Panel A: full-corpus OCR (1,752 reports, 3,056 pages) against the
content of the printed HTML version; exact is the share of items read exactly. Panel B: faults of the printed version
itself, checked against the XML. Panel C: T4 macro-family accuracy by source (DeepSeek, mean of three repetitions).}
\label{tab:c4fidelity}
\begin{tabular}{@{}lrcc@{}}
\toprule
\multicolumn{4}{@{}l}{\emph{A. OCR against the printed version}} \\
Item family & Items & Exact & CER (\%) \\
\midrule
All content items & 365,698 & 0.918 & 2.40 \\
Table cells, all & 280,995 & 0.912 & 2.67 \\
\quad Operations & 140,322 & 0.861 & 2.99 \\
\quad Drilling fluid & 108,342 & 0.965 & 1.09 \\
\quad Survey station & 8,595 & 0.994 & 0.24 \\
\quad Casing, liner, tubing & 3,500 & 0.939 & 4.72 \\
\quad Bit record & 1,652 & 0.958 & 1.43 \\
Report fields, all & 54,312 & 0.928 & 3.00 \\
\quad Depth (mMD) & 1,752 & 0.924 & 6.97 \\
\quad Depth (mTVD) & 1,752 & 0.942 & 5.42 \\
\quad Plug-back depth (mMD) & 1,752 & 0.958 & 7.45 \\
\quad Rig name & 1,752 & 0.339 & 5.16 \\
Headers & 3,504 & 0.978 & 2.51 \\
Free-text summaries & 3,504 & 0.774 & 0.53 \\
\midrule
\multicolumn{4}{@{}l}{\emph{B. Printed-version faults (values in the benchmark come from the XML)}} \\
\multicolumn{4}{@{}p{0.85\linewidth}@{}}{Tight well and HPHT: XML ``N'' in all 1,759 reports, HTML prints ``Y'' in all
1,759; OCR copies the printed flag (exact 0.995 and 0.992).} \\
\multicolumn{4}{@{}p{0.85\linewidth}@{}}{Bit Record ``End mMD'': prints the start depth \texttt{bitRun\_mdHoleStart}
(16 of 16 checked rows; 90 of 90 T4 items that use the column).} \\
\midrule
\multicolumn{4}{@{}l}{\emph{C. T4 accuracy by source}} \\
Source & Questions & All & Without date flags \\
\midrule
C4 XML & 1,366 / 1,284 & 0.151 & 0.156 \\
C4 HTML & 1,366 / 1,284 & 0.177 & 0.170 \\
C4 OCR & 1,366 / 1,284 & 0.181 & 0.175 \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{Full-corpus OCR is close to the printed version on average, with errors concentrated in depths and names.}
Over 365,698 content items in 1,752 reports, OCR reads 0.918 of items exactly, with a character error rate (CER) of
2.40\% and a word error rate of 5.56\% (Table~\ref{tab:c4fidelity}). The Operations table, the largest (half of all
cells), has the lowest cell accuracy (exact 0.861, CER 2.99\%); drilling-fluid and survey cells are read
almost perfectly. Among the report fields, depths are the weakest numeric items: the measured depth has a CER of
6.97\%, the true vertical depth 5.42\% and the plug-back depth 7.45\%. The rig name is read exactly in only 0.339 of
reports. The most frequent character errors are formatting: 9,507 inserted spaces, 9,160 deleted hyphens, 7,952
hyphens read as en dashes and 2,524 inserted degree signs. The letter ``\AE'', read as ``E'' 1,152 times, occurs
almost only in the rig name ``M\AE RSK INSPIRER'' (1,378 of the 1,384 items that contain it).
Errors are uneven across reports: the median report CER is 0.93\%, the 90th percentile 4.98\% and the maximum
85.7\%, and only 9 of 1,752 reports are read without any error. Two fields with very few characters
(pressure, temperature) give unstable CERs of 50\% and 33\% and are not interpreted. All figures here are
full-corpus figures against the printed version. They measure OCR against what the page shows, not against the XML.
\paragraph{The printed version itself carries field errors that no reading of the page can repair.}
The HTML render prints ``Y'' for Tight well and HPHT in all 1,759 reports, whereas the XML holds ``N'' in all
1,759. The Bit Record ``End mMD'' column prints the start depth of the bit run, not the end depth: the value is
\texttt{bitRun\_mdHoleStart} in all 16 rows checked against the XML and in all 90 T4 items that use the column. OCR
copies the wrong flags faithfully (exact 0.995 for Tight well, 0.992 for HPHT). A model that reads these pages
correctly therefore reports a wrong value. This is why every label and answer for these fields comes from the XML
and never from a printed version (Section~\ref{sec:data}). The render was checked only for the header, the report
fields, the summaries and the Operations table, so other printed tables may carry faults we have not found.
\paragraph{The paired OCR--XML contrasts leave the accuracy difference unresolved.}
Accuracy is 0.151 with C4 XML, 0.177 with C4 HTML and 0.181 with C4 OCR. The paired OCR minus XML difference is
$+0.023$, $+0.028$ and $+0.038$ (Table~\ref{tab:contrasts}), and every interval includes zero. Without the
date-flagged questions the difference is $+0.011$, $+0.016$ and $+0.027$, again with intervals that include zero. OCR
minus HTML lies between $-0.005$ and $+0.015$, with intervals that also include zero. The part of H5 that predicts an
OCR loss on T4 is therefore not supported. The lowest point estimate is for XML, where the model abstains most often:
the abstention share is 0.678 for C4 XML against 0.535 for HTML and 0.580 for OCR. On lookup questions the gap is
largest. C4 XML answers 0.089 correctly and abstains on 0.762, while HTML and OCR both reach 0.285 and abstain on
0.448 and 0.462. Passage format and retrieval may contribute to the pattern. The comparison varies representations together with their
retrieved passages, so the cause of the abstentions remains untested. All three modes score below 0.2. The overall CER
of 2.4\% and the depth CER of about 7\% describe transcription fidelity in this corpus. HTML and OCR answers also cite a wrong wellbore about twice as often as XML
answers (0.381 and 0.361 against 0.198), a difference whose cause we did not isolate either.
\subsection{Where the answers go wrong, and whether a score without references tracks accuracy}\label{sec:res:errors}
Protocol v4 fixed the error classes and the evidence-grounding analysis before any class or score was computed
(Appendix~\ref{app:record}). Each prediction falls into exactly one class, assigned by the earliest matching rule in a
fixed order: correct, call failure, answer given to an unanswerable question, abstention, wrong wellbore, no citation,
wrong report cited (none of the cited reports is an evidence report), and right report cited but wrong value.
Shares are averaged over families and over the three DeepSeek repetitions (Table~\ref{tab:taxonomy},
Figure~\ref{fig:taxonomy}).
\begin{table}[t]
\centering
\small
\caption{Error classes by mode, T4 well-scoped questions (DeepSeek; macro over families, mean of three repetitions).
One class per prediction, earliest matching rule wins, so a wrong-wellbore answer is not counted again as a wrong
value. ``Other'' joins no citation and answers to unanswerable questions. Rows may not sum to 1 because of rounding.}
\label{tab:taxonomy}
\begin{tabular}{@{}lccccccc@{}}
\toprule
Mode & Correct & Abstained & \shortstack{Wrong\\wellbore} & \shortstack{Wrong report\\cited} &
\shortstack{Right report,\\wrong value} & \shortstack{Call\\failure} & Other \\
\midrule
C4 XML & 0.151 & 0.678 & 0.095 & 0.026 & 0.047 & 0 & 0.002 \\
C4 HTML & 0.177 & 0.535 & 0.190 & 0.025 & 0.072 & 0 & 0.001 \\
C4 OCR & 0.181 & 0.580 & 0.137 & 0.026 & 0.074 & 0 & 0.003 \\
RAG (XML) & 0.148 & 0.638 & 0.110 & 0.030 & 0.066 & 0 & 0.008 \\
Zero-shot & 0.071 & 0.891 & 0.026 & 0.012 & 0 & 0 & 0 \\
Few-shot & 0.151 & 0.739 & 0.079 & 0.009 & 0 & 0 & 0.022 \\
Tool-only & 0.712 & 0.083 & 0.049 & 0.008 & 0.144 & 0.004 & 0 \\
Agent & 0.618 & 0.129 & 0.026 & 0.014 & 0.146 & 0.064 & 0.003 \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[t]
\centering
\includegraphics[width=0.9\linewidth]{taxonomy.pdf}
\caption{Share of T4 predictions in each error class by answering mode (DeepSeek, macro over families, mean of three
repetitions; one class per prediction, earliest matching rule wins).}
\label{fig:taxonomy}
\end{figure}
\paragraph{Abstention is the main failure of every text mode.}
The model abstains on 0.678 of C4 XML predictions, 0.535 of C4 HTML, 0.580 of C4 OCR and 0.638 of RAG, and on 0.891
of zero-shot and 0.739 of few-shot predictions. Wrong wellbore comes next in the text modes (0.095--0.190). Answers
that cite the right report but give a wrong value make up only 0.047--0.074. The classes describe the outputs. An abstention alone gives no evidence about whether the model retrieved,
recognized or trusted the relevant passage. The pattern is sharpest on questions that
combine reports. On aggregation, C4 and RAG abstain on 0.69--0.71 and answer at most 0.027 correctly; on the 19 C4
multi-hop questions they abstain on 0.912--1.0. Two limits apply. The answering rules ask the model to abstain when the
records do not establish an answer, so part of the share is compliance rather than failure, and abstaining is the
safer error in a drilling report. Because abstention precedes the evidence rules, the taxonomy also cannot tell an
abstention with the evidence in context from one without it.
\paragraph{Tool modes fail mostly by citing the right report with a wrong value.}
For tool-only and the agent, this class takes 0.144 and 0.146, against 0.083 and 0.129 for abstention and 0.049 and
0.026 for wrong wellbore. On multi-hop questions it rises to 0.254 and 0.269. A citation places a reference report in the response. The taxonomy leaves query, calculation and answer-format errors
within that class unresolved. The agent's call failures
(0.064) are the one class that tool-only nearly lacks, and they account for much of the difference between the two
modes.
\paragraph{On comparison questions a wrong pick is classed as a wrong wellbore.}
The answer to a comparison question is a wellbore, so a wrong choice meets the wrong-wellbore rule. On this family
the wrong-wellbore share is 0.210--0.225 for C4, 0.214 for RAG and 0.246 for tool-only; it is 0.120 for the agent,
0.130 for zero-shot and 0.395 for few-shot. For this family, the class can record a wrong choice even if the cited evidence is in scope.
\begin{table}[t]
\centering
\small
\caption{Evidence-grounding score (EGS, adapted from \citet{lu2026tadi}) against the automatic score, T4 answerable
well-scoped predictions of DeepSeek. Panel A: accuracy at each EGS level, repetition 0, pooled over modes (micro
accuracy over predictions). Panel B: Spearman $\rho$ between EGS and correctness, mean of three repetitions with the
range; the locked H4 rule reads $\rho \geq 0.3$ as ``not supported''. Zero-shot answers all have EGS 0, so $\rho$ is
undefined.}
\label{tab:egs}
\begin{tabular}{@{}lcc@{}}
\toprule
\multicolumn{3}{@{}l}{\emph{A. Accuracy by EGS level (repetition 0, all modes)}} \\
EGS & Predictions & Accuracy \\
\midrule
0 & 6,242 & 0.013 \\
1/3 & 6,489 & 0.221 \\
2/3 & 3,211 & 0.669 \\
\midrule
\multicolumn{3}{@{}l}{\emph{B. Spearman $\rho$ (mean [range] over three repetitions)}} \\
Scope & All predictions & Without abstentions \\
\midrule
Pooled over modes & 0.536 [0.535--0.538] & 0.232 [0.231--0.234] \\
C4 HTML & 0.581 [0.575--0.587] & 0.540 [0.518--0.551] \\
C4 OCR & 0.573 [0.569--0.578] & 0.508 [0.500--0.520] \\
C4 XML & 0.338 [0.330--0.343] & 0.133 [0.128--0.139] \\
RAG (XML) & 0.346 [0.342--0.351] & 0.121 [0.115--0.130] \\
Agent & 0.327 [0.325--0.329] & 0.051 [0.049--0.054] \\
Tool-only & 0.067 [0.048--0.087] & $-0.088$ [$-0.097$ to $-0.073$] \\
Few-shot & $-0.036$ [$-0.036$ to $-0.035$] & $-0.419$ [$-0.430$ to $-0.405$] \\
Zero-shot & undefined & undefined \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{The evidence-grounding score correlates with accuracy, so H4 is not supported.}
TADI scores an answer by whether it states a measurement, names an item and cites a source, without a reference
answer \citep{lu2026tadi}. We adapted the score to the JSON answer format. One point goes to a measurement, a number
with a unit from the TADI list, and one to a citation of a DDR report that exists. The item term is 0 because no T4
answer names a section. The sum is divided by three, so EGS takes the values 0, 1/3 and 2/3. Pooled over all
answerable well-scoped predictions, Spearman's $\rho$ between EGS and the automatic score is 0.538, 0.535 and 0.535
in the three repetitions (repetition 0 interval 0.530--0.551). Under the locked rule, $\rho \geq 0.3$ in all three
repetitions means that H4, which predicted a weak correlation, is not supported. The pooled estimates include the
rebuilt date-filtered C4 runs. Accuracy rises from 0.013 at EGS 0 to
0.221 at 1/3 and 0.669 at 2/3 (Table~\ref{tab:egs}).
\paragraph{The correlation comes mostly from separating answers from abstentions.}
An abstention carries no number and usually no citation, so it scores EGS 0 and counts as incorrect. Without
abstentions the pooled $\rho$ falls to 0.233, 0.234 and 0.231 (repetition 0 interval 0.196--0.296), below the H4
threshold. Within modes, EGS keeps some signal only where the model reads printed text: $\rho$ is 0.540 for C4 HTML
and 0.508 for C4 OCR without abstentions, against 0.133 for C4 XML and 0.121 for RAG. Within tool-only, $\rho$ is
0.048--0.087 over all predictions and negative without abstentions in every repetition ($-0.073$ to $-0.097$, each
interval excluding zero). Tool-only answers that carry a unit and a citation are correct slightly less often than
those with only one of the two (0.766 against 0.787 in repetition 0). In few-shot, the 48--54 answers per repetition
that state a number with a unit and cite nothing are all wrong. EGS checks the form of an answer, not its truth: a
number with a unit and a real report reaches 2/3 whatever the value. It can screen out abstentions and bare answers.
It does not rank answers that already have that form, which is the case for the strongest modes. The Qwen3-8B
incomplete run gives a pooled $\rho$ of 0.331 (0.295--0.372); it is not compared.

View File

@@ -0,0 +1,361 @@
% Second half of Sec. 6. Every number is traced in paper/provenance/06b.md.
% Primary values are those of subset "all" in outputs/m34/classification.csv (see the provenance note on plan Sec. 1.6).
\subsection{Code leakage in NPT recognition (T1--T3)}
\label{sec:res:leak}
All scores in this subsection are for models trained and tested with leave-one-well-out splits over the 11 wells
(Section~\ref{sec:design:splits}). T2 has 23,447 activities. Under definition (b), the share of NPT activities is 0.183,
which is also the average precision (AP) of the majority baseline. \emph{Masked} input hides the three fields from which
the label is built (\texttt{proprietaryCode}, \texttt{stateDetailActivity} and \texttt{state};
Section~\ref{sec:design:labels}). The model then sees the activity comment and the comments of the neighbouring
activities. \emph{Unmasked} input shows those fields as text. Table~\ref{tab:leakage} and Fig.~\ref{fig:leakage}
collect the results.
\paragraph{With codes masked, the text still carries part of the NPT coding, and DistilBERT recovers the most.}
On T2(b), the fine-tuned DistilBERT reached an AP of 0.579--0.603 over three seeds. TF-IDF with logistic regression
reached 0.463 (95\% CI 0.418--0.513), the keyword lexicon 0.251 and the majority baseline 0.183. The comment-length
baseline (0.162) did not exceed the prevalence, so the length of a comment alone does not mark NPT. The interval of every
DistilBERT seed lies above that of TF-IDF; the lowest lower limit is 0.554 against an upper limit of 0.513. The protocol
did not fix a paired contrast between the two models, so we attach no interval to their difference.
\paragraph{Showing the codes almost reproduces the label, so H2 is supported on T2.}
With codes shown, TF-IDF reached an AP of 0.995 (0.991--0.999). The paired difference, unmasked minus masked, was
$+0.531$ (0.480--0.580). For DistilBERT the difference was $+0.266$ to $+0.291$ over the three seeds, and each interval
excluded zero. H2 predicted that showing the codes would raise the scores. The size of the rise matters more than its
sign. The label is a deterministic function of the unmasked fields, and a linear model over word counts learns that
function almost perfectly. The unmasked score is dominated by access to the fields used to construct the label. DistilBERT gained less and stayed at 0.869--0.880 with codes shown. We did not test why it
uses the code tokens less well than the linear model.
\paragraph{The paired DeepSeek comparison leaves its difference from TF-IDF unresolved.}
DeepSeek (the hosted DeepSeek-V4.1-Flash model, three repetitions) reached an AP of 0.406--0.408 with codes masked. Its
paired difference to TF-IDF was $-0.055$ to $-0.058$, and the interval contained zero in each repetition (for example
$-0.134$ to $0.011$ in repetition 0). Qwen3-8B, an incomplete run reported as such, scored 0.264 on seed~0. That is $0.200$
below TF-IDF ($-0.250$ to $-0.152$). Its second seed was stopped at 17,827 of 23,447 activities and is not scored. H1
expected no clear advantage of a zero-shot model over TF-IDF once codes are masked. The data agree, and every DeepSeek
point estimate lies below TF-IDF, although that difference is not resolved. A zero-shot model never sees the convention by
which the supervisors coded these reports, whereas the supervised baselines learn it from the training wells. This is one
plausible reason for the gap; we did not test it. The point estimates spread from 0.406 to 0.408 across the three repetitions.
\paragraph{Grouping by wellbore instead of well raised the learned scores slightly, and no difference is resolved.}
When the folds held out wellbores instead of wells, DistilBERT reached 0.612--0.624 on T2(b) with codes masked. The paired
difference to the well split was $+0.015$ to $+0.040$, and every interval contained zero. TF-IDF rose to 0.489, a
difference of $+0.026$ ($-0.001$ to $0.042$). The majority and lexicon scores were unchanged under the wellbore split. All learned point estimates are positive. This is consistent with sidetracks of one well sharing wording
and context across folds (Section~\ref{sec:design:splits}), but with 26 wellbores in 11 wells the effect could not be
resolved. It is also an order of magnitude smaller than the effect of showing the codes. The well split remains primary.
\paragraph{The same pattern holds under definition (a), without sidetrack rows and with OCR input.}
Under definition (a), the majority AP is 0.153. With codes masked, TF-IDF reached 0.437, DistilBERT 0.552--0.578 and
DeepSeek 0.389--0.391. Showing the codes added $+0.563$ for TF-IDF and $+0.298$ to $+0.337$ for DistilBERT. For TF-IDF
the difference between the definitions, (b) minus (a), was $+0.026$ ($-0.003$ to $0.068$). The 202 activities coded as
sidetrack were removed in a sensitivity run, leaving 23,245. On that set TF-IDF scored 0.457, DistilBERT 0.589--0.611 and
DeepSeek 0.401--0.404. TF-IDF trained and tested on the OCR text of 23,387 activities reached 0.464, the same as on XML
text. For this baseline, the OCR errors measured in Section~\ref{sec:data} do not change T2. Section~\ref{sec:res:c4}
reports the corresponding comparison for T4.
\paragraph{Hole sections can be learned on days with a published hole size, not on filled days.}
T1 has 932 drilling days: 672 with a hole size published in the report and 260 whose section was filled forward from an
earlier day. On published days, TF-IDF reached an accuracy of 0.621 (0.504--0.742) against 0.286 for the majority
section. On filled days it reached 0.819 against 0.815 for the majority. A filled label mostly continues the section in
progress, so the majority baseline already predicts it and the text adds nothing. DistilBERT was below TF-IDF on published
days (0.301--0.369) and close to the majority on filled days (0.754--0.808); we did not investigate why. The LLM raters
show the same split (Section~\ref{sec:res:labels}): their median $\kappa$ with the section label was 0.707 on published
days and 0.059 on filled days. TF-IDF on OCR text reached 0.625 on published days. Published sections therefore support
the T4 analyses. Filled sections stay a convenience label whose accuracy on days without a published hole size is unknown.
\begin{table}[t]
\centering
\caption{Code leakage in NPT recognition, definition (b), leave-one-well-out. AP: average precision of the pooled
out-of-fold predictions. Masked: activity codes hidden from the model input; unmasked: codes shown. Single values are one
run with its 95\% well-cluster bootstrap interval in brackets. DistilBERT (three seeds) and DeepSeek (three repetitions)
are given as the mean, with the range of the runs in parentheses. $\Delta$: unmasked minus masked, paired on the same
folds; for DistilBERT, the range of the three per-seed differences, all of whose intervals exclude zero on T2 and include
zero on T3. Qwen3-8B is an incomplete run (seed 0 only). n.r.: not run.}
\label{tab:leakage}
\footnotesize
\begin{tabular}{llll}
\toprule
Method & masked & unmasked & $\Delta$ \\
\midrule
\multicolumn{4}{l}{\emph{T2(b): NPT activity, 23,447 activities}} \\
Majority (prevalence) & 0.183 & n.r. & n.r. \\
Comment length & 0.162 & n.r. & n.r. \\
Lexicon & 0.251 & n.r. & n.r. \\
TF-IDF + logistic & 0.463 [0.418, 0.513] & 0.995 [0.991, 0.999] & $+0.531$ [0.480, 0.580] \\
DistilBERT & 0.593 (0.579--0.603) & 0.873 (0.869--0.880) & $+0.266$ to $+0.291$ \\
DeepSeek zero-shot & 0.407 (0.406--0.408) & n.r. & n.r. \\
Qwen3-8B (incomplete) & 0.264 [0.206, 0.340] & n.r. & n.r. \\
\midrule
\multicolumn{4}{l}{\emph{T3(b): NPT depth cell, 4,894 cells}} \\
Majority (prevalence) & 0.1136 & n.r. & n.r. \\
TF-IDF + logistic & 0.1225 [0.093, 0.195] & 0.1273 & $+0.0048$ [$-0.0005$, 0.0238] \\
DistilBERT & 0.1212 (0.1175--0.1245) & 0.1235 (0.1189--0.1312) & $-0.0011$ to $+0.0066$ \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[t]
\centering
\includegraphics[width=0.9\linewidth]{leakage.pdf}
\caption{Code leakage, definition (b), leave-one-well-out. (a) T2 NPT activity and (b) T3 NPT depth cell: average
precision of TF-IDF + logistic and DistilBERT with activity codes masked (hatched) and shown (filled). Points are single
runs or seeds with their 95\% well-cluster bootstrap intervals. The text above each pair gives the paired difference,
unmasked minus masked. Horizontal lines: majority baseline (equal to the prevalence) and, in (a), the lexicon baseline.}
\label{fig:leakage}
\end{figure}
\subsection{Depth intervals and similar-interval retrieval (T3, T5)}
\label{sec:res:diag}
\paragraph{T3 stays near chance whether or not the codes are shown, so H2 is not supported on T3.}
T3 asks which 10\,m depth cells of the own hole contain an NPT interval. It covers 4,894 cells on 21 wellbores with
WITSML logs in 10 wells, and 556 of them are positive under definition (b), a prevalence of 0.114. With codes masked,
TF-IDF reached an AP of 0.1225 (0.093--0.195) and DistilBERT 0.1175--0.1245, against 0.1136 for the majority baseline
(Table~\ref{tab:leakage}). The interval intersection over union was 0.119 for TF-IDF and 0.108--0.124 for DistilBERT.
Showing the codes changed the AP of TF-IDF by $+0.0048$ ($-0.0005$ to $0.0238$) and that of DistilBERT by $-0.0011$ to
$+0.0066$, with every interval containing zero. Only the intersection over union of TF-IDF rose by an interval that
excludes zero, and only by 0.017 (0.0003--0.061). T3 inputs are restricted to the record before each cell
(Section~\ref{sec:design:splits}), so the codes that define a positive cell never reach the model. The near-zero effect of
unmasking is consistent with earlier codes saying little about where the next NPT interval will fall. The comparison leaves the magnitude of any AP effect unresolved. Under the wellbore split, TF-IDF reached 0.141, a difference of $+0.019$ ($-0.033$ to $0.043$).
\paragraph{Depth neighbours give the higher forecast AP.}
We scored each cell by the mean label of its 10 nearest cells in measured depth, taken from the other wells. This gave an
AP of 0.150 (0.116--0.204) against a prevalence of 0.114. Adding the WITSML summaries of hook load, rate of penetration,
rotary speed and standpipe pressure lowered it to 0.135 (0.110--0.183). Under definition (a) the two values were 0.132 and
0.120, against a prevalence of 0.098. These comparisons suggest some depth dependence in the labels. The run with WITSML summaries has a lower point estimate. Section~\ref{sec:res:planted} puts a scale on how weak the hazard is.
\paragraph{T5 asks whether an interval can be matched to similar intervals elsewhere in the field.}
The 410 queries are own-hole NPT (b) intervals with a known hole section and formation, on 19 wellbores in 10 wells. The
candidates for each query are the intervals of the other wells (a median of 358). A candidate earns one point each for the
same section, the same formation and a shared NPT cause, so its gain runs from 0 to 3. No representation reads codes,
causes, labels, sections or formations. The protocol (v5) was locked before any retrieval score was computed.
\paragraph{Depth is the strongest individual representation.}
Ranking candidates by the difference in measured depth gave an nDCG@10 of 0.666 (0.644--0.685), against 0.463 for a
random order (Table~\ref{tab:t5}). Reciprocal rank fusion of depth, the 24\,h of WITSML before the event and the masked
text of the 24\,h before it reached 0.670. Its paired difference to depth was $+0.004$ ($-0.010$ to $0.018$). The
pre-event text alone reached 0.611, which is 0.055 below depth ($-0.063$ to $-0.048$). The pre-event WITSML summaries
reached 0.495, only 0.032 above random (0.008--0.053). The text of the event itself, a description view rather than a
forecast, reached 0.528. The conclusions did not change under definition (a), where depth reached 0.660 and fusion
differed from it by $+0.005$ ($-0.012$ to $0.022$). Pooling candidates by wellbore instead of well gave 0.663 and $+0.003$
($-0.012$ to $0.016$).
\paragraph{Depth retrieves more intervals from the same formation.}
Within a single field, the hole section and the formation are both functions of depth. Depth put a candidate from the
same formation in 71\% of the top-10 slots, against 23\% for a random order. The masked pre-event text named hole sizes
often enough to place the same section in 58\% of the slots, more than depth (45\%). The share of top-10 candidates
that share a cause with the query barely moved, from 0.70 for a random order to at most 0.75. On this corpus T5
therefore rewards stratigraphic position. None of the baselines retrieves intervals with a similar cause much better than
chance. T5 lies outside the G2 coverage rule and stays a diagnostic.
\begin{table}[t]
\centering
\caption{T5 similar-interval retrieval, definition (b), candidates from the other wells (410 queries). nDCG@10 with
linear gain (same section, same formation, shared cause; 0--3) and its 95\% well-cluster bootstrap interval. $\Delta$:
paired difference to depth. MRR: reciprocal rank of the highest-ranked fully relevant candidate (374 queries have one). P@10: share
of fully relevant candidates in the top 10. The last three columns: share of the top 10 with the same section, the same
formation and an overlapping cause (descriptive). Fusion uses reciprocal rank fusion with $k = 60$.}
\label{tab:t5}
\footnotesize
\setlength{\tabcolsep}{2pt}
\begin{tabular}{lccccccc}
\toprule
Representation & nDCG@10 & $\Delta$ vs depth & MRR & P@10 & section & formation & cause \\
\midrule
Random order & 0.463 [0.444, 0.478] & $-0.203$ [$-0.228$, $-0.184$] & 0.161 & 0.052 & 0.369 & 0.234 & 0.703 \\
Depth & 0.666 [0.644, 0.685] & reference & 0.397 & 0.194 & 0.451 & 0.711 & 0.708 \\
WITSML, 24\,h before & 0.495 [0.462, 0.527] & $-0.171$ [$-0.209$, $-0.136$] & 0.219 & 0.086 & 0.418 & 0.270 & 0.720 \\
Text, 24\,h before & 0.611 [0.590, 0.630] & $-0.055$ [$-0.063$, $-0.048$] & 0.379 & 0.166 & 0.576 & 0.371 & 0.746 \\
Text of the event & 0.528 [0.506, 0.544] & $-0.138$ [$-0.163$, $-0.118$] & 0.271 & 0.109 & 0.405 & 0.301 & 0.754 \\
Fusion, pre-event & 0.670 [0.653, 0.687] & $+0.004$ [$-0.010$, 0.018] & 0.435 & 0.221 & 0.560 & 0.566 & 0.737 \\
Fusion, all four & 0.661 [0.638, 0.680] & $-0.005$ [$-0.024$, 0.009] & 0.434 & 0.217 & 0.546 & 0.540 & 0.746 \\
\bottomrule
\end{tabular}
\end{table}
\subsection{How far the labels can be trusted without a human rater}
\label{sec:res:labels}
No human rated any item. Every label is computed from the XML by code (Section~\ref{sec:design:labels}). What can be
checked is whether readers of the masked text agree with that code. We used blind LLM raters for this
(Section~\ref{sec:design:validation}). A trial of 100 masked activities was rated by Sonnet, Opus and Haiku. The main
sample (M2) drew 300 masked activities from all 11 wells in 225 strata, excluding the trial items, and 90 T1 days (45
published, 45 filled). Qwen3-8B, Gemma~3 12B and Ministral~3 8B rated it twice on the same day. Agreement is Cohen's
$\kappa$ against the code label, weighted by the inverse selection probability (Table~\ref{tab:labelkappa}).
\begin{table}[t]
\centering
\caption{Agreement of blind LLM raters with the code labels: Cohen's $\kappa$ weighted by inverse selection probability,
per rater and median; Fleiss' $\kappa$ between the three raters. Trial: 100 masked activities (operation class: 65 items;
Haiku left 2 items unrated). M2: 300 masked activities (operation class: 195) and 90 T1 days; pass 2 is a same-day repeat
on the same items. H3 required $\kappa \ge 0.6$ for binary NPT.}
\label{tab:labelkappa}
\footnotesize
\setlength{\tabcolsep}{1.5pt}
\begin{tabular}{lcccccccccc}
\toprule
& \multicolumn{4}{c}{Trial (Sonnet, Opus, Haiku)} & \multicolumn{4}{c}{M2 pass 1 (Qwen, Gemma, Ministral)}
& M2 pass 2 & Fleiss \\
\cmidrule(lr){2-5}\cmidrule(lr){6-9}
Target & S & O & H & median & Q & G & M & median & median & trial / M2 \\
\midrule
NPT (a) & 0.553 & 0.584 & 0.529 & 0.553 & 0.108 & 0.258 & 0.258 & 0.258 & 0.242 & \multirow{2}{*}{0.662 / 0.512} \\
NPT (b) & 0.564 & 0.683 & 0.574 & 0.574 & 0.129 & 0.283 & 0.292 & 0.283 & 0.283 & \\
Cause (a) & 0.476 & 0.448 & 0.456 & 0.456 & 0.092 & 0.220 & 0.220 & 0.220 & 0.200 & \multirow{2}{*}{0.644 / 0.392} \\
Cause (b) & 0.487 & 0.524 & 0.469 & 0.487 & 0.105 & 0.228 & 0.239 & 0.228 & 0.229 & \\
Operation class & 0.434 & 0.624 & 0.389 & 0.434 & 0.162 & 0.175 & 0.211 & 0.175 & 0.169 & 0.662 / 0.255 \\
Section, published & n.r. & n.r. & n.r. & n.r. & 0.556 & 0.707 & 0.721 & 0.707 & 0.629 & \multirow{2}{*}{n.r. / 0.480} \\
Section, filled & n.r. & n.r. & n.r. & n.r. & 0.067 & 0.054 & 0.059 & 0.059 & 0.049 & \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{Agreement with the code remains below the H3 threshold.}
In the trial, the median $\kappa$ for NPT was 0.553 under definition (a) and 0.574 under (b). Only Opus exceeded 0.6, with
0.683 on (b). In M2 pass 1, the medians were 0.258 and 0.283. Gemma and Ministral reached 0.258--0.292, and Qwen
only 0.108--0.129. Agreement on cause groups and operation classes was lower still, with M2 medians of 0.220--0.228 and
0.175. H3 required a $\kappa$ of at least 0.6 for binary NPT, and neither sample met it. The two samples differ in both
items and raters, so the gap between 0.574 and 0.283 mixes model size with sample composition. We did not separate the
two.
\paragraph{The raters agree with each other more than with the code, and their answers are stable.}
Fleiss' $\kappa$ for NPT between the three raters was 0.662 in the trial and 0.512 in M2 (0.528 in pass 2),
higher in each sample than the median agreement with the code. Pass 2 started 25.6--29.2 minutes after pass 1 ended.
Each model's agreement with its own pass-1 answers was 0.912 for Qwen, 0.9999 for Gemma and 0.824 for Ministral, and
the median agreement with code (b) stayed at 0.283. The low agreement with the code is therefore not random noise in the
raters. It is systematic: the raters read the activity text differently from the way the code accounts for it. Two
caveats limit what follows from this. The raters share training data and reading conventions with each other and with the
LLM baselines, so their mutual agreement is evidence of a common reading, not of a correct one. A same-day repeat also
measures only short-term stability.
\paragraph{The disagreement runs in both directions.}
Weighted by selection probability, the M2 raters in pass 2 would call 23.0--49.3\% of activities NPT. The code (b)
marks 18.1\% of the 23,347 activities that remain after the trial items are excluded. Qwen called the most, nearly half.
In pass 2, all three raters agreed in calling 22 of the 150 code-negative items NPT and 34 of the 150 code-positive items
not NPT. Item A062 describes a failed pressure test that the code marks as not NPT. Item A157
carries a sidetrack code while its comment describes running the string in hole. A code can reflect how the supervisor
booked a whole phase of work, whereas a rater judges the single line. Eight sampled waiting activities sit outside the
interruption codes and are negative under (b); four to seven of them were rated NPT, depending on the rater. Without a
human rater we cannot say which reading is right.
\paragraph{Gate G1 chose definition (b) by a narrow margin that is fragile.}
The locked rule selects (b) when its median $\kappa$ in pass 1 exceeds that of (a) by at least 0.02. The
difference was 0.025, so (b) became the primary definition. Exploratory checks show how thin that margin is. Dropping one
well at a time gave differences of 0.015--0.037, and 10 of the 11 deletions kept the margin. Without selection weights the
difference was 0.019, below the margin. A bootstrap over the 11 wells gave a 95\% interval of $-0.0095$ to $0.0741$. The
sample has one item in 185 of its 225 strata, and its Kish effective size is about 126 before any dependence within wells
is considered. We therefore report definition (a) as a sensitivity analysis throughout. Neither T2 nor T3 changes its
conclusion between the definitions (Section~\ref{sec:res:leak}).
\paragraph{No class met the thresholds for a separate score.}
A class is scored on its own only if its median $\kappa$ reaches 0.60 with at least 20 rated items and at least 3 wells
of 5 items each (Section~\ref{sec:design:validation}). The 12\textonequarter-inch section reached a $\kappa$ of 0.701, but
with 18 rated items. The \texttt{drill\_ream} operation class reached 0.655 with 15 items. The equipment cause group had
enough items (62) but a $\kappa$ of only 0.277. The pooled downhole group reached 0.173 with 20 items, and the failed-operation
group 0.009 with 25. No per-class score is reported. Cause and operation scores appear only as pooled diagnostics.
\paragraph{The external cross-checks confirm the parsing, not the labels.}
DrillScribe \citep{paul2026drillscribe} rebuilds an NPT ledger from the same Volve reports. All 1,758 of its episodes
matched ours over the 23,447 activities. Both are built from \texttt{stateDetailActivity}, so the match confirms our
parsing and episode grouping; it is not an independent NPT label. The text rules of the Anatoly5ms repository
\citep{grigorovich2026complication} marked 219 of the 4,894 T3 cells with strong or weak matches. Of the 556 cells
positive under (b), 83 were among them (Jaccard index 0.120); under (a) the overlap was 72 of 478 (0.115). With strong
matches only, the overlaps fell to 36 and 34. The rules look for four kinds of complication while T3 counts every NPT
interval, so a low overlap is expected and says little about either set. The TSPP set \citep{cao2024tspp,cao2023tsppdata}
gives three stuck-pipe events on wells 15/9-F-4, 15/9-F-9~A and 15/9-F-1. Windows of $\pm 3$\,h around them, assuming
UTC, contain 9, 14 and 15 DDR activities and no stuck-equipment code. The F-4 window has three activities coded as
equipment failure and the F-9~A window one. Either the reports booked these events under other codes or the clocks
differ. We did not resolve which.
\paragraph{What this does and does not establish.}
The labels are a reproducible function of the XML, and an independent rebuild from the same fields agrees with them.
Blind LLM raters of the masked text agree with the labels to a limited but stable degree, and they disagree in a
systematic way. None of this shows that the DDR codes mark real NPT. T2, T3 and T5 scores therefore measure how well a
model reproduces the DDR coding, and the paper treats them as diagnostics. The next subsection asks a narrower question
that does not depend on the codes being right.
\subsection{What a planted signal tells us about the pipeline}
\label{sec:res:planted}
H3 was not met, and the real T2 and T3 labels are derived from codes. The real scores therefore cannot show whether the
pipeline would find a signal that is known to be present. Protocol v6, locked before any planted score was computed
(Appendix~\ref{app:record}), addresses this. It draws labels at random, so they are known exactly, and writes a signal of
known strength into the model input. For T2, labels are drawn at the real prevalence of 0.183. A fixed cue phrase is
appended to the comment of a fraction $c$ of the planted NPT rows (the cue fraction) and of a fraction $f$ of the other
rows (the decoy rate). The same TF-IDF + logistic baseline then runs with leave-one-well-out splits. For T3, cell labels
are drawn with log-odds that rise by $s$ per standard deviation of measured depth (the signal strength). They are
forecast from the 10 nearest cells by depth in the other wells, as in Section~\ref{sec:res:diag}. Each setting ran with
five seeds. Real labels are not used, and the study has no gate.
\paragraph{Two of the three null checks passed; the check for T2 at $f = 0.10$ failed, and that setting is not interpreted.}
At the locked null settings ($c = 0$ or $s = 0$), the mean AP must lie within 0.01 of the prevalence, and the seed-0 interval must
contain it. For T2 at $f = 0.02$ the mean AP was 0.182 against 0.183, and for T3 it was 0.118 against 0.114; both passed
(Table~\ref{tab:planted}). For T2 at $f = 0.10$ the mean AP was 0.193, 0.0101 above the prevalence and just outside the
tolerance. Its seed-0 interval, 0.193--0.208, excluded the prevalence. Under the locked rule this setting fails. Its
curve is not interpreted, and the verdict stands.
\paragraph{A post hoc diagnosis, not part of protocol v6, traces the failure to the definition of the null.}
On 23 November we examined the failure. At $c = 0 < f$, no planted row carries the cue while a share $f$ of the other
rows do. The absence of the cue is then itself a signal of a planted row. A score that only flags rows without the cue
gave an AP of 0.200 at $f = 0.10$, against 0.199 expected in theory. At $f = 0.02$ it gave 0.185 (0.186 expected), and
the model reached 0.193 and 0.182. The setting with no information is $c = f$. At $c = f = 0.10$ the model reached 0.182
(seed-0 interval 0.176--0.188), which would pass the check. The cue rates explain why the original check still contained information about the planted class. A planted null must give the cue at the same rate in both classes. Using the $f = 0.10$ curve
would require a new locked protocol with the null at $c = f$.
\begin{table}[t]
\centering
\caption{Planted-signal study (protocol v6, 5 seeds). Upper part: null checks; a check passes if the mean AP lies within
0.01 of the prevalence $\pi$ and the seed-0 95\% well-cluster interval contains $\pi$. The last row is a post hoc
diagnosis (23 November) that is not part of protocol v6. Lower part: the planted strength at which the planted curve
reaches the real score, by linear interpolation of the mean curve; the range is that of the five per-seed values.}
\label{tab:planted}
\footnotesize
\begin{tabular}{llcccl}
\toprule
Task & Setting & mean AP & $\pi$ & seed-0 interval & Result \\
\midrule
T2 & $c = 0$, $f = 0.02$ & 0.182 & 0.183 & 0.179--0.195 & passed \\
T2 & $c = 0$, $f = 0.10$ & 0.193 & 0.183 & 0.193--0.208 & \textbf{failed}; not interpreted \\
T3 & $s = 0$ & 0.118 & 0.114 & 0.107--0.124 & passed \\
T2 & $c = f = 0.10$ (post hoc) & 0.182 & 0.183 & 0.176--0.188 & would pass; outside v6 \\
\midrule
& & real score & & planted strength & \\
\cmidrule(lr){3-3}\cmidrule(lr){5-5}
T2 & masked TF-IDF AP, $f = 0.02$ & 0.463 & & $c \approx 0.82$ (0.785--0.840) & \\
T3 & depth-neighbour AP & 0.150 & & $s \approx 0.66$ (0.554--0.716) & oracle AP $\approx 0.21$ \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{The real T2 score matches a planted cue rate of about 82\%.}
At $f = 0.02$, the AP rose monotonically with the cue fraction, from 0.182 at $c = 0$ through 0.258 at $c = 0.25$ and
0.363 at $c = 0.5$ to 0.521 at $c = 1$ (Fig.~\ref{fig:planted}a). The real masked TF-IDF score of 0.463 is reached at
$c \approx 0.82$, with a range of 0.785--0.840 over the seeds. Put plainly, for TF-IDF to reach its real score through one
explicit phrase, about four in five NPT rows would need to carry it. Even at $c = 1$ the AP is 0.521, not 1. The text
fed to the model joins each comment with those of the neighbouring activities, so the cue spills into other rows. At
$c = 1$, 34.7\% of the rows without a planted label see the cue somewhere in their input. Cue spill could raise the cue rate needed to match the real score. The calibration did not isolate the size of that effect.
\paragraph{The real T3 score corresponds to a very weak depth hazard.}
The depth-neighbour forecast rose from an AP of 0.118 at $s = 0$ to 0.131 at $s = 0.5$, 0.191 at $s = 1$ and 0.379 at
$s = 2$ (Fig.~\ref{fig:planted}b). An oracle that knows the true planted hazard reached 0.176, 0.283 and 0.489 at the same
strengths. The real forecast AP of 0.150 is reached at $s \approx 0.66$ (0.554--0.716 over the seeds). At that strength
even the oracle would reach an AP of only about 0.21. Under that planted depth model, even exact knowledge of the hazard gives limited discrimination. This provides a
scale against which to interpret the T3 scores of Section~\ref{sec:res:diag}.
\paragraph{The calibration quantifies detectability under the planted mechanisms.}
Three limits apply. The cue is one artificial phrase, whereas real NPT text holds many partial and varied cues. The
value of $c$ measures the strength of that one simulated cue. The fraction of real NPT rows with an explicit cue is unknown.
Planted labels are independent across rows and cells. The ranges over seeds omit the event and well dependencies in real NPT. What the study shows is
that the pipeline finds a planted signal of known strength and returns the prevalence when there is none, once the null
is defined correctly. It says nothing about whether the DDR codes mark real NPT.
\begin{figure}[t]
\centering
\includegraphics[width=0.9\linewidth]{planted.pdf}
\caption{Planted-signal study (protocol v6, 5 seeds, range shaded), leave-one-well-out. (a) T2: average precision of
TF-IDF + logistic against the cue fraction $c$ at decoy rate $f = 0.02$. (b) T3: average precision of the depth-neighbour
forecast and of an oracle that knows the true hazard, against the signal strength $s$ (log-odds per standard deviation of
measured depth). Dashed lines: prevalence. Dotted lines: the real scores (masked TF-IDF on T2, depth-neighbour forecast on
T3). The vertical line and band mark the planted strength that matches the real score and its range over seeds.}
\label{fig:planted}
\end{figure}

View File

@@ -0,0 +1,76 @@
\section{Discussion}
\label{sec:discussion}
\paragraph{What held.}
Code exposure had the largest effect on the activity classifier. It raised T2~(b) average precision from 0.463
to 0.995 for TF-IDF and by 0.266 to 0.291 for DistilBERT, with confidence intervals excluding zero
(Section~\ref{sec:res:leak}). For question answering, typed queries over the XML-derived tables gave the highest
accuracy, 0.712. The agent reached 0.618, retrieval reached 0.148 and the question alone reached 0.071
(Section~\ref{sec:res:t4}). The report comparison also found conflicting values in two flags in all 1,759 HTML
reports. OCR evaluated against HTML can preserve such errors (Section~\ref{sec:res:c4}).
\paragraph{What the NPT scores measure.}
T2 measures recovery of the DDR coding. With codes masked, DistilBERT reached 0.579 to 0.603, TF-IDF reached
0.463 and the prevalence was 0.183. The planted-cue study matched the TF-IDF score at a cue rate of about
82\% among planted positives (range 0.78 to 0.84 across seeds). This calibration describes the strength of one
simulated cue. The frequency and diversity of cues in real comments remain unknown.
Only 50.3\% of NPT~(b) activities can be placed in depth. Masked T3 AP stayed near the prevalence of 0.114,
while the depth-neighbour forecast matched a planted hazard of strength 0.66. The oracle AP was about 0.21
under that particular hazard (Section~\ref{sec:res:planted}).
\paragraph{What the question-answering scores measure.}
The tool modes query the XML-derived tables that supplied the reference answers. Their scores measure how well
the model constructs queries and interprets the returned values under direct table access. C4 measures the
combined effect of the document representation, passage retrieval and answer generation. C4 accuracy was
0.151 to 0.181, close to RAG at 0.148. Abstention accounted for 0.535 to 0.678 of the text-retrieval predictions.
The retriever had no wellbore filter, so the effect of restricting retrieval to the requested wellbore remains
an open question.
\paragraph{Which comparisons were unresolved.}
The paired intervals for DeepSeek versus TF-IDF on T2, OCR versus XML on T4, and reciprocal-rank fusion versus
depth on T5 all spanned zero. Table~\ref{tab:lessons} also records the agreement threshold that the language-model
raters fell short of and the null check that failed at the larger decoy rate.
\begin{table}[!htbp]
\centering
\caption{Hypotheses and tests that were not supported or were limited, with the evidence for the cause and the lesson. Causes marked $^\ast$ are consistent with the evidence but were not tested directly.}
\label{tab:lessons}
\small
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.17\linewidth}>{\raggedright\arraybackslash}p{0.22\linewidth}>{\raggedright\arraybackslash}p{0.30\linewidth}>{\raggedright\arraybackslash}p{0.26\linewidth}@{}}
\toprule
Test & Outcome & Cause & Lesson \\
\midrule
H1: LLM zero-shot against TF-IDF, T2~(b) masked & DeepSeek $-0.055$ to $-0.058$, intervals include 0; Qwen3-8B $-0.200$ (incomplete run) & Not tested$^\ast$; the prompt gave no examples and the label is a coding convention & Do not expect a general model to infer a coding convention it was not shown \\
H2 on T3 & Unmasking changed AP by $+0.0048$, interval $-0.0005$ to $0.0238$ & Masked T3 stays near prevalence (0.1225 against 0.114) & Report the observed change alongside the prevalence \\
H3: rater agreement with the code & Median weighted $\kappa$ 0.283 for NPT~(b), target 0.6; no class qualified & Raters judge the activity as described; the code can reflect how the DDR booked a whole phase (Section~\ref{sec:res:labels}) & Treat agreement as consistency of one reading, and release the disagreements \\
H4: evidence score against accuracy & Spearman 0.535 to 0.538, not weak & Mostly the split between answered and abstained questions: 0.23 without abstentions, 0.07 within tool-only & Do not use an evidence score as a proxy for accuracy \\
H5: T4 component of OCR sensitivity & OCR minus XML $+0.023$ to $+0.038$, intervals include 0 & Lookup abstention is more frequent for XML (0.762) than for HTML (0.448) or OCR (0.462); the mechanism is untested & Measure OCR at a level where retrieval does not dominate the errors \\
Agent against tool-only & $-0.075$ to $-0.116$ & Call failures reached 6.4\%; contributions of prompt and context were not isolated & Report failed calls separately \\
T5 representations & Paired intervals include zero; best $+0.004$, interval $-0.010$ to $0.018$ & Section and formation both follow depth in one field & Include a depth baseline in any similar-interval retrieval \\
Planted-signal null, T2 $f = 0.10$ & AP 0.193 against 0.183, off by 0.0101 & The null was defined at $c = 0 < f$, where the absence of a cue is itself a signal (post hoc) & Define the null as $c = f$; a new locked protocol would be needed \\
T1 section on filled days & Rater agreement 0.059 against 0.707 on published days & Filled labels use a carry-forward rule with a leading-fill fallback & Use published days for claims about the section \\
Qwen3-8B and Llama baselines & Stopped; Llama ran a smoke test only & Decision of the project owner (Appendix~\ref{app:record}) & Report the incomplete run as such \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{Limits of the label validation.}
No human rater was available. The three raters are language models that may share training data or conventions with the baselines they help to evaluate, so agreement between them (Fleiss $\kappa$ about 0.5 to 0.66) shows consistency of one reading, not correctness. The cross-checks are weaker than they look. Our parser reproduces all 1,758 DrillScribe episode keys, but both derive NPT from the same field, so that check validates the parser and not the label. The Anatoly5ms text rules marked 219 of 4,894 T3 cells, with 72 overlapping NPT~(a) and 83 overlapping NPT~(b), and they cover four trouble groups only. The three TSPP scenarios contain no stuck-equipment code in the DDR, and three cases support no statistic. Rater agreement falls to 0.059 on filled sections. Selecting NPT~(b) rested on a margin of 0.025, and one of eleven well deletions took it below the selection threshold.
\paragraph{Practical implications for DDR benchmarks.}
Report masked and exposed inputs alongside average precision and prevalence. Group folds by well because sibling
wellbores can share dates and inherited hole intervals (Section~\ref{sec:design:splits}).
Use the XML to verify what the published renders print. When reporting an evidence score, show how it behaves
among answers the model actually attempts. The pooled association with correctness dropped when abstentions
were removed, and the within-tool-only association was weak even before removing them.
\paragraph{Scope.}
All field results come from 11 wells in one field, and WITSML covers 21 of 26 wellbores. Reporting practices and
formation depths can therefore recur across the held-out wells. DeepSeek was the only language model to complete
the full API matrix. Its three repetitions measure variability under the same configuration. Qwen3-8B supplies
partial v1 results, while Sonnet and Haiku ran on an auxiliary session sample with no enforced read isolation.
Seven reports with incomplete OCR were dropped from C4. Sixteen date-disagreement pages were retained and flagged,
and the paired analysis was repeated with affected questions and reports removed. PDF pages in this study are
born-digital renders. The effect of scan degradation remains unknown. Appendix~\ref{app:record} records the
experimental deviations and the pending release terms.

View File

@@ -0,0 +1,17 @@
\section{Conclusion}
\label{sec:conclusion}
Activity codes can make a classifier appear to detect non-productive time by giving it the fields that define the
label. With the codes visible, TF-IDF average precision rose from 0.463 to 0.995, and DistilBERT gained
0.27 to 0.29. The masked TF-IDF score matched a cue rate of about 82\% among planted positives in the calibration.
Depth-interval scores stayed near prevalence. The low agreement between blind language-model raters and the codes
(median $\kappa$ 0.283) limits the NPT tasks to diagnostics of code-derived labels.
On 1,652 well-scoped questions, DeepSeek reached macro-family accuracy of 0.712 with typed queries over XML-derived
tables, 0.618 with the agent, 0.148 with retrieval and 0.071 with the question alone. On the paired document questions,
the OCR--XML accuracy intervals spanned zero. The render comparison still identified two flags and a depth column
whose printed values differ from the XML. The adapted evidence score mainly separated answers from abstentions,
and the larger-decoy planted-cue check failed under its locked null.
A DDR benchmark can report these effects separately by scoring code-masked and code-exposed inputs on the same
held-out wells and scoring each published representation against the same structured answer.

View File

@@ -0,0 +1,88 @@
% Appendix A: protocol record. Every number is traced in paper/provenance/03_05_AB.md.
\section{Protocol record}\label{app:record}
This appendix records what each protocol locked, when, and what was known at the time; then the gates, the deviations
and the incidents. Each file is checked with \texttt{sha256sum -c} against its \texttt{.sha256} file, and each later
protocol names the checksum of the one it extends. All dates are 2026 and all lock times UTC.
\begin{table}[ht]
\centering
\caption{Locked protocols. The hash prefix is the first 12 hexadecimal digits of the SHA-256 of the YAML file.}
\label{tab:protocols}
\small
\begin{tabular}{@{}p{0.05\textwidth}p{0.08\textwidth}p{0.14\textwidth}p{0.31\textwidth}p{0.29\textwidth}@{}}
\toprule
File & Locked & Hash prefix & What it fixes & Known at the lock \\
\midrule
v1 & 18/11 04:09 & \texttt{fb11c6074b27} & Tasks, label rules, NPT selection rule, class rules, splits, masking,
metrics,
seeds, baselines, gates G1--G4 & Label counts; the trial ratings of 100 items; the first-pass M2 rater $\kappa$ that
selected the NPT definition;
no baseline score \\
v2 & 19/11 & \texttt{370f949f53cc} & DeepSeek-V4.1-Flash as the API baseline; Sonnet and Haiku session sample & Partial
v1 runs of Qwen3-8B; no test-well result used \\
v3 & 20/11 & \texttt{61bc3e1d4f2e} & LLM judge for free-text T4 answers against the automatic score & Automatic scores
of the sample; no judge verdict \\
v4 & 20/11 & \texttt{6a9ad0fb64e3} & Ordered error taxonomy; adapted EGS and the RQ4 test & G2 v2 headline metrics; no
error class or EGS value \\
v5 & 20/11 & \texttt{c99bb91bdca9} & T5 items, gain, representations, metrics; neighbour forecast & Counts of
relevance labels only \\
v6 & 20/11 & \texttt{0376aa18ea7a} & Planted-signal studies for T2 and T3, cue phrases, null checks & Real masked T2
and T3 results; no planted score \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{Gates.} G0 (29/10) checked the infrastructure: the parsed counts match the expected values, the render
deviations are explained and the OCR pilot is measured. It passed. G1 required the protocol to be locked before any
benchmark baseline and the class rules to be applied. It passed on 18/11; the NPT rule selected (b) by 0.025, and no
class met all thresholds for a separate score. G2 required the locked baselines over the reporting scope, masked and
unmasked T2 and T3, at least three seeds for stochastic models and confidence intervals by well. G2 under v1 cannot be
met, because the Qwen3-8B and Llama 3.1 8B runs were stopped. G2 under v2 replaces those cells with DeepSeek-V4.1-Flash
and passed on 20/11 with no missing cell. G3 allowed an LLM judge only with $\kappa \geq 0.6$ against the reference; it
passed on 20/11, with the reference changed as described below. G4 requires the release package to rerun from scratch
and the third-party licences to be checked; it has not been assessed.
\paragraph{Deviations.} Each deviation is a new protocol; no locked file was edited.
\begin{itemize}
\item \emph{Local models replaced (v2).} The project owner stopped Qwen3-8B and Llama 3.1 8B on 19/11, after the v1 runs
had begun and without reference to a test-well result. Qwen T4/C4 seed 0 had 10,214 of 16,317 predictions, Qwen T2 had
seed 0 complete and 17,827 of 23,447 for seed 1, and Llama had none. Two earlier drafts of v2, Claude models as the API
baseline and DeepSeek-V4.1-Flash replacing both local models, were replaced before any v2 call.
\item \emph{Session batches.} Protocol v2 planned batches of 30 T4 questions and 100 T2 items. The subagents used 15 and
50, because the reading tool returns about 42,000 characters.
\item \emph{Judge reference (v3).} Protocol v1 planned the author's ratings as the judge reference. No human rater
exists, so v3 uses the automatic score against the XML answer. G3 thus measures consistency with the automatic scorer.
\item \emph{Analyses added later (v4--v6).} The error taxonomy, the EGS test, T5 and the planted-signal studies were not
in v1; each was locked before its own scores.
\item \emph{Failed null check (v6).} At planted cue strength $f = 0.10$ the T2 null check failed: the mean AP was off
the
prevalence by 0.0101 against a tolerance of 0.01, and the seed-0 interval did not contain it. The $f = 0.10$ results are
therefore not interpreted, and the locked verdict stands. A diagnosis on 23/11, made after the fact, traced the failure
to the null definition and not to the pipeline. With cue rate 0 below $f$, the absence of the own cue marks the planted
rows; the true null at cue rate equal to $f$ passes. Using that curve would need a new protocol.
\item \emph{Planted-cue reference (v6).} The protocol records 0.461 for the real masked TF-IDF AP using the
earlier G2 summary, which pooled different subsets and modalities. The calibration uses the full XML subset by
well (AP 0.463). The report also retains the interpolation at 0.461.
\item \emph{Working-tree state.} The run log marks the four T2 shards as dirty and the T3 run as clean.
\end{itemize}
\paragraph{Incidents.} Errors found during the runs were fixed and the affected results recomputed.
\begin{itemize}
\item The average-precision code summed the positive weights in the wrong order after sorting by score. It was fixed,
tested again with non-uniform weights, and all intervals were regenerated.
\item One report run treated two missing well values as equal when pairing field questions. The report code was fixed
with a regression test and the report rebuilt from the checkpoints.
\item The first M1 driver recorded 140 passing tests and one failure: the test had matched its own command line as the
signal that a child process was ready. After the fix, 145 tests passed.
\item The M2 first-pass driver had a syntax error that was corrected during the run; the rerun reused the checkpoints.
\item The first OCR hub matching paired three pages wrongly and skipped a check; both were fixed and the matching rerun.
\item Qwen returned invalid JSON once in the date-clean C4 mode, once in RAG and four times in the agent mode; these
predictions count as failures.
\item The second rater pass was planned at least 14 days after the first; before G1 it was moved to the same day.
\end{itemize}
\paragraph{Limitations of the session sample.} The Sonnet and Haiku subagents shared the session's file system. They
were told to read only their batch file, but this was not enforced, and some ran directory listings. Outputs written by
a group of agents were quarantined and rerun with one batch per agent. The sample has one repetition and no seed, and it
lies outside G2.

View File

@@ -0,0 +1,84 @@
% Appendix B: label mapping summary. Counts from outputs/labels/summary.json and outputs/t4/summary.json.
\section{Label mapping}\label{app:labels}
The full mapping is the public file \texttt{configs/labels.yaml}; a check compares its code and state counts with the
data.
This appendix summarises it.
\paragraph{NPT definitions and cause groups.} Definition (a) takes the 3,577 rows whose main code is
\texttt{interruption}, which has ten sub-codes. Definition (b) adds the rows with \texttt{state = fail} or a state
detail other than \texttt{success}, 709 rows outside the interruption group, for 4,286 rows. A cause group comes from
the interruption sub-code when it names one, from the state detail otherwise, and is \texttt{unspecified} when neither
does (Table~\ref{tab:causes}). The 79 rows with a \texttt{wait} sub-code outside the interruption group are flagged but
are NPT under neither definition.
\begin{table}[ht]
\centering
\caption{Cause groups of the NPT rows. Interruption sub-codes are in typewriter type.}
\label{tab:causes}
\small
\begin{tabular}{@{}p{0.17\textwidth}p{0.45\textwidth}rr@{}}
\toprule
Cause group & Source & (a) & (b) \\
\midrule
equipment & \texttt{repair}, \texttt{maintain}; state detail \emph{equipment failure} & 1,985 & 2,425 \\
weather & \texttt{waiting on weather} & 445 & 445 \\
operation\_failed & state detail \emph{operation failed} & 101 & 322 \\
unspecified & \texttt{other} or \texttt{rig up/down} without a cause in the state detail & 262 & 299 \\
stuck\_fishing & \texttt{fish}; state detail \emph{stuck equipment} & 246 & 248 \\
waiting & \texttt{wait} & 229 & 229 \\
sidetrack & \texttt{sidetrack} & 202 & 202 \\
lost\_circulation & \texttt{lost circulation}; state details \emph{circulation loss}, \emph{mud loss} & 78 & 86 \\
well\_control & \texttt{well control} & 29 & 29 \\
hse & state detail \emph{injury} & 0 & 1 \\
\midrule
Total & & 3,577 & 4,286 \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{Operation classes.} The code of each of the 23,447 activities maps to one of 15 classes, used only in the
label audit: other 3,538, interruption 3,577, casing and cement 3,204, BOP and wellhead 2,512, trip 1,946, drill and
ream 1,925, plug and abandon 1,629, circulate 1,185, wireline 933, perforate 929, completion 657, rig up and down 572,
formation evaluation 520, rig move 241 and wait 79.
\paragraph{T1 sections.} The 932 drilling days carry the following sections after the fill rule: 8.5~in
404, 12.25~in 196, 17.5~in 151, 26~in 93, 36~in 57, 6~in 27 and 9.875~in 4.
\paragraph{T4 families.} Table~\ref{tab:families} gives the 39 templates and 1,662 questions by family.
\begin{table}[ht]
\centering
\caption{T4 question families.}
\label{tab:families}
\small
\begin{tabular}{@{}lrr@{}}
\toprule
Family & Templates & Questions \\
\midrule
lookup & 16 & 825 \\
aggregation & 9 & 513 \\
temporal event & 6 & 134 \\
comparison & 3 & 102 \\
multi-hop & 5 & 88 \\
\midrule
Total & 39 & 1,662 \\
\bottomrule
\end{tabular}
\end{table}
\paragraph{OCR error types.} The error types below were inspected on the page images of the 26-report pilot, read by a
different OCR run from the full-corpus export (Sec.~\ref{sec:data}). They illustrate the kinds of error, not their
rates in the export.
\begin{itemize}
\item \emph{Invented content.} Empty unit brackets filled, for example ``()'' read as ``($^\circ$)'' for temperature
and pressure (43 insertions), and a ``Printed'' line that is not on the page.
\item \emph{Silent correction of the source.} Misspellings in the print corrected, for example ``Attempeted'' to
``Attempted'' and ``stnds'' to ``stands'', so the text departs from the source.
\item \emph{Proper names.} ``M\AE{}RSK'' read as ``MERSK'', ``StatoilHydro'' as ``StatoliHydro''.
\item \emph{Table structure.} Columns merged or split and rows shifted, for example four rows merged into one.
\item \emph{Depth fields.} A whole value lost, or a value shifted to the neighbouring label; a wrong value that looks
valid is the most harmful case.
\item \emph{Labels and digits.} ``TVD'' for ``mTVD'', 3273 read as 2273, a wellbore name read as ``15/9-F15''.
\item \emph{Layout.} Spaces inserted inside words, the most frequent error, with 207 cases among 393 near matches.
\end{itemize}

View File

@@ -122,7 +122,7 @@ footer{margin-top:32px;color:var(--mute);font-size:12px}
<h2>Các mục cần xác minh [XM]</h2>
<div class="tw"><table id="xm"><thead><tr><th>Mục</th><th>Vị trí trong plan</th><th>Trạng thái</th><th>Kết quả hoặc việc còn lại</th></tr></thead><tbody></tbody></table></div>
<h2>Quyết định (D-1 đến D-7 chốt 29/10/2026; D-8 đến D-14 chốt 17/11/2026, D-15 đến D-17 chốt 18/11/2026, D-18 đến D-20 chốt 20/11/2026)</h2>
<h2>Quyết định (D-1 đến D-7 chốt 29/10/2026; D-8 đến D-14 chốt 17/11/2026, D-15 đến D-17 chốt 18/11/2026, D-18 đến D-21 chốt 20/11/2026)</h2>
<div class="tw"><table id="dec"><thead><tr><th>Mã</th><th>Quyết định</th><th>Chốt</th><th>Căn cứ</th></tr></thead><tbody></tbody></table></div>
<h2>Phát hiện đã kiểm chứng (từ dữ liệu, plan §1)</h2>
@@ -188,26 +188,27 @@ const PHASES = [
out:"Bảng kết quả, ≥ 3 seed, CI theo giếng (<code>outputs/m34/report.json</code>, <code>qa.csv</code>, <code>classification.csv</code>)",
gate:{label:"G2", date:"2026-11-20", text:"đủ baseline trong phạm vi đã khóa và ablation T2/T3; báo kết quả bất kể chiều", res:"<b>G2 v2 đạt ngày 20/11/2026</b> (protocol v2): <code>g2_v2.passed</code> = True, không thiếu ô phân loại hay QA; báo cáo dựng lại lúc 06:32 UTC. G2 v1 không thể đạt vì Qwen và Llama dừng ngày 19/11. Checksum <code>protocol_v2</code> khớp."},
tasks:[
{id:"m34-base", t:"Baseline theo phạm vi G1", s:"done", n:"TF-IDF + logistic xong T1–T3 (18/11); mọi shard DistilBERT xong lúc 06:27 UTC ngày 20/11 (shard cuối: T3(a) mở mã 93 fold, T2(a) mở mã 111 fold). AP T2(b) che mã theo giếng: majority 0,179, lexicon 0,249, TF-IDF 0,461, VAI DeepSeek zero-shot 0,405 (TB 3 lượt), Qwen zero-shot 0,261 (v1 chưa đầy đủ), DistilBERT 0,597; theo wellbore DistilBERT 0,619, TF-IDF 0,484. AP T3(b) che mã theo giếng: majority 0,114, TF-IDF 0,123, DistilBERT 0,121, xấp xỉ ngẫu nhiên nên T3 chỉ là chẩn đoán."},
{id:"m34-base", t:"Baseline theo phạm vi G1", s:"done", n:"TF-IDF + logistic xong T1–T3 (18/11); mọi shard DistilBERT xong lúc 06:27 UTC ngày 20/11 (shard cuối: T3(a) mở mã 93 fold, T2(a) mở mã 111 fold). AP T2(b) che mã theo giếng: majority 0,183, lexicon 0,251, TF-IDF 0,463, VAI DeepSeek zero-shot 0,407 (TB 3 lượt), Qwen zero-shot 0,264 (v1 chưa đầy đủ), DistilBERT 0,593; theo wellbore DistilBERT 0,618, TF-IDF 0,489. AP T3(b) che mã theo giếng: majority 0,114, TF-IDF 0,123, DistilBERT 0,121, xấp xỉ ngẫu nhiên nên T3 chỉ là chẩn đoán."},
{id:"m34-agent", t:"Agent dùng tool kiểu TADI và RAG thường", s:"done", n:"Accuracy macro theo họ câu hỏi (câu thuộc giếng, điểm tự động, TB 3 lượt) của VAI DeepSeek: tool_only 0,712, agent 0,618, RAG 0,148, few-shot 0,151, zero-shot 0,071. Truy vấn tool trên bảng dựng từ XML vượt xa truy xuất văn bản và zero-shot. Qwen v1: RAG 0,154 ở seed 0; agent dừng ở 545/1.662 ngày 19/11. Llama không chạy ngoài smoke."},
{id:"m34-leak", t:"Ablation rò rỉ", s:"done", n:"T2(b) theo giếng, che mã → mở mã: TF-IDF 0,461 → 0,994 (chênh lệch ghép cặp 0,531, CI 95% 0,480–0,580), DistilBERT 0,597 → 0,869. T3(b) TF-IDF 0,123 → 0,127 (chênh lệch 0,0048, CI 95% −0,0005 đến 0,0238)."},
{id:"m34-leak", t:"Ablation rò rỉ", s:"done", n:"T2(b) theo giếng, che mã → mở mã: TF-IDF 0,463 → 0,995 (chênh lệch ghép cặp 0,531, CI 95% 0,480–0,580), DistilBERT 0,593 → 0,873. T3(b) TF-IDF 0,123 → 0,127 (chênh lệch 0,0048, CI 95% −0,0005 đến 0,0238)."},
{id:"m34-c4", t:"Thí nghiệm C4: XML, HTML và OCR", s:"done", n:"1.376 câu ghép cặp, 1.293 câu khi loại trang lệch ngày. VAI DeepSeek (TB 3 lượt): XML 0,151, HTML 0,177, OCR 0,181. Qwen v1 seed 0: XML 0,214, HTML 0,235, OCR 0,196; khi loại trang lệch ngày 0,204 / 0,229 / 0,195."},
{id:"m34-claude", t:"Protocol v2: VAI toàn ma trận, Sonnet/Haiku trên mẫu", s:"done", n:"Dừng Qwen và Llama v1 ngày 19/11 (checkpoint giữ: Qwen T4/C4 10.214/16.317 seed 0, T2 seed 0 xong và seed 1 17.827/23.447). VAI DeepSeek-V4.1-Flash-1017 xong T4/C4 48.951/48.951 và T2 70.341/70.341 (ba lượt). Sonnet và Haiku xong 110/110 batch mỗi model (300 câu T4 × 5 điều kiện, 500 mục T2, ngoài độ phủ G2); accuracy macro Sonnet / Haiku: C4 XML 0,123 / 0,083, HTML 0,177 / 0,147, OCR 0,187 / 0,150, RAG 0,128 / 0,098."},
{id:"m34-stats", t:"Bảng kết quả ≥ 3 seed, CI bootstrap theo giếng", s:"done", n:"Báo cáo G2 kiểm tập ID của từng điều kiện; tiến trình theo dõi dựng lại <code>report.json</code> lúc 06:32 UTC ngày 20/11 rồi kết thúc. T4 báo điểm tự động (G3 đạt ngày 20/11 nhưng số chính vẫn là điểm tự động theo protocol v3)."}
]},
{id:"M5", name:"M5 Hiệu chuẩn judge và phân tích lỗi", start:"2026-11-20", end:"2027-03-31", when:"20/11/2026 – 3/2027",
out:"κ, agreement của judge (<code>outputs/m5/judge/report.json</code>), phân loại lỗi và tương quan EGS (<code>outputs/m5/errors/report.json</code>), T5 (<code>outputs/m5/t5/report.json</code>)",
out:"κ, agreement của judge (<code>outputs/m5/judge/report.json</code>), phân loại lỗi và tương quan EGS (<code>outputs/m5/errors/report.json</code>), T5 (<code>outputs/m5/t5/report.json</code>), tín hiệu cấy (<code>outputs/m5/synthetic/report.json</code>)",
gate:{label:"G3", date:"2026-11-20", text:"chỉ dùng LLM-judge cho T4 khi κ giữa judge và điểm tự động theo đáp án XML đạt ≥ 0,6 (không có người chấm); không đạt thì T4 chỉ báo metric tự động và ghi rõ", res:"<b>G3 đạt ngày 20/11/2026</b> (protocol v3, §12 ý 34): judge chính Sonnet κ = 0,98 (CI 95% theo giếng 0,947–1,0; khớp 99/100) so với điểm tự động; Haiku (độ nhạy) κ = 0,90 (0,826–0,966). Đây là độ nhất quán với bộ chấm tự động, không phải khớp với người. Số chính của T4 vẫn là điểm tự động."},
tasks:[
{id:"m5-synth", t:"Nghiên cứu tín hiệu cấy cho T2 và T3 (planted signal)", s:"done", n:"Protocol v6 (SHA-256 <code>0376aa18…</code>, khóa trước mọi điểm số cấy), <code>scripts/21_m5_synthetic.py</code>, 22 test, 5 lượt <code>m5_synthetic</code> và 1 lượt chẩn đoán đều ok. Nhãn bốc ngẫu nhiên nên biết chính xác; 5 seed, CI theo giếng. <b>Null:</b> đạt ở T2 f = 0,02 (AP 0,182, π 0,183) và T3 s = 0 (0,118, π 0,114); <b>không đạt ở T2 f = 0,10</b> (0,193; lệch 0,0101; CI seed 0 không chứa π), nên cấu hình đó không được diễn giải theo v6. Điều tra 23/11 (<code>--arm diagnose</code>, không thuộc protocol): nguyên nhân là định nghĩa null; ở c = 0 &lt; f việc không có cue đã là tín hiệu (chỉ báo không-cue một mình cho AP 0,2004, lý thuyết 0,199), null thật là c = f và cho AP 0,1819 (đạt). Pipeline không lệch chuẩn. T2 f = 0,02: AP 0,182 (c = 0) đến 0,521 (c = 1); điểm thật 0,463 ứng c ≈ 0,82 (0,78–0,84). T3: điểm thật 0,150 ứng s ≈ 0,66 (0,55–0,72), oracle ≈ 0,21. Đo giới hạn phát hiện, không kiểm định nhãn và không thay H3 (plan §1.9, §12 ý 37)."},
{id:"m5-t5", t:"T5 truy xuất khoảng tương đồng (nếu kịp)", s:"done", n:"Protocol v5 (SHA-256 <code>c99bb91b…</code>, khóa trước mọi điểm truy xuất), <code>scripts/20_m5_t5.py</code>, 12 test. 410 khoảng NPT (b), 10 giếng; ứng viên từ giếng khác. nDCG@10: random 0,463, depth 0,666, witsml_pre 0,495, text_pre 0,611, text_event 0,528, rrf_pre 0,670 (+0,004 so với depth, CI chứa 0). Dự báo từ 10 láng giềng AP 0,150 (0,116–0,204), prevalence 0,114 (plan §1.8, §12 ý 36)."},
{id:"m5-err", t:"Phân tích lỗi theo họ câu hỏi và tương quan EGS (RQ4)", s:"done", n:"Phân tích kết quả cuối (plan §1.7): agent − RAG +0,46 đến +0,48 (CI theo giếng loại 0); agent − tool_only −0,08 đến −0,12 (dưới 0); OCR − XML +0,02 đến +0,04 (chứa 0, H5 không được ủng hộ). Protocol v4 khóa trước khi tính phân loại lỗi và EGS (§12 ý 35). VAI DeepSeek, tỉ lệ macro TB 3 lượt: bỏ trả lời là lỗi chính của C4/RAG (C4 XML 0,678, HTML 0,535, OCR 0,580, RAG 0,638), sau đó nhầm wellbore (0,095–0,190); tool_only và agent chủ yếu trích đúng báo cáo nhưng sai giá trị (0,14–0,15), agent thêm 6,4% lỗi gọi. Aggregation và multi_hop gần như không đúng với văn bản nhưng khoảng 0,72 với tool_only. EGS (chuyển thể: số đo + trích DDR) có ρ Spearman 0,535–0,538 với điểm tự động ở cả ba lượt: H4 không được ủng hộ; bỏ câu bỏ trả lời ρ ≈ 0,23; trong tool_only ρ 0,07. Không có người chấm."},
{id:"m5-judge", t:"Hiệu chuẩn LLM-judge (G3)", s:"done", n:"Protocol v3 khóa trước mọi phán quyết. 100 câu trả lời văn bản tự do của VAI DeepSeek (lượt 0; enumeration 20/24, list 15/15, string 15/11 đúng/sai; 10 giếng) do Sonnet và Haiku chấm mù (subagent trong session, hai batch 50). κ so với điểm tự động: Sonnet 0,98, Haiku 0,90; giữa hai judge 0,92. Năm bất đồng: một câu trả lời dạng câu văn nêu đúng wellbore mà bộ chấm tự động chấm sai; bốn câu OCR \"MERSK INSPIRER\" Haiku chấp nhận. Không có người chấm; tương quan EGS (RQ4) dùng điểm tự động (xem dòng phân tích lỗi)."}
]},
{id:"M6", name:"M6 Viết và nộp", start:"2027-04-01", end:"2027-04-30", when:"4/2027",
{id:"M6", name:"M6 Viết và nộp", start:"2026-11-23", end:"2027-04-30", when:"4/2027",
out:"Bản nộp",
gate:{label:"G4", date:"2027-04-30", text:"gói tái lập chạy lại được từ đầu; giấy phép các bộ nhãn bên thứ ba đã kiểm"},
tasks:[
{id:"m6-write", t:"Viết bài", s:"todo", n:"Cấu trúc ở plan §8; không dùng các claim ở plan §10."},
{id:"m6-write", t:"Viết bài", s:"doing", n:"Bản thảo đã qua lượt rà soát đầu ngày 23/11/2026. Abstract, Introduction, Discussion và Conclusion theo mẫu ML-Porosity. Sửa mẫu số T4/C4: 1.652/1.366 câu có phạm vi giếng. 108 đối chiếu bảng với đầu ra và 231 test đạt. PDF 44 trang ở <code>outputs/paper/volve-dia-m6.pdf</code>, biên bản ở <code>paper/audit_report.md</code>. Còn tác giả xác nhận khai báo, thông tin mô hình OCR, thể thức tạp chí và điều khoản phát hành G4."},
{id:"m6-pack", t:"Đóng gói code, nhãn, protocol và hash", s:"todo", n:"Repo Gitea là public: <code>docs/danh-gia-huong-NCKH-2026-10-29.md</code> và <code>docs/NCKH_Ban TD.DOCX</code> để ngoài git; trước mỗi lần push, kiểm tra không file nào trích tài liệu nội bộ."},
{id:"m6-novel", t:"Quét novelty lần cuối và tra quartile venue", s:"todo", n:"OnePetro, arXiv, Scopus; SCImago (plan §2.3, §0)."},
{id:"m6-submit", t:"Preprint và nộp", s:"todo", n:"Geoenergy Science and Engineering trước; kế tiếp Computers &amp; Geosciences, Journal of Petroleum Exploration and Production Technology."}
@@ -229,7 +230,7 @@ const XM = [
{name:"Thư mục nguồn của formation tops", where:"mục 4.1", s:"done", r:"Tìm thấy ngày 29/10: <code>Geophysical_Interpretations/Wells/Well_picks_Volve_v1.dat</code>, 409 pick trên 35 wellbore, khớp bản đánh giá mục 3. 23/26 wellbore DDR trùng tên; còn ánh xạ <code>15/9-19 SR</code> với 15/9-19 S, ST2 và F-9 A. Đã vào manifest (25.571 file); ánh xạ <code>15/9-19 SR</code> là 15/9-19 ST2, F-9 A thừa hưởng pick của F-9 (plan §4.1)."},
{name:"Giấy phép nguồn ngoài (DrillScribe, Anatoly5ms, TSPP, Bassey)", where:"mục 4.4 ý 2", s:"todo", r:"TSPP không có giấy phép, DrillScribe và Anatoly5ms dùng MIT cho mã. Điều khoản phát hành cho bản Volve đối chiếu giữa license.txt và văn bản Equinor ở G4."},
{name:"Quartile của các venue", where:"mục 0 (Venue)", s:"todo", r:"Tra lại trên SCImago khi nộp."},
{name:"Kiểm tra novelty (PetroAgents đã có bản tạp chí chưa)", where:"mục 2.3", s:"todo", r:"Quét 17/11: PetroAgents chưa có bản tạp chí; có hai bài hội nghị ADIPEC về hỏi đáp trên DDR Volve. Còn: toàn văn PetroAgents (tải tay), EAGE; quét Scopus trước khi nộp. Không viết \"first\" (mục 10)."}
{name:"Kiểm tra novelty (PetroAgents đã có bản tạp chí chưa)", where:"mục 2.3", s:"todo", r:"Quét 17/11: PetroAgents chưa có bản tạp chí; có hai bài hội nghị ADIPEC về hỏi đáp trên DDR Volve. Đã đọc toàn văn PetroAgents. Còn xác minh EAGE, các bài OnePetro và quét Scopus trước khi nộp. Không viết \"first\" (mục 10)."}
];
const DECISIONS = [
@@ -253,6 +254,7 @@ const DECISIONS = [
{id:"D-18", q:"Tham chiếu của G3", p:"Không có người chấm, nên protocol v3 lấy điểm tự động theo đáp án XML làm tham chiếu cho judge; ngưỡng κ ≥ 0,6, phạm vi và hậu quả khi trượt giữ nguyên. Judge chính Sonnet, Haiku là độ nhạy.", n:"Mẫu 100 câu và prompt khóa hash trước mọi phán quyết. Đạt nghĩa là nhất quán với bộ chấm tự động, không phải khớp với người (plan §12 ý 34)."},
{id:"D-19", q:"Luật phân loại lỗi và EGS cho RQ4", p:"Protocol v4 (mở rộng v3) khóa trước khi tính: mỗi dự đoán một lớp lỗi theo thứ tự luật; EGS của TADI chuyển thể cho câu trả lời JSON (số đo kèm đơn vị TADI + trích báo cáo DDR có thật, mục = 0); Spearman với điểm tự động, gộp và trong từng chế độ, bootstrap theo giếng; H4 được ủng hộ nếu |ρ| gộp < 0,3 ở mọi lượt.", n:"EGS ở đây là bản chuyển thể, không phải output agent của TADI. Kết quả: ρ 0,535–0,538, H4 không được ủng hộ (plan §1.7, §12 ý 35)."},
{id:"D-20", q:"Định nghĩa T5 (truy xuất khoảng tương đồng)", p:"Protocol v5 (mở rộng v4) khóa trước mọi điểm truy xuất: mục là khoảng T3 trong lỗ của chính wellbore, biết section và formation; mức liên quan g = cùng section + cùng formation + giao nhóm nguyên nhân (0–3); ứng viên từ giếng khác (chính), wellbore khác (độ nhạy); biểu diễn không đọc mã, nguyên nhân, section hay formation; nDCG@10 chính, MRR và P@10 phụ; CI bootstrap theo giếng.", n:"T5 ngoài G2, không có cổng. Kết quả: depth là baseline mạnh nhất, không biểu diễn nào hơn depth với CI loại 0 (plan §1.8, §12 ý 36)."},
{id:"D-21", q:"Nghiên cứu tín hiệu cấy cho T2 và T3", p:"Protocol v6 (mở rộng v5) khóa trước mọi điểm số cấy: nhãn Bernoulli độc lập với nhãn thật, cue nhân tạo cường độ c (T2) và hazard theo độ sâu s (T3), mô hình giữ nguyên như M3–M4 và v5, kiểm tra null AP ∈ π ± 0,01 và CI seed 0 chứa π, cường độ hiệu dụng nội suy từ điểm thật.", n:"Không có cổng, không thay H3. Null không đạt ở T2 f = 0,10 nên cấu hình đó không diễn giải theo v6; nguyên nhân là null c = 0 &lt; f, null thật c = f đạt (điều tra 23/11, plan §1.9, §12 ý 37)."},
];
const FINDS = [
@@ -269,10 +271,11 @@ const FINDS = [
{h:"Hai đối thủ hội nghị ADIPEC (2/11/2026)", p:"SPE-236554-MS (hỏi đáp trên 1.266 DDR Volve) và SPE-235330-MS (agent ReAct, 1.681 DDR) đánh giá định lượng hỏi đáp; không có nhiệm vụ nhãn, không kiểm soát rò rỉ mã. Không viết \"first quantitative evaluation\"; thêm metric nhầm wellbore cho T4."},
{h:"Lỗi render thứ ba: Bit Record", p:"Cột \"End mMD\" của Bit Record in <code>bitRun_mdHoleStart</code> (16/16 hàng kiểm tay, 90/90 theo T4), và <code>03</code> chỉ phủ header, 31 trường, tóm tắt, Operations, không phủ 14 bảng. Giá trị này chỉ lấy từ XML."},
{h:"OCR toàn tập yếu nhất ở độ sâu và tên riêng", p:"CER 2,40% toàn tập, nhưng depth mMD khớp <b>0,9241</b> (CER 6,97%), mTVD 0,9418, tên giàn khớp 0,3385; bịa \"°\" vào ngoặc rỗng (2.524 lần). CER theo báo cáo: trung vị 0,93%, p90 4,98%, lớn nhất 85,7%; chỉ 9/1.752 báo cáo khớp tuyệt đối."},
{h:"T4: truy vấn tool vượt xa truy xuất văn bản (G2 v2, 20/11)", p:"VAI DeepSeek, accuracy macro theo họ câu hỏi (câu thuộc giếng, TB 3 lượt, điểm tự động): <b>tool_only 0,712</b>, <b>agent 0,618</b>, so với RAG 0,148, few-shot 0,151, zero-shot 0,071 và C4 XML / HTML / OCR 0,151 / 0,177 / 0,181. T2(b) che mã: DistilBERT AP 0,597 &gt; TF-IDF 0,461 &gt; DeepSeek zero-shot 0,405; mở mã TF-IDF 0,994. T3(b) che mã xấp xỉ ngẫu nhiên (majority 0,114, TF-IDF 0,123, DistilBERT 0,121). Không phải audit của người hay chuyên gia (plan §1.6, §12 ý 33)."},
{h:"T4: truy vấn tool vượt xa truy xuất văn bản (G2 v2, 20/11)", p:"VAI DeepSeek, accuracy macro theo họ câu hỏi (câu thuộc giếng, TB 3 lượt, điểm tự động): <b>tool_only 0,712</b>, <b>agent 0,618</b>, so với RAG 0,148, few-shot 0,151, zero-shot 0,071 và C4 XML / HTML / OCR 0,151 / 0,177 / 0,181. T2(b) che mã: DistilBERT AP 0,597 &gt; TF-IDF 0,463 &gt; DeepSeek zero-shot 0,407; mở mã TF-IDF 0,995. T3(b) che mã xấp xỉ ngẫu nhiên (majority 0,114, TF-IDF 0,123, DistilBERT 0,121). Không phải audit của người hay chuyên gia (plan §1.6, §12 ý 33)."},
{h:"Agent kém tool_only; OCR không làm giảm T4; G3 đạt (20/11)", p:"Chênh lệch ghép cặp, CI 95% theo giếng, từng lượt: agent − RAG <b>+0,46 đến +0,48</b> (loại 0); agent − tool_only <b>−0,08 đến −0,12</b> (dưới 0); few-shot − zero-shot +0,07 đến +0,09 (loại 0); RAG − zero-shot +0,07 đến +0,08 (chứa 0); OCR − XML +0,02 đến +0,04 (chứa 0, cả khi loại trang lệch ngày). Tỉ lệ nhầm wellbore: RAG và C4 HTML/OCR 0,30–0,38, C4 XML 0,20, tool khoảng 0,05. Rò rỉ mã: T2(b) TF-IDF +0,531, DistilBERT +0,27 đến +0,29; T3 xấp xỉ 0. T2 DeepSeek − TF-IDF −0,055 (CI chứa 0). G3: Sonnet κ 0,98 so với điểm tự động (độ nhất quán, không phải người chấm). Số Qwen chỉ là v1 chưa đầy đủ (seed 0)."},
{h:"Lỗi theo họ câu hỏi và EGS (RQ4, 20/11)", p:"VAI DeepSeek, TB 3 lượt: truy xuất văn bản chủ yếu <b>bỏ trả lời</b> (C4 0,54–0,68, RAG 0,64), sau đó nhầm wellbore; C4 XML thấp nhất vì bỏ trả lời nhiều nhất (lookup 0,76 so với 0,45 ở HTML/OCR). Aggregation: C4/RAG đúng 0,02–0,03, tool_only 0,73. tool_only và agent sai chủ yếu ở giá trị dù đã trích đúng báo cáo (0,14–0,15). EGS chuyển thể: <b>ρ 0,535–0,538</b> với điểm tự động, nên H4 (tương quan yếu) không được ủng hộ; accuracy theo mức EGS 0 / 1/3 / 2/3 = 0,01 / 0,22 / 0,67. Bỏ câu bỏ trả lời ρ ≈ 0,23; trong tool_only ρ 0,07: EGS chủ yếu tách câu có trả lời khỏi câu bỏ trả lời, không thay được điểm theo đáp án XML. Không có người chấm (plan §1.7)."},
{h:"T5: độ sâu là baseline mạnh nhất (20/11)", p:"Truy xuất khoảng tương đồng (protocol v5, NPT b, 410 truy vấn, ứng viên từ giếng khác): nDCG@10 depth 0,666 so với random 0,463; comment 24 h trước khoảng 0,611; WITSML 24 h trước 0,495; RRF 0,670 (+0,004, CI chứa 0). Trong một mỏ, section và formation gần như do độ sâu quyết định; nhóm nguyên nhân gần như không tách được (giao nguyên nhân trong top 10: 0,70 random, 0,75 tốt nhất). Dự báo từ láng giềng AP 0,150 so với prevalence 0,114 nên T3/T5 vẫn là chẩn đoán (plan §1.8)."},
{h:"Tín hiệu cấy: điểm T2 thật khớp tỷ lệ cue mô phỏng khoảng 82% (20/11)", p:"Protocol v6, 5 seed, CI theo giếng. Kiểm tra null đạt ở T2 f = 0,02 và T3, <b>không đạt ở T2 f = 0,10</b> (AP 0,193 so với π 0,183), nên cấu hình sau không diễn giải theo v6; điều tra sau cho thấy lỗi do thiết kế (c = 0 &lt; f làm việc không có cue thành tín hiệu), null thật c = f đạt (AP 0,1819). Pipeline T2 tìm lại tín hiệu cấy đơn điệu (AP 0,182 đến 0,521 khi c từ 0 đến 1); điểm thật 0,463 ứng c ≈ 0,82 trong mô phỏng. Tỷ lệ cue thật trong comment chưa được đo. Điểm T3 thật 0,150 ứng hazard độ sâu s ≈ 0,66, oracle ≈ 0,21. Chỉ đo giới hạn phát hiện, không kiểm định nhãn (plan §1.9)."},
];
const OCRQC = [
@@ -328,9 +331,13 @@ const LOG = [
["2026-11-19","Dừng Qwen và Llama v1; protocol v2: VAI DeepSeek-V4.1-Flash-1017 chạy toàn ma trận (bắt đầu 03:22 UTC), Sonnet và Haiku chạy mẫu trong session (plan §12 ý 32)."],
["2026-11-19","Mẫu Sonnet/Haiku xong 110/110 batch mỗi model (plan §12 ý 33)."],
["2026-11-20","VAI DeepSeek xong T4/C4 48.951/48.951 và T2 70.341/70.341; mọi shard DistilBERT xong lúc 06:27 UTC. Báo cáo dựng lại lúc 06:32 UTC: <b>G2 v2 đạt</b>, G2 v1 không thể đạt. T4 tool_only 0,712 và agent 0,618 so với RAG 0,148 và zero-shot 0,071; T3 xấp xỉ ngẫu nhiên. Còn lại G3, viết bài, điều khoản phát hành ở G4 (plan §12 ý 33)."],
["2026-11-20","Protocol v3 khóa (tham chiếu G3 là điểm tự động theo đáp án XML, không có người chấm). <b>G3 đạt</b>: Sonnet κ 0,98 (CI 0,947–1,0), Haiku 0,90 trên 100 câu trả lời văn bản tự do; số chính T4 vẫn là điểm tự động. Phân tích kết quả cuối: agent kém tool_only, OCR không kém XML trên T4, RAG và C4 HTML/OCR nhầm wellbore 0,30–0,38 (plan §1.7, §12 ý 34)."],,
["2026-11-20","Protocol v3 khóa (tham chiếu G3 là điểm tự động theo đáp án XML, không có người chấm). <b>G3 đạt</b>: Sonnet κ 0,98 (CI 0,947–1,0), Haiku 0,90 trên 100 câu trả lời văn bản tự do; số chính T4 vẫn là điểm tự động. Phân tích kết quả cuối: agent kém tool_only, CI so sánh OCR với XML trên T4 chứa 0, RAG và C4 HTML/OCR nhầm wellbore 0,30–0,38 (plan §1.7, §12 ý 34)."],
["2026-11-20","Protocol v4 khóa (SHA-256 <code>6a9ad0fb…</code>) trước khi tính phân loại lỗi và EGS. <code>scripts/19_m5_errors.py</code> (3 phút, <code>20261120-071047_m5_errors</code>): lớp \"đúng\" khớp số chính G2 v2; bỏ trả lời là lỗi chính của C4/RAG; EGS ρ 0,535–0,538 với điểm tự động (H4 không được ủng hộ; bỏ câu bỏ trả lời ρ ≈ 0,23). 192 test đạt."],
["2026-11-20","Protocol v5 khóa (SHA-256 <code>c99bb91b…</code>) trước mọi điểm truy xuất T5; trước đó chỉ xem số đếm nhãn. <code>scripts/20_m5_t5.py</code> (1 phút 36 giây, <code>20261120-073123_m5_t5</code>): depth nDCG@10 0,666, random 0,463, rrf_pre 0,670 (CI hiệu với depth chứa 0); kNN AP 0,150. 204 test đạt (plan §1.8, §12 ý 36)."],
["2026-11-20","Protocol v5 khóa (SHA-256 <code>c99bb91b…</code>) trước mọi điểm truy xuất T5; trước đó chỉ xem số đếm nhãn. <code>scripts/20_m5_t5.py</code> (1 phút 36 giây, <code>20261120-073123_m5_t5</code>): depth nDCG@10 0,666, random 0,463, rrf_pre 0,670 (CI hiệu với depth chứa 0); kNN AP 0,150. 226 test đạt ngày 23/11 (plan §1.8, §1.9, §12 ý 36–37)."],
["2026-11-20","Protocol v6 khóa (SHA-256 <code>0376aa18…</code>) trước mọi điểm số cấy. <code>scripts/21_m5_synthetic.py</code>: arm T3 (3 phút 30 giây) và 4 shard T2 (khoảng 2 giờ 30 phút mỗi shard, 08:44–11:14 UTC), 5 lượt ok. Null đạt ở T2 f = 0,02 và T3, không đạt ở T2 f = 0,10; cue hiệu dụng T2 c ≈ 0,82, cường độ hiệu dụng T3 s ≈ 0,66 (plan §1.9, §12 ý 37)."],
["2026-11-23","Điều tra null T2 f = 0,10 (sau sự kiện, không thuộc protocol v6): <code>scripts/21_m5_synthetic.py --arm diagnose</code> (3 giây). Ở c = 0 &lt; f, không có cue đã là tín hiệu (chỉ báo không-cue AP 0,2004, lý thuyết 0,199); null thật c = f cho AP 0,1819 (đạt). Phán quyết khóa của v6 giữ nguyên. 22 test, tổng 226 test đạt (plan §1.9, §12 ý 37)."],
["2026-11-23","M6 bắt đầu: bản thảo đầu của bài ở <code>paper/</code> (plan §12 ý 38). Khi viết phát hiện các số T2(b) ở ghi chú cũ là trung bình gộp nhiều tập con; số chính từ <code>classification.csv</code> (majority 0,183, TF-IDF 0,463, DistilBERT 0,593) đã sửa ở plan, AGENTS, overview và report. Chưa commit."],
["2026-11-23","Rà soát và biên dịch bản thảo M6 (plan §12 ý 39): sửa mẫu số T4/C4, làm rõ tỷ lệ cue mô phỏng và giới hạn của kết quả OCR. 108 đối chiếu bảng và 231 test đạt. PDF: <code>outputs/paper/volve-dia-m6.pdf</code>."],
];
/* ===================== HẾT DATA ===================== */

259
scripts/21_m5_synthetic.py Normal file
View File

@@ -0,0 +1,259 @@
#!/usr/bin/env python3
"""Planted-signal studies with known ground truth under protocol v6 (T2 text cues, T3 depth hazard).
scripts/21_m5_synthetic.py run both arms, write outputs/m5/synthetic/
scripts/21_m5_synthetic.py --arm t3 run one arm (the report is rebuilt from every finished run)
scripts/21_m5_synthetic.py --arm t2 --shard 0/4 run every fourth T2 planting (independent processes)
scripts/21_m5_synthetic.py --arm report rebuild report.json and the tables from finished runs only
scripts/21_m5_synthetic.py --arm diagnose post-hoc: why the T2 null check at c = 0 can fail when f > 0
Refuses to run unless configs/protocol_v6.yaml matches its checksum, its parent v5 matches the recorded checksum and
the cue lexicon matches inputs_hashed. Every T2 run is checkpointed in outputs/m5/synthetic/t2_runs/, so an
interrupted run resumes. The real activity codes and the real T2/T3 labels are never read.
"""
from __future__ import annotations
import argparse
import json
import time
from pathlib import Path
import numpy as np
import pandas as pd
from volve_dia import m34, m5_synthetic as ms
ROOT = Path(__file__).resolve().parents[1]
PROTOCOL = ROOT / "configs/protocol_v6.yaml"
CUES = ROOT / "configs/synth_cues.yaml"
BASE_SEED, SEEDS, RESAMPLES, CI_SEED = 20261117, 5, 2000, 20261117
T2_PI, T3_PI = 0.183, 556 / 4894
T2_C = (0.0, 0.1, 0.25, 0.5, 0.75, 1.0)
T2_F_PRIMARY, T2_F_SENSITIVITY = 0.02, 0.10
T3_S = (0.0, 0.25, 0.5, 1.0, 2.0)
T2_UNIVERSE, T3_UNIVERSE = (23447, 11), (4894, 10)
T2_STATED, T3_STATED = 0.461, 0.150
def real_t2_reference(root):
rows = json.loads((root / "m34/report.json").read_text())["classification"]
match = [r for r in rows if r["task"] == "t2" and r["definition"] == "b" and r["mode"] == "masked"
and r["split"] == "well" and r["method"] == "tfidf_logistic" and r["modality"] == "xml"
and r["subset"] == "all"]
if len(match) != 1:
raise ValueError("Expected one masked T2(b) TF-IDF by-well XML row in outputs/m34/report.json")
return {"source": "outputs/m34/report.json classification: t2, b, masked, well, tfidf_logistic, xml, all",
"ap": match[0]["metrics"]["pr_auc_ap"]["estimate"], "stated_in_protocol": T2_STATED}
def real_t3_reference(root):
block = json.loads((root / "m5/t5/report.json").read_text())["knn_forecast"]["label_b"]["depth"]
return {"source": "outputs/m5/t5/report.json knn_forecast.label_b.depth.ap", "ap": block["ap"],
"stated_in_protocol": T3_STATED}
def check_universe(frame, expected, name):
if (len(frame), frame["well"].nunique()) != expected:
raise ValueError(f"{name} universe differs from protocol v6: {len(frame)} rows, "
f"{frame['well'].nunique()} wells")
def run_t2(root, dest, protocol, spec, digest, shard=(0, 1)):
acts = pd.read_parquet(root / "labels/t2_inputs.parquet", columns=ms.T2_COLUMNS)
check_universe(acts, T2_UNIVERSE, "T2")
phrases = ms.load_cues(CUES)
settings, n_splits = spec["classification"], protocol["splits"]["inner"]["n_splits"]
wells = acts["well"].to_numpy()
runs = dest / "t2_runs"
runs.mkdir(parents=True, exist_ok=True)
plan = t2_plan()
for i, (f, c, seed) in enumerate(plan):
if i % shard[1] != shard[0]:
continue
name = f"f{f:.2f}_c{c:.2f}_s{seed}"
meta = runs / f"{name}.json"
if meta.is_file() and json.loads(meta.read_text()).get("protocol_sha256") == digest:
continue
start = time.time()
y, cue = ms.plant_t2(len(acts), T2_PI, c, f, len(phrases), ms.planting_rng(seed, c, f))
text = ms.t2_text(ms.apply_cues(acts, cue, phrases))
scores, chosen = ms.t2_oof(ms.t2_inputs(acts, text), y, settings, n_splits)
exposure = ms.cue_exposure(text, y, phrases)
row = {"arm": "t2", "f": f, "c": c, "seed": seed, **ms.ap_row(y, scores, wells, RESAMPLES, CI_SEED),
"cue_rate_planted": float((cue[y] >= 0).mean()), "cue_rate_unplanted": float((cue[~y] >= 0).mean()),
"exposure_planted": exposure["planted"], "exposure_unplanted": exposure["unplanted"],
"logistic_c": chosen, "seconds": round(time.time() - start, 1), "protocol_sha256": digest}
m34.write_parquet(pd.DataFrame({"act_id": acts["act_id"], "well": wells, "planted": y, "cue": cue,
"score": scores}), runs / f"{name}.parquet")
m34.atomic_write(meta, json.dumps(row, indent=1).encode())
print(f"[{i + 1}/{len(plan)}] t2 {name}: AP {row['ap']:.4f} ({row['seconds']} s)", flush=True)
def t2_plan():
return [(f, c, BASE_SEED + k) for f in (T2_F_PRIMARY, T2_F_SENSITIVITY) for c in T2_C for k in range(SEEDS)]
def collect_t2(dest, digest):
"""Every finished T2 planting of the current protocol, in plan order."""
rows = []
for f, c, seed in t2_plan():
meta = dest / "t2_runs" / f"f{f:.2f}_c{c:.2f}_s{seed}.json"
if meta.is_file() and (row := json.loads(meta.read_text())).get("protocol_sha256") == digest:
rows.append(row)
return pd.DataFrame(rows)
def run_t3(root, dest):
cells = pd.read_parquet(root / "m34/features_t3.parquet", columns=ms.T3_COLUMNS)
check_universe(cells, T3_UNIVERSE, "T3")
z = ms.zscore(cells["md_top"])
wells = cells["well"].to_numpy()
rows, frames = [], []
for s in T3_S:
for k in range(SEEDS):
seed = BASE_SEED + k
a, p, y = ms.plant_t3(z, s, T3_PI, ms.planting_rng(seed, s))
scores = ms.t3_scores(cells, y)
oracle = ms.ap_row(y, p, wells, RESAMPLES, CI_SEED)
rows.append({"arm": "t3", "s": s, "seed": seed, "intercept": a, "mean_p": float(p.mean()),
**ms.ap_row(y, scores, wells, RESAMPLES, CI_SEED), "oracle_ap": oracle["ap"],
"oracle_ci_low": oracle["ci_low"], "oracle_ci_high": oracle["ci_high"]})
frames.append(pd.DataFrame({"item": cells["item"], "well": wells, "s": s, "seed": seed, "p": p,
"planted": y, "score": scores}))
print(f"t3 s={s} seed={seed}: AP {rows[-1]['ap']:.4f}, oracle {oracle['ap']:.4f}", flush=True)
m34.write_parquet(pd.concat(frames, ignore_index=True), dest / "t3_scores.parquet")
return pd.DataFrame(rows)
def diagnose_t2(dest):
"""Post-hoc (not part of protocol v6): the model AP against the AP of the no-own-cue indicator, per setting."""
rows = []
for path in sorted((dest / "t2_runs").glob("*.parquet")):
meta = json.loads(path.with_suffix(".json").read_text())
run = pd.read_parquet(path)
y = run["planted"].to_numpy()
rows.append({"f": meta["f"], "c": meta["c"], "seed": meta["seed"], "prevalence": float(y.mean()),
"model_ap": meta["ap"], "no_cue_indicator_ap": ms.no_cue_indicator_ap(y, run["cue"]),
"own_cue_rate_planted": float((run["cue"][y] >= 0).mean()),
"own_cue_rate_unplanted": float((run["cue"][~y] >= 0).mean())})
seeds = pd.DataFrame(rows)
table = seeds.groupby(["f", "c"], as_index=False).mean(numeric_only=True).drop(columns="seed")
table["seeds"] = seeds.groupby(["f", "c"])["seed"].nunique().to_numpy()
table["expected_no_cue_ap_at_c0"] = [ms.expected_no_cue_ap(T2_PI, f) if np.isclose(c, 0) else np.nan
for f, c in zip(table["f"], table["c"])]
return table
def t2_block(seeds, reference):
block = {"settings": {}, "null_checks": {}}
table = ms.summarise(seeds, ["f", "c"], T2_PI)
for f, g in table.groupby("f"):
block["settings"][f"f={f:.2f}"] = g.drop(columns="f").to_dict(orient="records")
null = g[np.isclose(g["c"], 0.0)]
if len(null):
r = null.iloc[0]
block["null_checks"][f"f={f:.2f}"] = ms.null_check(r["ap_mean"], [r["seed0_ci_low"], r["seed0_ci_high"]],
T2_PI) | {"seeds": int(r["seeds"])}
primary = seeds[np.isclose(seeds["f"], T2_F_PRIMARY)]
complete = primary.groupby("c")["seed"].nunique().reindex(T2_C).fillna(0).eq(SEEDS).all()
block["effective_cue_rate"] = {"f": T2_F_PRIMARY, "complete_grid": bool(complete)}
if complete:
block["effective_cue_rate"] |= {
"reference_report": ms.interpolate_with_seeds(primary, "c", reference["ap"]),
"reference_stated_0.461": ms.interpolate_with_seeds(primary, "c", T2_STATED)}
return block, table
def t3_block(seeds, reference):
table = ms.summarise(seeds, ["s"], T3_PI)
null = table[np.isclose(table["s"], 0.0)].iloc[0]
oracle_null = ms.null_check(null["oracle_ap_mean"], None, T3_PI)
block = {"settings": table.to_dict(orient="records"),
"null_checks": {"depth_knn": ms.null_check(null["ap_mean"], [null["seed0_ci_low"], null["seed0_ci_high"]],
T3_PI) | {"seeds": int(null["seeds"])},
"oracle_mean_ap_at_s0": oracle_null["mean_ap"]},
"effective_strength": {
"reference_report": ms.interpolate_with_seeds(seeds, "s", reference["ap"]),
"reference_stated_0.150": ms.interpolate_with_seeds(seeds, "s", T3_STATED)}}
return block, table
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("--arm", choices=["t2", "t3", "all", "report", "diagnose"], default="all")
parser.add_argument("--shard", default="0/1", help="i/n: run the T2 plantings whose index modulo n is i")
args = parser.parse_args()
shard = tuple(int(v) for v in args.shard.split("/"))
try:
v6, digest = ms.verify_protocol(PROTOCOL, ROOT)
except ValueError as error:
raise SystemExit(str(error))
protocol, spec = m34.configuration()
root, digests = m34.inputs(protocol)
dest = root / "m5/synthetic"
dest.mkdir(parents=True, exist_ok=True)
if args.arm == "diagnose":
table = diagnose_t2(dest)
table.to_csv(dest / "null_diagnosis_t2.csv", index=False)
print(table.round(4).to_string(index=False))
references = {"t2": real_t2_reference(root), "t3": real_t3_reference(root)}
t3_path, t2_path = dest / "seeds_t3.csv", dest / "seeds_t2.csv"
if args.arm in ("t3", "all"):
run_t3(root, dest).to_csv(t3_path, index=False)
if args.arm in ("t2", "all"):
run_t2(root, dest, protocol, spec, digest, shard)
t2 = collect_t2(dest, digest)
if len(t2):
t2.drop(columns="logistic_c").assign(logistic_c=t2["logistic_c"].map(json.dumps)).to_csv(t2_path, index=False)
report = {"protocol": {"file": str(PROTOCOL.relative_to(ROOT)), "sha256": digest, "version": v6["version"],
"cues_sha256": v6["inputs_hashed"]["configs/synth_cues.yaml"]},
"inputs": digests, "references": references,
"design": {
"seeds": [BASE_SEED + k for k in range(SEEDS)], "rng": "numpy default_rng([seed, round(1000 x "
"setting) ...]); T2 settings (c, f), T3 setting s; one planting per seed and setting",
"ci": {"resamples": RESAMPLES, "seed": CI_SEED, "cluster": "well", "function": "m5_t5.ap_ci"},
"t2_pi": T2_PI, "t3_pi": T3_PI, "lift": "AP / pi (nominal pi)",
"t2_model": "m34_classify.fold_prediction (TF-IDF word 1-2 grams, min_df 2, sublinear tf, "
"max_features 60000; logistic C from [0.25, 1, 4] by inner GroupKFold(5) on wells, "
"average precision), leave-one-well-out, sequential folds",
"t2_inputs": "well + text_xml only: the real T2 frame has no numeric column in the model allowlist "
"(m34_classify.numeric_columns), so the baseline is text-only, as in M3-M4",
"t2_cue_placement": "phrase appended after the activity comment with one space before the text is "
"built; the real text construction (comments, previous, next, sum24Hr, "
"forecast24Hr joined by [SEP]) then also carries a cued comment into the "
"previous/next fields of adjacent activities of the same report "
"(see exposure_* columns)",
"t3_model": "m5_t5.knn_scores(features, planted, ['md_top']), k = 10, other wells",
"t3_covariate": "z-score of md_top over the 4,894 cells (population sd)"},
"outputs": {}}
if t3_path.is_file():
report["t3_hazard"], table = t3_block(pd.read_csv(t3_path), references["t3"])
table.to_csv(dest / "settings_t3.csv", index=False)
if t2_path.is_file():
seeds = pd.read_csv(t2_path)
report["t2_cues"], table = t2_block(seeds, references["t2"])
table.to_csv(dest / "settings_t2.csv", index=False)
report["t2_cues"]["runs"] = int(len(seeds))
report["t2_cues"]["seconds_total"] = float(seeds["seconds"].sum())
if (dest / "null_diagnosis_t2.csv").is_file():
report["t2_cues"]["null_diagnosis_post_hoc"] = {
"note": "not part of protocol v6: at c = 0 and f > 0 the absence of an own cue already points to a "
"planted row, so the setting is not a null; c = f is",
"rows": pd.read_csv(dest / "null_diagnosis_t2.csv").to_dict(orient="records")}
report["outputs"] = sorted(p.name for p in dest.iterdir() if p.is_file() and p.name != "report.json")
m34.atomic_write(dest / "report.json", json.dumps(report, indent=1, default=_json).encode())
def _json(value):
if isinstance(value, (np.integer, np.floating)):
return value.item()
if isinstance(value, np.bool_):
return bool(value)
raise TypeError(type(value))
if __name__ == "__main__":
main()

529
scripts/22_paper_figures.py Normal file
View File

@@ -0,0 +1,529 @@
#!/usr/bin/env python3
"""Paper figures from the locked result files (no model is run, no number is typed in by hand).
/home/jovyan/lamlvh/ML-Porosity/.venv/bin/python scripts/22_paper_figures.py
... scripts/22_paper_figures.py --outputs outputs --out paper/figures
Reads only outputs/m34/report.json, outputs/m5/errors/report.json, outputs/m5/synthetic/report.json and
outputs/m5/synthetic/settings_t{2,3}.csv. Writes t4_modes.pdf, taxonomy.pdf, leakage.pdf, planted.pdf and
figures_provenance.md. Before anything is drawn, every plotted quantity that docs/plan.md (Sec. 1.6-1.9) states is
compared with the stated value; any difference larger than the tolerance stops the script with exit code 2.
Needs matplotlib (the Volve-DIA .venv has none); the ML-Porosity interpreter has it. Output is deterministic: PDF
creation dates are removed and hash salts fixed.
"""
from __future__ import annotations
import argparse
import csv
import hashlib
import json
import os
import sys
from pathlib import Path
import numpy as np
os.environ.setdefault("SOURCE_DATE_EPOCH", "0")
import matplotlib # noqa: E402
matplotlib.use("pdf")
import matplotlib.pyplot as plt # noqa: E402
ROOT = Path(__file__).resolve().parents[1]
MM = 1 / 25.4
SINGLE, DOUBLE = 85 * MM, 170 * MM
DEEPSEEK = "vai-deepseek-v4-1-flash"
REPS = (0, 1, 2)
TOL = 0.002
# Okabe-Ito (colour-blind-safe); every colour is paired with a marker, line style or hatch.
OI = {"black": "#000000", "orange": "#E69F00", "sky": "#56B4E9", "green": "#009E73", "yellow": "#F0E442",
"blue": "#0072B2", "vermillion": "#D55E00", "purple": "#CC79A7", "grey": "#999999"}
# T4 modes, top to bottom: (mode, modality, label, group)
T4_MODES = [("zero_shot", "xml", "Zero-shot", "none"), ("few_shot", "xml", "Few-shot", "none"),
("rag", "xml", "RAG (XML)", "text"), ("c4", "xml", "C4 XML", "text"), ("c4", "html", "C4 HTML", "text"),
("c4", "ocr", "C4 OCR", "text"), ("tool_only", "xml", "Tool-only", "tool"),
("agent", "xml", "Agent", "tool")]
GROUPS = {"none": ("No report context", OI["orange"], "s"), "text": ("Text retrieval", OI["blue"], "o"),
"tool": ("Tools over XML tables", OI["green"], "D")}
# Error classes in protocol v4 order; the last one merges two classes that are below 0.03 in every mode.
CLASSES = [("correct", "Correct", OI["green"], ""), ("abstained", "Abstention", "#DDDDDD", ""),
("wrong_wellbore", "Wrong wellbore", OI["vermillion"], "//"),
("evidence_missed", "Wrong report cited", OI["orange"], "\\\\"),
("wrong_with_evidence", "Right report, wrong value", OI["sky"], ".."),
("failed", "Call failure", OI["purple"], "xx"),
(("no_citation", "answered_unanswerable"), "No citation or answered unanswerable", OI["yellow"], "--")]
# Values stated in docs/plan.md, used only to check the files; plotted values are always read from the files.
PLAN_T4 = {("zero_shot", "xml"): 0.071, ("few_shot", "xml"): 0.151, ("rag", "xml"): 0.148, ("c4", "xml"): 0.151,
("c4", "html"): 0.177, ("c4", "ocr"): 0.181, ("tool_only", "xml"): 0.712, ("agent", "xml"): 0.618}
PLAN_TAXONOMY = { # plan Sec. 1.7: correct, abstained, wrong_wellbore, evidence_missed, wrong_with_evidence, failed
("c4", "xml"): (0.151, 0.678, 0.095, 0.026, 0.047, 0), ("c4", "html"): (0.177, 0.535, 0.190, 0.025, 0.072, 0),
("c4", "ocr"): (0.181, 0.580, 0.137, 0.026, 0.074, 0), ("rag", "xml"): (0.148, 0.638, 0.110, 0.030, 0.066, 0),
("zero_shot", "xml"): (0.071, 0.891, 0.026, 0.012, 0, 0), ("few_shot", "xml"): (0.151, 0.739, 0.079, 0.009, 0, 0),
("tool_only", "xml"): (0.712, 0.083, 0.049, 0.008, 0.144, 0.004),
("agent", "xml"): (0.618, 0.129, 0.026, 0.014, 0.146, 0.064)}
PLAN_LEAK = { # plan Sec. 1.6 / 1.7, quantities on the primary subset ("all", XML)
"t2_tfidf_masked": (0.463, TOL), "t2_tfidf_unmasked": (0.995, TOL), "t2_tfidf_delta": (0.531, TOL),
"t2_distilbert_masked_seeds": ((0.579, 0.596, 0.603), TOL),
"t2_distilbert_delta_seeds": ((0.291, 0.283, 0.266), TOL),
"t2_majority_masked": (0.183, TOL), # majority AP is the prevalence; plan Sec. 1.9 states pi = 0.183
"t3_tfidf_masked": (0.1225, 0.0002), "t3_tfidf_unmasked": (0.1273, 0.0002), "t3_tfidf_delta": (0.0048, 0.0002),
"t3_distilbert_masked_mean": (0.121, TOL), "t3_majority": (0.114, TOL)}
PLAN_POOLED = { # plan Sec. 1.6 final paragraph: these equal means over subsets all + without_sidetrack (see notes)
("masked", "well", "majority"): 0.179, ("masked", "well", "lexicon"): 0.249,
("masked", "well", "tfidf_logistic"): 0.461, ("masked", "well", "distilbert"): 0.597,
("masked", "well", "vai_deepseek_zero_shot"): 0.405, ("masked", "well", "qwen_zero_shot"): 0.261,
("masked", "wellbore", "distilbert"): 0.619, ("masked", "wellbore", "tfidf_logistic"): 0.484,
("unmasked", "well", "tfidf_logistic"): 0.994, ("unmasked", "well", "distilbert"): 0.869}
PLAN_T2_CURVE = {0.0: 0.182, 0.1: 0.201, 0.25: 0.258, 0.5: 0.363, 0.75: 0.440, 1.0: 0.521}
PLAN_T3_CURVE = {0.0: (0.118, 0.115), 0.25: (0.119, 0.139), 0.5: (0.131, 0.176), 1.0: (0.191, 0.283),
2.0: (0.379, 0.489)}
PLAN_PLANTED = {"t2_pi": (0.183, TOL), "t2_real": (0.463, TOL), "c_eff": (0.82, 0.005), "c_lo": (0.78, 0.005),
"c_hi": (0.84, 0.005), "t3_pi": (0.114, TOL), "t3_real": (0.150, TOL), "s_eff": (0.66, 0.005),
"s_lo": (0.55, 0.005), "s_hi": (0.72, 0.005)}
class Checks:
def __init__(self):
self.rows, self.failed = [], []
def __call__(self, name, value, expected, tol=TOL):
ok = abs(value - expected) <= tol + 1e-12
self.rows.append((name, value, expected, tol, ok))
if not ok:
self.failed.append(f"{name}: file {value:.6f}, plan {expected}, |diff| {abs(value - expected):.6f} > {tol}")
def sha(path):
return hashlib.sha256(Path(path).read_bytes()).hexdigest()[:16]
def read_csv(path):
with open(path, newline="") as fh:
return list(csv.DictReader(fh))
def pick(rows, **kw):
return [r for r in rows if all(r.get(k) == v for k, v in kw.items())]
def one(rows, what):
if len(rows) != 1:
raise SystemExit(f"Expected one row for {what}, found {len(rows)}")
return rows[0]
# ---------------------------------------------------------------- data
def t4_data(m34, check):
out = []
for mode, modality, label, group in T4_MODES:
reps = []
for seed in REPS:
r = one(pick(m34["qa"], model=DEEPSEEK, mode=mode, modality=modality, seed=seed, subset="well",
average="macro_families"), f"T4 {mode} {modality} rep {seed}")
m = r["metrics"]["correct"]
reps.append((m["estimate"], m["ci"][0], m["ci"][1], r["n"]))
mean = float(np.mean([x[0] for x in reps]))
check(f"T4 {mode}/{modality} mean of 3 reps", mean, PLAN_T4[(mode, modality)])
out.append({"mode": mode, "modality": modality, "label": label, "group": group, "reps": reps, "mean": mean})
return out
def taxonomy_data(err, check):
out = []
for mode, modality, label, _ in T4_MODES:
r = one(pick(err["taxonomy_macro"], model=DEEPSEEK, mode=mode, modality=modality, family="macro"),
f"taxonomy {mode} {modality}")
if r["seeds"] != len(REPS):
raise SystemExit(f"taxonomy {mode} {modality}: {r['seeds']} repetitions, expected {len(REPS)}")
shares = [sum(r[k] for k in key) if isinstance(key, tuple) else r[key] for key, *_ in CLASSES]
if abs(sum(shares) - 1) > 1e-6:
raise SystemExit(f"taxonomy {mode} {modality}: shares sum to {sum(shares)}")
for (key, *_), share, plan in zip(CLASSES[:6], shares[:6], PLAN_TAXONOMY[(mode, modality)]):
check(f"taxonomy {mode}/{modality} {key}", share, plan)
out.append({"label": label, "mode": mode, "modality": modality, "shares": shares, "n": r["n"]})
return out
def ap_row(m34, task, mode, split, method, seed, subset="all", modality="xml"):
r = one(pick(m34["classification"], task=task, definition="b", mode=mode, split=split, method=method,
modality=modality, seed=seed, subset=subset), f"{task} {mode} {split} {method} seed {seed}")
m = r["metrics"]["pr_auc_ap"]
return m["estimate"], m["ci"][0], m["ci"][1]
def contrast_row(m34, task, method, seed):
r = one(pick(m34["classification_contrasts"], task=task, definition="b", method=method, seed=seed,
contrast="unmasked_minus_masked", subset="all", metric="pr_auc_ap"),
f"{task} {method} seed {seed} unmasked-masked")
return r["estimate"], r["ci"][0], r["ci"][1]
def leakage_data(m34, check):
d = {}
for task in ("t2", "t3"):
t = {"tfidf": {}, "distilbert": {}}
for mode in ("masked", "unmasked"):
t["tfidf"][mode] = [ap_row(m34, task, mode, "well", "tfidf_logistic", -1)]
t["distilbert"][mode] = [ap_row(m34, task, mode, "well", "distilbert", s) for s in REPS]
t["tfidf"]["delta"] = [contrast_row(m34, task, "tfidf_logistic", -1)]
t["distilbert"]["delta"] = [contrast_row(m34, task, "distilbert", s) for s in REPS]
t["majority"] = ap_row(m34, task, "masked", "well", "majority", -1)
if task == "t2":
t["lexicon"] = ap_row(m34, task, "masked", "well", "lexicon", -1)
d[task] = t
t2, t3 = d["t2"], d["t3"]
check("T2(b) TF-IDF masked AP", t2["tfidf"]["masked"][0][0], *PLAN_LEAK["t2_tfidf_masked"])
check("T2(b) TF-IDF unmasked AP", t2["tfidf"]["unmasked"][0][0], *PLAN_LEAK["t2_tfidf_unmasked"])
check("T2(b) TF-IDF unmasked-masked", t2["tfidf"]["delta"][0][0], *PLAN_LEAK["t2_tfidf_delta"])
for s, (row, plan) in enumerate(zip(t2["distilbert"]["masked"], PLAN_LEAK["t2_distilbert_masked_seeds"][0])):
check(f"T2(b) DistilBERT masked AP seed {s}", row[0], plan)
for s, (row, plan) in enumerate(zip(t2["distilbert"]["delta"], PLAN_LEAK["t2_distilbert_delta_seeds"][0])):
check(f"T2(b) DistilBERT unmasked-masked seed {s}", row[0], plan)
check("T2(b) majority masked AP (= prevalence)", t2["majority"][0], *PLAN_LEAK["t2_majority_masked"])
check("T3(b) TF-IDF masked AP", t3["tfidf"]["masked"][0][0], *PLAN_LEAK["t3_tfidf_masked"])
check("T3(b) TF-IDF unmasked AP", t3["tfidf"]["unmasked"][0][0], *PLAN_LEAK["t3_tfidf_unmasked"])
check("T3(b) TF-IDF unmasked-masked", t3["tfidf"]["delta"][0][0], *PLAN_LEAK["t3_tfidf_delta"])
check("T3(b) DistilBERT masked AP mean", float(np.mean([r[0] for r in t3["distilbert"]["masked"]])),
*PLAN_LEAK["t3_distilbert_masked_mean"])
check("T3(b) majority AP (= prevalence)", t3["majority"][0], *PLAN_LEAK["t3_majority"])
return d
def pooled_plan_check(m34, check):
"""The plan Sec. 1.6 summary values are means over subsets all + without_sidetrack (and XML + OCR for TF-IDF).
They are checked here so the origin of each stated value is reproducible; they are not plotted."""
out = []
for (mode, split, method), plan in PLAN_POOLED.items():
rows = [r for r in pick(m34["classification"], task="t2", definition="b", mode=mode, split=split,
method=method) if r["subset"] in ("all", "without_sidetrack")
and (r.get("metrics") or {}).get("pr_auc_ap", {}).get("estimate") is not None]
pooled = float(np.mean([r["metrics"]["pr_auc_ap"]["estimate"] for r in rows]))
primary = float(np.mean([r["metrics"]["pr_auc_ap"]["estimate"] for r in rows
if r["subset"] == "all" and r["modality"] == "xml"]))
check(f"plan pooled T2(b) {mode}/{split}/{method}", pooled, plan)
out.append((mode, split, method, plan, pooled, primary, len(rows)))
return out
def planted_data(outputs, syn, check):
t2 = [r for r in read_csv(outputs / "m5/synthetic/settings_t2.csv") if float(r["f"]) == 0.02]
t3 = read_csv(outputs / "m5/synthetic/settings_t3.csv")
t2 = sorted(({k: float(v) for k, v in r.items()} for r in t2), key=lambda r: r["c"])
t3 = sorted(({k: float(v) for k, v in r.items()} for r in t3), key=lambda r: r["s"])
for r in t2:
check(f"planted T2 f=0.02 c={r['c']} mean AP", r["ap_mean"], PLAN_T2_CURVE[r["c"]])
for r in t3:
check(f"planted T3 s={r['s']} mean AP", r["ap_mean"], PLAN_T3_CURVE[r["s"]][0])
check(f"planted T3 s={r['s']} oracle AP", r["oracle_ap_mean"], PLAN_T3_CURVE[r["s"]][1])
cue = syn["t2_cues"]["effective_cue_rate"]
if cue["f"] != 0.02:
raise SystemExit("effective cue rate is not reported for f = 0.02")
c_ref, s_ref = cue["reference_report"], syn["t3_hazard"]["effective_strength"]["reference_report"]
p = {"t2_pi": syn["design"]["t2_pi"], "t2_real": syn["references"]["t2"]["ap"], "c_eff": c_ref["value"],
"c_lo": c_ref["seed_range"][0], "c_hi": c_ref["seed_range"][1], "t3_pi": syn["design"]["t3_pi"],
"t3_real": syn["references"]["t3"]["ap"], "s_eff": s_ref["value"], "s_lo": s_ref["seed_range"][0],
"s_hi": s_ref["seed_range"][1]}
for k, v in p.items():
check(f"planted {k}", v, *PLAN_PLANTED[k])
if not syn["t2_cues"]["null_checks"]["f=0.02"]["null_check_passed"]:
raise SystemExit("protocol v6 null check for f = 0.02 did not pass; the curve must not be drawn as valid")
return t2, t3, p
# ---------------------------------------------------------------- drawing
def style():
plt.rcParams.update({
"font.family": "DejaVu Sans", "font.size": 7, "axes.labelsize": 7, "axes.titlesize": 7,
"xtick.labelsize": 6.5, "ytick.labelsize": 6.5, "legend.fontsize": 6.5, "axes.linewidth": 0.6,
"xtick.major.width": 0.6, "ytick.major.width": 0.6, "lines.linewidth": 1.0, "hatch.linewidth": 0.5,
"axes.spines.top": False, "axes.spines.right": False, "pdf.fonttype": 42, "ps.fonttype": 42,
"svg.hashsalt": "volve-dia", "figure.facecolor": "white", "axes.facecolor": "white",
"savefig.facecolor": "white", "legend.frameon": False})
def minus(text):
return text.replace("-", "\u2212")
def panel_tags(*axes):
for ax, tag in zip(axes, "abcdef"):
ax.set_title(f"({tag})", loc="left", fontsize=8, fontweight="bold")
def save(fig, path):
fig.savefig(path, format="pdf", metadata={"CreationDate": None, "ModDate": None, "Producer": None,
"Creator": "scripts/22_paper_figures.py"})
plt.close(fig)
def fig_t4(data, path):
fig, ax = plt.subplots(figsize=(SINGLE, 72 * MM), layout="constrained")
n = len(data)
for i, row in enumerate(data):
y = n - 1 - i
name, colour, marker = GROUPS[row["group"]]
for k, (est, lo, hi, _) in enumerate(row["reps"]):
yy = y + (k - 1) * 0.22
ax.plot([lo, hi], [yy, yy], color=colour, lw=0.8, solid_capstyle="butt")
ax.plot(est, yy, marker=marker, ms=3.2, color=colour, mec="white", mew=0.3, ls="none")
ax.plot([row["mean"]] * 2, [y - 0.38, y + 0.38], color=OI["black"], lw=1.3)
right = max(r[2] for r in row["reps"])
ax.text(right + 0.015, y, f"{row['mean']:.3f}", va="center", ha="left", fontsize=6.5)
ax.set_yticks(range(n), [r["label"] for r in reversed(data)])
ax.set_xlim(0, 0.9)
ax.set_ylim(-0.6, n - 0.4)
ax.set_xlabel("Macro-family accuracy (fraction correct)")
ax.xaxis.grid(True, color="#E5E5E5", lw=0.5)
ax.set_axisbelow(True)
handles = [plt.Line2D([], [], color=c, marker=m, ms=3.2, lw=0.8, label=lab) for lab, c, m in GROUPS.values()]
handles.append(plt.Line2D([], [], color=OI["black"], lw=1.3, label="Mean of 3 repetitions"))
fig.legend(handles=handles, loc="outside upper center", ncol=2, handlelength=1.6, columnspacing=1.0)
save(fig, path)
def luminance(hex_colour):
r, g, b = (int(hex_colour[i:i + 2], 16) / 255 for i in (1, 3, 5))
return 0.2126 * r + 0.7152 * g + 0.0722 * b
def fig_taxonomy(data, path):
fig, ax = plt.subplots(figsize=(DOUBLE, 70 * MM), layout="constrained")
n = len(data)
for i, row in enumerate(data):
y, left = n - 1 - i, 0.0
for (_, _, colour, hatch), share in zip(CLASSES, row["shares"]):
ax.barh(y, share, left=left, height=0.7, color=colour, hatch=hatch, edgecolor="#333333", lw=0.4)
if share >= 0.06:
txt = "white" if luminance(colour) < 0.35 else "black"
ax.text(left + share / 2, y, f"{share:.2f}", ha="center", va="center", fontsize=6, color=txt,
bbox=None if txt == "white" else {"boxstyle": "square,pad=0.08", "fc": colour, "lw": 0})
left += share
ax.set_yticks(range(n), [r["label"] for r in reversed(data)])
ax.set_xlim(0, 1)
ax.set_ylim(-0.6, n - 0.4)
ax.set_xlabel("Share of predictions, macro average over question families (mean of 3 repetitions)")
handles = [matplotlib.patches.Patch(facecolor=c, hatch=h, edgecolor="#333333", lw=0.4, label=lab)
for _, lab, c, h in CLASSES]
fig.legend(handles=handles, loc="outside upper center", ncol=4, handlelength=1.8, columnspacing=1.2)
save(fig, path)
def _leak_panel(ax, t, ymax, reference, ref_label, dec):
methods = [("tfidf", "TF-IDF + logistic"), ("distilbert", "DistilBERT")]
conds = [("masked", "Codes masked", "white", "////"), ("unmasked", "Codes shown", OI["blue"], "")]
width = 0.36
for j, (key, _) in enumerate(methods):
for k, (mode, _, colour, hatch) in enumerate(conds):
rows = t[key][mode]
x = j + (k - 0.5) * width
ax.bar(x, np.mean([r[0] for r in rows]), width=width * 0.92, color=colour, hatch=hatch,
edgecolor=OI["blue"], lw=0.7)
offs = np.linspace(-0.09, 0.09, len(rows)) if len(rows) > 1 else [0.0]
for off, (est, lo, hi) in zip(offs, rows):
ax.errorbar(x + off, est, yerr=[[est - lo], [hi - est]], fmt="o", ms=2.4, color=OI["black"],
mfc=OI["yellow"] if mode == "unmasked" else "white", mew=0.6, elinewidth=0.6, capsize=1.2)
deltas = t[key]["delta"]
top = max(r[2] for m in ("masked", "unmasked") for r in t[key][m])
if len(deltas) == 1:
est, lo, hi = deltas[0]
text = minus(f"Δ {est:+.{dec}f}\n({lo:.{dec}f} to {hi:.{dec}f})")
else:
excl = sum(lo > 0 or hi < 0 for _, lo, hi in deltas)
ests = [d[0] for d in deltas]
text = minus(f"Δ {min(ests):+.{dec}f} to {max(ests):+.{dec}f}\n"
f"(CI excludes 0: {excl}/{len(deltas)} seeds)")
ax.text(j, top + ymax * 0.03, text, ha="center", va="bottom", fontsize=6)
for value, label, ls in zip(reference, ref_label, ("--", ":")):
ax.axhline(value, color=OI["vermillion"], ls=ls, lw=0.9, zorder=0.5)
ax.text(1.42, value, f"{label} {value:.3f}", ha="left", va="bottom", fontsize=6, color=OI["vermillion"])
ax.set_xticks(range(len(methods)), [m[1] for m in methods])
ax.set_xlim(-0.55, 2.15)
ax.set_ylim(0, ymax)
handles = [matplotlib.patches.Patch(facecolor=c, hatch=h, edgecolor=OI["blue"], lw=0.7, label=lab)
for _, lab, c, h in conds]
return handles
def fig_leakage(d, path):
fig, (a, b) = plt.subplots(1, 2, figsize=(DOUBLE, 68 * MM), layout="constrained",
gridspec_kw={"width_ratios": [1, 1]})
handles = _leak_panel(a, d["t2"], 1.18, [d["t2"]["majority"][0], d["t2"]["lexicon"][0]],
["Majority", "Lexicon"], 3)
_leak_panel(b, d["t3"], 0.30, [d["t3"]["majority"][0]], ["Majority (π)"], 4)
a.set_ylabel("Average precision, T2(b) activity")
b.set_ylabel("Average precision, T3(b) depth cell")
panel_tags(a, b)
handles.append(plt.Line2D([], [], color=OI["black"], marker="o", mfc="white", ms=2.4, lw=0.6,
label="Run or seed with 95% well-cluster bootstrap CI"))
fig.legend(handles=handles, loc="outside upper center", ncol=3, handlelength=1.8)
save(fig, path)
def _curve(ax, x, mean, lo, hi, colour, marker, ls, label):
ax.fill_between(x, lo, hi, color=colour, alpha=0.18, lw=0)
ax.plot(x, mean, color=colour, marker=marker, ms=3.2, ls=ls, label=label)
def fig_planted(t2, t3, p, path):
fig, (a, b) = plt.subplots(1, 2, figsize=(DOUBLE, 62 * MM), layout="constrained")
c = [r["c"] for r in t2]
_curve(a, c, [r["ap_mean"] for r in t2], [r["ap_min"] for r in t2], [r["ap_max"] for r in t2], OI["blue"], "o",
"-", "TF-IDF on planted labels (mean, seed range)")
a.axhline(p["t2_pi"], color=OI["grey"], ls="--", lw=0.9, label=f"Prevalence π = {p['t2_pi']:.3f}")
a.axhline(p["t2_real"], color=OI["vermillion"], ls=":", lw=1.0,
label=f"Real masked TF-IDF AP = {p['t2_real']:.3f}")
a.axvspan(p["c_lo"], p["c_hi"], color=OI["vermillion"], alpha=0.12, lw=0)
a.axvline(p["c_eff"], color=OI["vermillion"], lw=0.8)
a.annotate(f"c ≈ {p['c_eff']:.2f}\n({p['c_lo']:.2f} to {p['c_hi']:.2f})", (p["c_eff"], p["t2_real"]),
xytext=(p["c_eff"] - 0.17, p["t2_real"] - 0.17), fontsize=6, ha="center",
arrowprops={"arrowstyle": "-", "lw": 0.5, "color": OI["vermillion"]})
a.set_xlabel("Cue fraction c of planted rows (decoy rate f = 0.02)")
a.set_ylabel("Average precision (leave-one-well-out)")
a.set_xlim(-0.03, 1.03)
a.set_ylim(0, 0.75)
a.legend(loc="upper left", handlelength=1.8)
s = [r["s"] for r in t3]
_curve(b, s, [r["ap_mean"] for r in t3], [r["ap_min"] for r in t3], [r["ap_max"] for r in t3], OI["blue"], "o",
"-", "Depth neighbour forecast (k = 10, other wells)")
_curve(b, s, [r["oracle_ap_mean"] for r in t3], [r["oracle_ap_min"] for r in t3],
[r["oracle_ap_max"] for r in t3], OI["orange"], "s", "--", "Oracle (true hazard)")
b.axhline(p["t3_pi"], color=OI["grey"], ls="--", lw=0.9, label=f"Prevalence π = {p['t3_pi']:.3f}")
b.axhline(p["t3_real"], color=OI["vermillion"], ls=":", lw=1.0,
label=f"Real depth-forecast AP = {p['t3_real']:.3f}")
b.axvspan(p["s_lo"], p["s_hi"], color=OI["vermillion"], alpha=0.12, lw=0)
b.axvline(p["s_eff"], color=OI["vermillion"], lw=0.8)
b.annotate(f"s ≈ {p['s_eff']:.2f}\n({p['s_lo']:.2f} to {p['s_hi']:.2f})", (p["s_eff"], p["t3_real"]),
xytext=(p["s_eff"] + 0.8, p["t3_real"] - 0.12), fontsize=6, ha="center",
arrowprops={"arrowstyle": "-", "lw": 0.5, "color": OI["vermillion"]})
b.set_xlabel("Signal strength s (log-odds per SD of measured depth)")
b.set_ylabel("Average precision (leave-one-well-out)")
b.set_xlim(-0.05, 2.05)
b.set_ylim(0, 0.75)
b.legend(loc="upper left", handlelength=1.8)
panel_tags(a, b)
save(fig, path)
# ---------------------------------------------------------------- provenance
def provenance(path, inputs, t4, tax, leak, pooled, t2, t3, p, checks):
f3 = "{:.3f}".format
lines = ["# Figure provenance", "",
"Written by `scripts/22_paper_figures.py`; do not edit by hand. Every plotted value is read from the "
"files below (sha256, first 16 hex). Checks against `docs/plan.md`: "
f"{sum(r[4] for r in checks.rows)}/{len(checks.rows)} within tolerance.", "",
"| Input | sha256 |", "| --- | --- |"]
lines += [f"| `{k}` | `{v}` |" for k, v in inputs.items()]
lines += ["", "## t4_modes.pdf", "",
f"Source: `outputs/m34/report.json` key `qa`, model `{DEEPSEEK}`, subset `well`, average "
"`macro_families`, metric `correct`; one point and 95% well-cluster bootstrap CI per repetition "
"(0, 1, 2); black tick = mean of the three estimates.", "",
"| Mode | n | Rep 0 | Rep 1 | Rep 2 | Mean |", "| --- | ---: | ---: | ---: | ---: | ---: |"]
for r in t4:
reps = " | ".join(f"{e:.3f} ({lo:.3f}-{hi:.3f})" for e, lo, hi, _ in r["reps"])
lines.append(f"| {r['label']} | {r['reps'][0][3]} | {reps} | {f3(r['mean'])} |")
lines += ["", "## taxonomy.pdf", "",
f"Source: `outputs/m5/errors/report.json` key `taxonomy_macro`, model `{DEEPSEEK}`, family `macro` "
"(macro over question families, mean of 3 repetitions, protocol v4 classes). The last segment merges "
"`no_citation` and `answered_unanswerable`.", "",
"| Mode | n | " + " | ".join(c[1] for c in CLASSES) + " |",
"| --- | ---: |" + " ---: |" * len(CLASSES)]
for r in tax:
lines.append(f"| {r['label']} | {int(r['n'])} | " + " | ".join(f3(s) for s in r["shares"]) + " |")
lines += ["", "## leakage.pdf", "",
"Source: `outputs/m34/report.json` keys `classification` (AP, `definition` b, `split` well, "
"`modality` xml, `subset` all) and `classification_contrasts` (`unmasked_minus_masked`, subset all, "
"paired 95% well-cluster bootstrap CI). Bars: TF-IDF single run, DistilBERT mean of seeds 0-2.", "",
"| Task | Method | Masked AP (CI) | Unmasked AP (CI) | Unmasked - masked (CI) |",
"| --- | --- | --- | --- | --- |"]
for task in ("t2", "t3"):
dec = 3 if task == "t2" else 4
for key, name in (("tfidf", "TF-IDF"), ("distilbert", "DistilBERT")):
cells = []
for part in ("masked", "unmasked", "delta"):
runs = leak[task][key][part]
cells.append("; ".join(f"{e:.{dec}f} ({lo:.{dec}f} to {hi:.{dec}f})" for e, lo, hi in runs))
lines.append(f"| {task.upper()}(b) | {name} | " + " | ".join(cells) + " |")
lines += ["", f"Reference lines (masked, by well, subset all): T2(b) majority {leak['t2']['majority'][0]:.4f}, "
f"lexicon {leak['t2']['lexicon'][0]:.4f}; T3(b) majority {leak['t3']['majority'][0]:.4f}.", "",
"**Discrepancy with plan Sec. 1.6 (final paragraph).** The values stated there equal the mean over the "
"subsets `all` and `without_sidetrack` (and over XML and OCR for TF-IDF), not the primary subset `all`. "
"The figure plots `all` (XML), the subset behind the earlier TF-IDF statement in plan Sec. 1.6, the "
"DistilBERT deltas in Sec. 1.7 and the protocol v6 reference AP (`references.t2.source`).", "",
"| Mode / split / method | Plan value | Pooled mean (= plan) | Primary `all`, XML | Rows pooled |",
"| --- | ---: | ---: | ---: | ---: |"]
lines += [f"| {m}/{s}/{meth} | {plan:.3f} | {pv:.4f} | {pr:.4f} | {n} |" for m, s, meth, plan, pv, pr, n in pooled]
lines += ["", "## planted.pdf", "",
"Sources: `outputs/m5/synthetic/settings_t2.csv` (rows f = 0.02; f = 0.10 is not drawn because its "
"protocol v6 null check failed), `outputs/m5/synthetic/settings_t3.csv`, and "
"`outputs/m5/synthetic/report.json` (`design.t2_pi`, `design.t3_pi`, `references.t2.ap`, "
"`references.t3.ap`, `t2_cues.effective_cue_rate.reference_report`, "
"`t3_hazard.effective_strength.reference_report`). Lines: mean over 5 seeds; bands: seed min-max.", "",
"| c | mean AP | min | max |", "| ---: | ---: | ---: | ---: |"]
lines += [f"| {r['c']:g} | {r['ap_mean']:.4f} | {r['ap_min']:.4f} | {r['ap_max']:.4f} |" for r in t2]
lines += ["", "| s | depth AP mean | min | max | oracle AP mean | min | max |",
"| ---: | ---: | ---: | ---: | ---: | ---: | ---: |"]
lines += [f"| {r['s']:g} | {r['ap_mean']:.4f} | {r['ap_min']:.4f} | {r['ap_max']:.4f} | "
f"{r['oracle_ap_mean']:.4f} | {r['oracle_ap_min']:.4f} | {r['oracle_ap_max']:.4f} |" for r in t3]
lines += ["", f"T2: prevalence {p['t2_pi']:.3f}, real masked TF-IDF AP {p['t2_real']:.4f}, effective cue fraction "
f"{p['c_eff']:.3f} (seed range {p['c_lo']:.3f} to {p['c_hi']:.3f}). T3: prevalence {p['t3_pi']:.4f}, "
f"real depth-forecast AP {p['t3_real']:.4f}, effective strength {p['s_eff']:.3f} (seed range "
f"{p['s_lo']:.3f} to {p['s_hi']:.3f}).", "", "## Checks against docs/plan.md", "",
"| Quantity | File | Plan | Tolerance | OK |", "| --- | ---: | ---: | ---: | --- |"]
lines += [f"| {n} | {v:.4f} | {e} | {t} | {'yes' if ok else 'NO'} |" for n, v, e, t, ok in checks.rows]
Path(path).write_text("\n".join(lines) + "\n")
def main(argv=None):
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
ap.add_argument("--outputs", type=Path, default=ROOT / "outputs", help="result directory (read only)")
ap.add_argument("--out", type=Path, default=ROOT / "paper/figures", help="figure directory")
args = ap.parse_args(argv)
files = {"m34": args.outputs / "m34/report.json", "errors": args.outputs / "m5/errors/report.json",
"synthetic": args.outputs / "m5/synthetic/report.json"}
m34, err, syn = (json.loads(files[k].read_text()) for k in ("m34", "errors", "synthetic"))
if not m34["g2_v2"]["passed"]:
raise SystemExit("outputs/m34/report.json: g2_v2 has not passed")
checks = Checks()
t4 = t4_data(m34, checks)
tax = taxonomy_data(err, checks)
leak = leakage_data(m34, checks)
pooled = pooled_plan_check(m34, checks)
t2, t3, p = planted_data(args.outputs, syn, checks)
if checks.failed:
print("Result files contradict docs/plan.md; no figure written:", file=sys.stderr)
for line in checks.failed:
print(" " + line, file=sys.stderr)
return 2
args.out.mkdir(parents=True, exist_ok=True)
style()
fig_t4(t4, args.out / "t4_modes.pdf")
fig_taxonomy(tax, args.out / "taxonomy.pdf")
fig_leakage(leak, args.out / "leakage.pdf")
fig_planted(t2, t3, p, args.out / "planted.pdf")
inputs = {str(f.relative_to(args.outputs.parent)) if f.is_relative_to(args.outputs.parent) else str(f): sha(f)
for f in [*files.values(), args.outputs / "m5/synthetic/settings_t2.csv",
args.outputs / "m5/synthetic/settings_t3.csv"]}
provenance(args.out / "figures_provenance.md", inputs, t4, tax, leak, pooled, t2, t3, p, checks)
print(f"{len(checks.rows)} checks passed; wrote 4 figures and figures_provenance.md to {args.out}")
print("NOTE: these plan Sec. 1.6 T2(b) summary values are means over subsets all + without_sidetrack; the "
"figure plots subset all (see figures_provenance.md):")
for mode, split, method, plan, pv, pr, _ in pooled:
print(f" {mode}/{split}/{method}: plan {plan:.3f} = pooled {pv:.4f}; primary all/xml {pr:.4f}")
return 0
if __name__ == "__main__":
sys.exit(main())

222
tests/test_m5_synthetic.py Normal file
View File

@@ -0,0 +1,222 @@
from __future__ import annotations
import hashlib
import numpy as np
import pandas as pd
import pytest
import yaml
from volve_dia import m5_synthetic as ms
from volve_dia.paths import REPO_ROOT
PHRASES = [("equipment", "Top drive failure."), ("weather", "Waiting on weather.")]
def toy_acts(n=60, wells=4):
rng = np.random.default_rng(0)
words = np.array(["drilled", "circulated", "tripped", "reamed", "logged", "cased"])
return pd.DataFrame({
"act_id": [f"A{i:03d}" for i in range(n)], "report_id": [f"R{i // 5:02d}" for i in range(n)],
"well": [f"W{i % wells}" for i in range(n)], "seq": [i % 5 for i in range(n)],
"comments": [" ".join(rng.choice(words, 4)) if i % 7 else None for i in range(n)],
"sum24Hr": ["day summary"] * n, "forecast24Hr": ["forecast"] * n})
@pytest.mark.parametrize("s", [0.0, 0.25, 1.0, 2.0, 5.0])
def test_bisection_hits_target_mean(s):
z = ms.zscore(np.random.default_rng(1).gamma(2.0, 1000.0, size=4000))
a = ms.solve_intercept(z, s, 0.114)
assert abs((1 / (1 + np.exp(-(a + s * z)))).mean() - 0.114) < 1e-9
if s == 0:
assert a == pytest.approx(np.log(0.114 / 0.886), abs=1e-9)
def test_zscore_is_standard():
z = ms.zscore([1.0, 2.0, 3.0, 10.0])
assert z.mean() == pytest.approx(0) and z.std() == pytest.approx(1)
def test_t2_planting_rates_within_tolerance():
n, pi, c, f = 200_000, 0.183, 0.5, 0.02
y, cue = ms.plant_t2(n, pi, c, f, 21, ms.planting_rng(20261117, c, f))
assert abs(y.mean() - pi) < 0.004
assert abs((cue[y] >= 0).mean() - c) < 0.01
assert abs((cue[~y] >= 0).mean() - f) < 0.003
counts = np.bincount(cue[cue >= 0], minlength=21) / (cue >= 0).sum()
assert np.abs(counts - 1 / 21).max() < 0.01
assert cue.min() >= -1 and cue.max() < 21
def test_t2_planting_extremes():
y, cue = ms.plant_t2(10_000, 0.183, 1.0, 0.0, 3, ms.planting_rng(1, 1.0, 0.0))
assert (cue[y] >= 0).all() and (cue[~y] == -1).all()
y, cue = ms.plant_t2(10_000, 0.183, 0.0, 0.0, 3, ms.planting_rng(1, 0.0, 0.0))
assert (cue == -1).all()
def test_t3_planting_prevalence():
z = ms.zscore(np.linspace(0, 5000, 50_000))
a, p, y = ms.plant_t3(z, 1.0, 0.114, ms.planting_rng(20261117, 1.0))
assert p.mean() == pytest.approx(0.114, abs=1e-9)
assert abs(y.mean() - 0.114) < 0.006
assert np.corrcoef(z, p)[0, 1] > 0.8
def test_seeds_are_deterministic_and_distinct():
first = ms.plant_t2(1000, 0.183, 0.5, 0.02, 21, ms.planting_rng(20261117, 0.5, 0.02))
again = ms.plant_t2(1000, 0.183, 0.5, 0.02, 21, ms.planting_rng(20261117, 0.5, 0.02))
other_seed = ms.plant_t2(1000, 0.183, 0.5, 0.02, 21, ms.planting_rng(20261118, 0.5, 0.02))
other_setting = ms.plant_t2(1000, 0.183, 0.5, 0.10, 21, ms.planting_rng(20261117, 0.5, 0.10))
assert all(np.array_equal(u, v) for u, v in zip(first, again))
assert not np.array_equal(first[0], other_seed[0])
assert not np.array_equal(first[0], other_setting[0])
def test_cue_appended_after_comment_only_where_specified():
acts = toy_acts()
cue = np.full(len(acts), -1)
cue[[1, 7, 12]] = [0, 1, 0] # row 7 has no comment
out = ms.apply_cues(acts, cue, PHRASES)
assert out.loc[1, "comments"] == acts.loc[1, "comments"] + " Top drive failure."
assert out.loc[7, "comments"] == "Waiting on weather."
assert out.loc[12, "comments"] == acts.loc[12, "comments"] + " Top drive failure."
untouched = np.setdiff1d(np.arange(len(acts)), [1, 7, 12])
pd.testing.assert_frame_equal(out.iloc[untouched], acts.iloc[untouched])
pd.testing.assert_frame_equal(out.drop(columns="comments"), acts.drop(columns="comments"))
assert acts.loc[1, "comments"] != out.loc[1, "comments"] # the input frame is not modified
def test_text_matches_the_real_construction():
acts = toy_acts()
cue = np.full(len(acts), -1)
cue[1] = 0
text = ms.t2_text(ms.apply_cues(acts, cue, PHRASES))
# Fields: comments, previous, next, sum24Hr, forecast24Hr of the same report.
assert text[1].split(" [SEP] ")[0].endswith("Top drive failure.")
assert text[2].split(" [SEP] ")[1].endswith("Top drive failure.")
assert text[0].split(" [SEP] ")[2].endswith("Top drive failure.")
assert "Top drive" not in text[5] # another report
x = ms.t2_inputs(acts, text)
assert list(x.columns) == ["well", "text"]
def test_null_calibration_on_toy_case():
rng = np.random.default_rng(3)
n, pi = 20_000, 0.2
y = rng.random(n) < pi
wells = np.repeat(np.arange(10), n // 10)
aps = [ms.ap_row(y, rng.random(n), wells, 200, 1) for _ in range(5)]
mean = np.mean([a["ap"] for a in aps])
check = ms.null_check(mean, [aps[0]["ci_low"], aps[0]["ci_high"]], y.mean())
assert check["null_check_passed"]
assert not ms.null_check(pi + 0.05, [pi + 0.02, pi + 0.08], pi)["null_check_passed"]
assert not ms.null_check(pi + 0.005, [pi + 0.001, pi + 0.01], pi)["null_check_passed"]
def test_null_calibration_of_the_t2_pipeline_on_toy_text():
acts = toy_acts(n=400, wells=4)
settings = {"tfidf_min_df": 2, "logistic_c": [1.0]}
y, cue = ms.plant_t2(len(acts), 0.25, 0.0, 0.2, len(PHRASES), ms.planting_rng(5, 0.0, 0.2))
x = ms.t2_inputs(acts, ms.t2_text(ms.apply_cues(acts, cue, PHRASES)))
scores, chosen = ms.t2_oof(x, y, settings, n_splits=3)
assert np.isfinite(scores).all() and set(chosen) == {"W0", "W1", "W2", "W3"}
y1, cue1 = ms.plant_t2(len(acts), 0.25, 1.0, 0.0, len(PHRASES), ms.planting_rng(5, 1.0, 0.0))
x1 = ms.t2_inputs(acts, ms.t2_text(ms.apply_cues(acts, cue1, PHRASES)))
strong, _ = ms.t2_oof(x1, y1, settings, n_splits=3)
from sklearn.metrics import average_precision_score
assert average_precision_score(y1, strong) > average_precision_score(y, scores) + 0.2
def test_t3_knn_scores_use_other_wells():
cells = pd.DataFrame({"well": ["A"] * 20 + ["B"] * 20, "md_top": np.tile(np.arange(20.0), 2)})
y = np.r_[np.ones(20), np.zeros(20)]
scores = ms.t3_scores(cells, y)
assert (scores[:20] == 0).all() and (scores[20:] == 1).all()
def test_interpolation_within_and_out_of_range():
grid = [0.0, 0.1, 0.25, 0.5, 0.75, 1.0]
values = [0.18, 0.2, 0.3, 0.4, 0.6, 0.8]
r = ms.interpolate(grid, values, 0.35)
assert r["value"] == pytest.approx(0.375) and r["out_of_range"] is None
assert ms.interpolate(grid, values, 0.18)["value"] == pytest.approx(0.0)
assert ms.interpolate(grid, values, 0.8)["value"] == pytest.approx(1.0)
assert ms.interpolate(grid, values, 0.9) == {"value": None, "out_of_range": "above_last_grid_point",
"target": 0.9}
assert ms.interpolate(grid, values, 0.1)["out_of_range"] == "below_first_grid_point"
# A non-monotone curve uses the first bracketing segment.
r = ms.interpolate([0, 1, 2, 3], [0.1, 0.5, 0.3, 0.6], 0.4)
assert r["value"] == pytest.approx(0.75) and r["monotone"] is False
def test_interpolation_with_seed_range():
rows = pd.DataFrame({"seed": np.repeat([0, 1], 3), "c": np.tile([0.0, 0.5, 1.0], 2),
"ap": [0.2, 0.4, 0.6, 0.2, 0.3, 0.4]})
r = ms.interpolate_with_seeds(rows, "c", 0.45)
assert r["value"] == pytest.approx(0.5 + 0.1 / 0.15 * 0.5)
assert r["per_seed"][0]["value"] == pytest.approx(0.625)
assert r["per_seed"][1]["out_of_range"] == "above_last_grid_point"
assert r["seed_range"] == [pytest.approx(0.625), pytest.approx(0.625)] and r["seeds_out_of_range"] == 1
mean = ms.interpolate([0.0, 0.5, 1.0], [0.2, 0.35, 0.5], 0.45)
assert r["value"] == pytest.approx(mean["value"])
def test_summarise_reports_mean_range_and_seed0():
rows = pd.DataFrame({"s": [0.0] * 3, "seed": [3, 1, 2], "ap": [0.12, 0.10, 0.11], "ci_low": [0.0, 0.09, 0.0],
"ci_high": [1.0, 0.13, 1.0], "prevalence": [0.11, 0.115, 0.112]})
table = ms.summarise(rows, ["s"], 0.114)
row = table.iloc[0]
assert row["ap_mean"] == pytest.approx(0.11) and row["ap_min"] == 0.10 and row["ap_max"] == 0.12
assert row["seed0_ap"] == 0.10 and row["seed0_ci_low"] == 0.09
assert row["lift_mean"] == pytest.approx(0.11 / 0.114)
def _locked_pair(tmp_path, cue_text="cues: {a: [x]}\n"):
(tmp_path / "configs").mkdir()
cues = tmp_path / "configs/synth_cues.yaml"
cues.write_text(cue_text)
parent = tmp_path / "configs/parent.yaml"
parent.write_text("version: 5\n")
protocol = tmp_path / "configs/protocol_test.yaml"
protocol.write_text(yaml.safe_dump({
"status": "locked", "version": 6,
"extends": {"file": "configs/parent.yaml", "sha256": hashlib.sha256(parent.read_bytes()).hexdigest()},
"inputs_hashed": {"configs/synth_cues.yaml": hashlib.sha256(cues.read_bytes()).hexdigest()}}))
protocol.with_suffix(".yaml.sha256").write_text(
hashlib.sha256(protocol.read_bytes()).hexdigest() + " configs/protocol_test.yaml\n")
return protocol, cues
def test_verify_protocol_accepts_and_refuses(tmp_path):
protocol, cues = _locked_pair(tmp_path)
parsed, digest = ms.verify_protocol(protocol, tmp_path)
assert parsed["version"] == 6 and len(digest) == 64
cues.write_text("cues: {a: [y]}\n")
with pytest.raises(ValueError, match="synth_cues.yaml"):
ms.verify_protocol(protocol, tmp_path)
def test_verify_protocol_refuses_edited_protocol(tmp_path):
protocol, _ = _locked_pair(tmp_path)
protocol.write_text(protocol.read_text() + "# edited\n")
with pytest.raises(ValueError, match="checksum"):
ms.verify_protocol(protocol, tmp_path)
def test_locked_v6_and_cues_verify():
protocol, _ = ms.verify_protocol(REPO_ROOT / "configs/protocol_v6.yaml", REPO_ROOT)
assert protocol["t2_cues"]["settings"]["c"] == [0.0, 0.1, 0.25, 0.5, 0.75, 1.0]
assert protocol["t3_hazard"]["settings"]["s"] == [0.0, 0.25, 0.5, 1.0, 2.0]
phrases = ms.load_cues(REPO_ROOT / "configs/synth_cues.yaml")
assert len(phrases) == 21 and len({p for _, p in phrases}) == 21
def test_absence_of_a_cue_is_signal_when_f_exceeds_c():
rng = np.random.default_rng(5)
n, pi, f = 200_000, 0.183, 0.10
y, cue = ms.plant_t2(n, pi, 0.0, f, 20, rng)
assert ms.no_cue_indicator_ap(y, cue) == pytest.approx(ms.expected_no_cue_ap(pi, f), abs=0.004)
assert ms.expected_no_cue_ap(pi, f) > pi + 0.01
y, cue = ms.plant_t2(n, pi, f, f, 20, rng) # c = f is the true null: the cue is independent of the label
assert ms.no_cue_indicator_ap(y, cue) == pytest.approx(pi, abs=0.004)

100
tests/test_paper_numbers.py Normal file
View File

@@ -0,0 +1,100 @@
"""Unit tests for paper/check_numbers.py on small temporary files (no Volve data needed)."""
import importlib.util
import json
import sys
from pathlib import Path
import pytest
SCRIPT = Path(__file__).resolve().parents[1] / "paper" / "check_numbers.py"
@pytest.fixture(scope="module")
def cn():
spec = importlib.util.spec_from_file_location("check_numbers", SCRIPT)
mod = importlib.util.module_from_spec(spec)
sys.modules["check_numbers"] = mod # dataclasses resolve annotations through sys.modules
spec.loader.exec_module(mod)
return mod
@pytest.fixture()
def repo(tmp_path):
(tmp_path / "docs").mkdir()
(tmp_path / "docs/plan.md").write_text("Độ chính xác C4 XML 0,151; HTML 0,177; 1.376 câu hỏi; κ 0,6.\n",
encoding="utf-8")
(tmp_path / "AGENTS.md").write_text("AP 0.463 masked, 23,447 activities, CER 2.40%.\n", encoding="utf-8")
rep = tmp_path / "outputs/m34"
rep.mkdir(parents=True)
(rep / "report.json").write_text(json.dumps({"ap": 0.61834, "flag": True, "rows": [{"n": 932}],
"note": "delta -0.531"}), encoding="utf-8")
(rep / "qa.csv").write_text("mode,acc\ntool_only,0.7123\n", encoding="utf-8")
(tmp_path / "paper/sections").mkdir(parents=True)
return tmp_path
def _found(cn, text):
return [(f.token, f.value, f.decimals, f.percent) for f in cn.extract_numbers(text)]
def test_registry_reads_vietnamese_and_outputs(cn, repo):
reg = cn.build_registry(repo)
for value, dec in [(0.151, 3), (1376, 0), (1.376, 3), (0.6, 1), (23447, 0), (0.0240, 4),
(0.618, 3), (0.62, 2), (932, 0), (0.531, 3), (0.712, 3)]:
assert reg.contains(value, dec), value
assert not reg.contains(0.619, 3)
assert not reg.contains(2.40, 2) # a percentage in the docs enters as its fraction only
assert "outputs/**/summary.json" in reg.missing # missing sources are reported, not fatal
def test_extract_ignores_references_dates_and_identifiers(cn):
text = (r"See Table~\ref{tab:t4} and \citep{smith2019}. On 20/11/2026 (20 November 2026) protocol\_v6"
r" and T4 ran on 15/9-F-15~S with sha 3c8021f9, matplotlib 3.11.2, width 0.8\textwidth, 2pt."
"\n% a comment 0.999\n"
r"\label{sec:x7}\todo{check 0.5} Accuracy 0.151 on 1{,}376 and 23,447 items, 15.1\% or 15.1 per cent.")
found = _found(cn, text)
assert [t for t, *_ in found] == ["0.151", "1,376", "23,447", "15.1", "15.1"]
assert found[0][1:] == (0.151, 3, False)
assert found[1][1] == 1376 and found[2][1] == 23447
assert found[3][3] and found[4][3]
def test_table_column_with_percent_header(cn):
text = ("\\begin{tabular}{lrr}\n\\toprule\nItem & Exact & CER (\\%) \\\\\n\\midrule\n"
"Rig name & 0.339 & 5.16 \\\\\nHeaders & 3,504 & 2.51 \\\\\n\\end{tabular}\nThen 2.51 again.\n")
found = _found(cn, text)
assert [(t, p) for t, _, _, p in found] == [("0.339", False), ("5.16", True), ("3,504", False),
("2.51", True), ("2.51", False)]
def test_check_lines_percent_and_allowlist(cn, repo):
tex = repo / "paper/sections/06_results.tex"
tex.write_text("XML 0.151 and HTML 0.18 with 1,376 questions.\n"
"Tool use 71.2\\% but 0.712\\% is wrong, and 15.1 is not a percent.\n"
"A difference of $-0.531$; derived 0.123; CER 2.4\\% but 2.40.\n", encoding="utf-8")
allow = repo / "paper/number_allowlist.txt"
allow.write_text("# hand-checked\n0.123 # 0.712 - 0.589, computed in the text\n0.4\n", encoding="utf-8")
entries, problems = cn.read_allowlist(allow)
assert entries == [(0.123, 3)] and len(problems) == 1
res = cn.check([tex], cn.build_registry(repo), entries)[str(tex)]
status = {(f.line, f.token): f.status for f in res}
assert status[(1, "0.151")] == "matched" and status[(1, "0.18")] == "matched"
assert status[(1, "1,376")] == "matched"
assert status[(2, "71.2")] == "matched-percent"
assert status[(2, "0.712")] == "unmatched" # 0.712 % would be 0.00712
assert status[(2, "15.1")] == "unmatched" # 0.151 is only accepted when marked as a percentage
assert status[(3, "0.531")] == "matched" and status[(3, "0.123")] == "allowlisted"
assert status[(3, "2.4")] == "matched-percent" and status[(3, "2.40")] == "unmatched"
def test_main_exit_codes_and_missing_files(cn, repo, capsys):
assert cn.main(["--root", str(repo)]) == 0 # no .tex files and no allowlist
assert "No .tex files found" in capsys.readouterr().out
assert cn.main(["--root", str(repo), "--sections", str(repo / "absent")]) == 0
(repo / "paper/sections/01.tex").write_text("ok 0.151\nbad 0.999\n", encoding="utf-8")
assert cn.main(["--root", str(repo)]) == 1
out = capsys.readouterr().out
assert "L2: 0.999" in out and "1 unmatched" in out
assert cn.main(["--root", str(repo), "--summary"]) == 1
assert "L2:" not in capsys.readouterr().out

240
volve_dia/m5_synthetic.py Normal file
View File

@@ -0,0 +1,240 @@
"""Planted-signal studies with known ground truth under protocol v6 (T2 text cues, T3 depth hazard).
The planted label is drawn by a fixed random rule, so the truth is known exactly. The real activity codes and the
real T2/T3 labels are never read. The T2 model is the M3-M4 TF-IDF + logistic baseline unchanged; the T3 forecast is
the v5 depth neighbour forecast.
"""
from __future__ import annotations
import numpy as np
import pandas as pd
import yaml
from scipy.special import expit
from sklearn.model_selection import LeaveOneGroupOut
from .m34_classify import fold_prediction, model_inputs
from .m34_features import TEXT, activity_text, strings
from .m5_judge import sha256_file
from .m5_t5 import ap_ci, knn_scores
T2_COLUMNS = ["act_id", "report_id", "well", "seq", "comments", "sum24Hr", "forecast24Hr"]
T3_COLUMNS = ["item", "well", "wellbore", "md_top"]
def verify_protocol(protocol_path, repo_root):
"""Return the parsed protocol, or raise if it or any hashed input differs from its locked checksum."""
expected = protocol_path.with_suffix(".yaml.sha256").read_text().split()[0]
actual = sha256_file(protocol_path)
if actual != expected:
raise ValueError(f"{protocol_path.name} does not match its checksum")
protocol = yaml.safe_load(protocol_path.read_text())
if protocol.get("status") != "locked":
raise ValueError(f"{protocol_path.name} is not locked")
parent = protocol.get("extends")
if parent and sha256_file(repo_root / parent["file"]) != parent["sha256"]:
raise ValueError(f"{parent['file']} does not match the checksum recorded in {protocol_path.name}")
for name, digest in protocol.get("inputs_hashed", {}).items():
if sha256_file(repo_root / name) != digest:
raise ValueError(f"{name} does not match the checksum recorded in {protocol_path.name}")
return protocol, actual
def load_cues(path):
"""Flat list of (class, phrase) in file order."""
cues = yaml.safe_load(path.read_text())["cues"]
return [(cls, phrase) for cls, phrases in cues.items() for phrase in phrases]
def planting_rng(seed, *settings):
"""Deterministic generator for one planting: the seed plus each setting in thousandths."""
return np.random.default_rng([int(seed), *(int(round(float(v) * 1000)) for v in settings)])
# T2 text cues ---------------------------------------------------------------------------------------------------
def plant_t2(n, pi, c, f, n_phrases, rng):
"""y ~ Bernoulli(pi); a cue with probability c (planted) or f (unplanted); phrase uniform. -1 means no cue."""
y = rng.random(n) < pi
u = rng.random(n)
cued = np.where(y, u < c, u < f)
phrase = rng.integers(0, n_phrases, size=n)
return y, np.where(cued, phrase, -1)
def apply_cues(acts, cue, phrases):
"""Append the chosen phrase after the comment with one space. Rows without a cue are unchanged."""
out = acts.copy()
cue = np.asarray(cue)
rows = np.flatnonzero(cue >= 0)
text = np.array([p for _, p in phrases], dtype=object)[cue[rows]]
base = out["comments"].iloc[rows]
out.iloc[rows, out.columns.get_loc("comments")] = np.where(
base.isna(), text, base.fillna("").astype(str).to_numpy(dtype=object) + " " + text)
return out
def t2_text(acts):
"""The masked XML text of the real T2 frame (m34_features.t2_frame), in the row order of acts."""
view = activity_text(acts)
return acts["act_id"].map(strings(view.set_index("act_id"), TEXT)).to_numpy()
def t2_inputs(acts, text):
"""Model inputs as m34_classify.model_inputs(frame, 'masked', 'xml'); the T2 frame has no numeric column."""
frame = pd.DataFrame({"well": acts["well"].to_numpy(), "text_xml": text})
return model_inputs(frame, "masked", "xml")
def t2_oof(x, y, settings, n_splits, group="well"):
"""Leave-one-well-out out-of-fold scores with the M3-M4 fold fit (inner GroupKFold over C)."""
scores = np.full(len(x), np.nan)
chosen = {}
groups = x[group].to_numpy()
for train_idx, test_idx in LeaveOneGroupOut().split(x, y, groups=groups):
train_wells = x["well"].iloc[train_idx]
tune = np.flatnonzero(~train_wells.isin(x["well"].iloc[test_idx]).to_numpy())
out, c, _ = fold_prediction(x.iloc[train_idx], y[train_idx], tune, {"xml": x.iloc[test_idx]}, "t2",
settings, n_splits, None)
scores[test_idx] = out["xml"][1]
chosen[str(groups[test_idx[0]])] = c
return scores, chosen
def cue_exposure(text, y, phrases):
"""Share of planted and unplanted rows whose model text contains any phrase (own comment or neighbour field)."""
contains = np.zeros(len(text), dtype=bool)
for _, phrase in phrases:
contains |= pd.Series(text).str.contains(phrase, regex=False).to_numpy()
return {"planted": float(contains[y].mean()) if y.any() else None,
"unplanted": float(contains[~y].mean()) if (~y).any() else None}
# T3 depth hazard ------------------------------------------------------------------------------------------------
def zscore(values):
values = np.asarray(values, dtype=float)
return (values - values.mean()) / values.std()
def solve_intercept(z, s, target, lo=-50.0, hi=50.0, tol=1e-12, iterations=200):
"""Bisection for a such that mean(sigmoid(a + s z)) = target (monotone increasing in a)."""
z = np.asarray(z, dtype=float)
for _ in range(iterations):
mid = (lo + hi) / 2
gap = expit(mid + s * z).mean() - target
if abs(gap) < tol:
break
lo, hi = (mid, hi) if gap < 0 else (lo, mid)
return mid
def plant_t3(z, s, pi, rng):
a = solve_intercept(z, s, pi)
p = expit(a + s * np.asarray(z, dtype=float))
return a, p, rng.random(len(p)) < p
def t3_scores(cells, y):
"""v5 depth neighbour forecast (k = 10 nearest md_top cells of the other wells, mean planted label)."""
frame = cells[["well", "md_top"]].reset_index(drop=True).assign(planted=np.asarray(y, dtype=int))
return knn_scores(frame, "planted", ["md_top"]).to_numpy()
# Summaries ------------------------------------------------------------------------------------------------------
def summarise(rows, key, pi):
"""Mean and range over seeds per setting; the seed-0 interval; the null check at the null setting."""
out = []
for setting, g in rows.groupby(key, sort=True):
g = g.sort_values("seed")
first = g.iloc[0]
ap = g["ap"]
row = dict(zip(key, setting if isinstance(setting, tuple) else (setting,)))
row |= {"seeds": int(len(g)), "ap_mean": float(ap.mean()), "ap_min": float(ap.min()),
"ap_max": float(ap.max()), "lift_mean": float(ap.mean() / pi),
"lift_min": float(ap.min() / pi), "lift_max": float(ap.max() / pi),
"ap_minus_pi_mean": float(ap.mean() - pi),
"seed0_ap": float(first["ap"]), "seed0_ci_low": float(first["ci_low"]),
"seed0_ci_high": float(first["ci_high"]),
"prevalence_mean": float(g["prevalence"].mean()), "prevalence_min": float(g["prevalence"].min()),
"prevalence_max": float(g["prevalence"].max())}
for extra in ("oracle_ap", "cue_rate_planted", "cue_rate_unplanted", "exposure_planted",
"exposure_unplanted"):
if extra in g:
row[f"{extra}_mean"] = float(g[extra].mean())
row[f"{extra}_min"] = float(g[extra].min())
row[f"{extra}_max"] = float(g[extra].max())
out.append(row)
return pd.DataFrame(out)
def null_check(mean_ap, ci, pi, tolerance=0.01):
within = abs(mean_ap - pi) <= tolerance
contains = ci is not None and ci[0] <= pi <= ci[1]
return {"mean_ap": float(mean_ap), "pi": float(pi), "tolerance": tolerance, "mean_within_tolerance": bool(within),
"seed0_ci": list(ci) if ci is not None else None, "seed0_ci_contains_pi": bool(contains),
"null_check_passed": bool(within and contains)}
def interpolate(grid, values, target):
"""Grid value at which the AP curve reaches target, by linear interpolation between grid points.
Out of range when target lies above the AP at the last grid point or below the AP at the first one. Within range,
the first segment that brackets target is used; a curve that never brackets it is also out of range.
"""
grid, values = np.asarray(grid, dtype=float), np.asarray(values, dtype=float)
if target > values[-1]:
return {"value": None, "out_of_range": "above_last_grid_point", "target": float(target)}
if target < values[0]:
return {"value": None, "out_of_range": "below_first_grid_point", "target": float(target)}
for i in range(len(grid) - 1):
lo, hi = values[i], values[i + 1]
if min(lo, hi) <= target <= max(lo, hi):
value = grid[i] if hi == lo else grid[i] + (target - lo) / (hi - lo) * (grid[i + 1] - grid[i])
return {"value": float(value), "out_of_range": None, "target": float(target), "segment": [
float(grid[i]), float(grid[i + 1])], "monotone": bool(np.all(np.diff(values) >= 0))}
return {"value": None, "out_of_range": "not_bracketed", "target": float(target)}
def interpolate_with_seeds(rows, axis, target, fixed=None):
"""Interpolation on the mean curve, plus per-seed interpolations and their range."""
if fixed:
for k, v in fixed.items():
rows = rows[np.isclose(rows[k], v)]
mean = rows.groupby(axis)["ap"].mean().sort_index()
result = interpolate(mean.index, mean.to_numpy(), target)
per_seed = {}
for seed, g in rows.groupby("seed"):
curve = g.set_index(axis)["ap"].sort_index()
per_seed[int(seed)] = interpolate(curve.index, curve.to_numpy(), target)
values = [r["value"] for r in per_seed.values() if r["value"] is not None]
result["per_seed"] = per_seed
result["seed_range"] = [float(min(values)), float(max(values))] if values else None
result["seeds_out_of_range"] = int(sum(r["value"] is None for r in per_seed.values()))
result["grid"] = [float(v) for v in mean.index]
result["mean_ap_curve"] = [float(v) for v in mean.to_numpy()]
return result
def no_cue_indicator_ap(planted, cue):
"""AP of the score "the row has no own cue" (1 without, 0 with); the structural signal of f > c.
Planted rows receive a cue with probability c and unplanted rows with probability f, so when f > c the absence
of a cue already points to a planted row and the setting is not a null even though the cue is independent of
the real text. At c = 0 every planted row has no cue and the expected AP is pi / (pi + (1 - pi)(1 - f)).
"""
from sklearn.metrics import average_precision_score
return float(average_precision_score(np.asarray(planted, dtype=bool), (np.asarray(cue) < 0).astype(float)))
def expected_no_cue_ap(pi, f):
"""Expected AP of the no-cue indicator at c = 0 (a two-tier ranking with all positives in the first tier)."""
return pi / (pi + (1 - pi) * (1 - f))
def ap_row(y, scores, wells, resamples, seed):
block = ap_ci(y, scores, wells, resamples, seed)
ci = block["ci95"] or [np.nan, np.nan]
return {"ap": block["ap"], "ci_low": ci[0], "ci_high": ci[1], "prevalence": block["prevalence"],
"positives": block["positives"], "n": block["n"]}