Files
Volve-DIA/AGENTS.md
lamlvh 23e15ee27e Record the error taxonomy and RQ4 results
Abstention dominates the errors of text retrieval, tool modes mostly fail on
the value with the right report cited, and the adapted EGS correlates with the
automatic score at rho 0.535 to 0.538 in every repetition, so H4 is not
supported; without abstentions rho is about 0.23. Update the plan, overview,
README, AGENTS and progress page, and add the run log entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 07:23:31 +00:00

145 lines
20 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AGENTS.md
Volve-DIA: a public benchmark and baselines for drilling-context recognition, NPT/trouble-interval identification and evidence-grounded question answering over the Volve daily drilling reports (DDR) and WITSML real-time data. Paper title (decided 17/11/2026, plan §12 item 22): *Volve-DIA: A leakage-controlled benchmark for daily drilling reports and real-time drilling data*; never put "first", "expert" or "human-annotated" in the title. One author; target a Q2 journal (Geoenergy Science and Engineering first). Direction chosen on 29/10/2026 (`docs/danh-gia-huong-NCKH-2026-10-29.md`, local only).
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)
- **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
step recorded 140 passes and one runlog test failure. The test had matched its own command line as the child
readiness signal. Corrected on 18/11; that suite passed 145 tests.
- **Data:** `data/Volve` is now a real directory (no longer a symlink); `/home` has about 75 GB free (98%). The manifest holds 25,571 files (formation tops added), `--check` ok. Third-party material is in `data/third_party/` (untracked).
- **DDR XML:** 1,759 reports, 26 wellbores (11 wells), 23,447 activities; counts locked in `EXPECTED`. Render bugs: *Tight well* and *HPHT* ("Y" in every HTML), and the Bit Record "End mMD" column (prints `bitRun_mdHoleStart`). `03` covers only the header, 31 fields, summaries and Operations.
- **OCR:** a colleague ran the full OCR and exported it through Dataset Hub (credentials only in `.env`, never in committed files or runlog commands). `scripts/04_ocr_hub.py` matches pages to DDRs by content (3,059 of 3,066 pages, 1,752 of 1,759 reports complete; 7 pages unmatched, 16 pages with a date disagreement not yet inspected). QC on the hub pages (`scripts/05_ocr_qc.py --source hub`, 1,752 reports): content CER 2.40%, WER 5.56%, exact 0.9181; depth fields and rig name are the weakest. The shared vLLM service is not used any more; `04_ocr.py` and its page cache stay for the pilot.
- **WITSML** (`06_parse_witsml.py`, written by a subagent; its figures are locked in `EXPECTED` and 30 tests): 21 DDR wellbores have time logs (not 14), 1,384 reports (not 964); WITSML `15/9-F-15 S` is DDR `15/9-F-15` and two more names are shifted by one. Formation tops: 409 picks, 24 DDR wellbores with own picks, 2 with shared picks. Tables in `outputs/witsml/` (2.2 GB, gitignored).
- **Labels T1–T3** (`07_labels.py`, `configs/labels.yaml`): T1 section with forward fill (672 published + 260 filled drilling days), T2 NPT (a) 3,577 rows / (b) 4,286 rows, T3 844 / 979 positive cells (only 50% of NPT rows can be located in depth).
- **T4** (`08_t4_questions.py`, `configs/t4_templates.yaml`): 1,662 questions from 39 templates; SQL, independent pandas and raw-XML answers agree 100%.
- **G1 passed and protocol v1 locked on 18/11/2026.** Verify with `sha256sum -c configs/protocol_v1.yaml.sha256`.
T4 and C4 are the headline analyses. Published T1 sections support them. T2/T3 are DDR-derived prediction
diagnostics using NPT (b), with (a) as sensitivity. No class passed all thresholds for separate baseline scores.
- **Trial audit:** 100 masked items drawn (`09_audit.py sample`, `outputs/audit/trial_100/`) and rated blind by three LLM raters (Sonnet, Opus, Haiku; `RATINGS_llm_*.csv`, `scripts/09_rater_agreement.py` -> `raters.json`). They are **LLM raters, not an author audit**: never describe them as the author's, a human or an expert audit. Median weighted kappa against the code labels: NPT a 0.553, NPT b 0.574, cause a 0.456, operation class 0.434; Fleiss between raters about 0.66. No human rated; there is no human time per row.
- **Literature:** `docs/literature_notes.md`, `docs/references.bib`. No public NPT label set on Volve is independent of the DDR codes; the plan's "three independent label sets" was dropped. PetroAgents full text read (`docs/lit_petroagents.pdf`): well-day unit, 60-example samples, leakage ablation on 30 examples, split by wellbore.
- **M2 started 18/11/2026.** `run_m2.sh prepare` drew 300 masked activities from 11 wells (225 strata, excluding
the 100 pilot items) and 90 masked T1 section days (45 published, 45 filled). Qwen3-8B, Gemma 3 12B and
Ministral 3 8B completed all 1,170 ratings. First-pass median weighted κ is 0.258 for NPT (a), 0.283 for (b);
Δ = 0.025 selected (b) under the G1 rule. No individual or proposed pooled class meets all reporting thresholds.
T1 section agreement is 0.707 on published days and 0.059 on filled days (45 sampled days per source).
- **M2 pass 2 complete on 18/11/2026.** The same-day repeat returned 1,170 ratings. Within-rater weighted NPT κ
was 0.912 (Qwen), 0.9999 (Gemma) and 0.824 (Ministral). Median κ against XML-derived NPT (b) was 0.283.
Exploratory first-pass leave-one-well-out sensitivity kept the 0.02 selection margin in 10/11 deletions
(Δκ 0.015–0.037). See plan §1.5 for code-vs-text disagreements and near-threshold classes.
- **M2 cross-checks complete.** DrillScribe 1,758/1,758 episode keys matched. Anatoly5ms strong-or-weak text rules
marked 219 of 4,894 own-hole T3 cells with WITSML, including 72 NPT (a) and 83 NPT (b) overlaps.
TSPP2–4 have 9/14/15 DDR rows in the sensitivity windows and zero stuck-equipment codes. G1 preflight verified
all 10 T3 training folds contain positives and negatives for both definitions (21 eligible wellbores).
- **M3–M4 started 18/11/2026.** `scripts/run_m34.sh` builds the frozen feature tables (932 T1 days, 23,447
T2 activities, 4,894 T3 cells), fits grouped baselines, runs T4/C4, and tracks G2 coverage in
`outputs/m34/report.json`. C4 pairs 1,376 T4 questions, retaining 1,293 when excluding evidence reports
with date-disagreement pages. The date sensitivity rebuilds each retrieval corpus. TF-IDF + logistic regression
completed T1–T3 on 18/11. TF-IDF T2(b) by well reached AP 0.463 masked and 0.995 unmasked, with paired
delta 0.531 (95% CI 0.480–0.580). TF-IDF T3(b) by well reached AP 0.123 masked and 0.127 unmasked, with
paired delta 0.0048 (95% CI −0.0005–0.0238). DistilBERT completed 111 T1 folds across both splits and
three seeds and the three masked T2(b) well runs (AP 0.579–0.603). Masked T2(b) by wellbore also has all
three seeds (AP 0.619, 0.612 and 0.624). Masked T3(b) by well is complete across three seeds
(AP 0.117–0.125, interval IoU 0.108–0.124). All DistilBERT shards (both definitions, masked and unmasked,
both splits) finished by 06:27 UTC 20/11; the last were T3(a) unmasked (93 folds) and T2(a) unmasked (111 folds).
Masked Qwen T2(b) seed 0 reached AP 0.264 against 0.463 for masked TF-IDF, with paired delta −0.200
(95% CI −0.250 to −0.152); Qwen T2 seed 1 was stopped at 17,827/23,447 (partial v1).
Qwen C4 seed 0 finished all three sources (1,376 questions each). Macro-family accuracy on the 1,366
well-scoped questions is 21.36% XML, 23.54% HTML and 19.59% OCR. The date sensitivity also finished
seed 0 (1,293 questions per source), with macro-family accuracy 20.42%, 22.92% and 19.53% on 1,284
well-scoped questions. Qwen RAG finished its 1,662 questions in seed 0 (15.4%); the Qwen agent was stopped at
545/1,662 and Llama never ran beyond the smoke (both replaced in protocol v2).
The first full C4 report exposed a missing-well comparison error for field questions, fixed in the report
code. The detached stage watcher refreshed the report at 06:32 UTC 20/11 and exited.
- **Protocol v2 (19/11/2026, plan §12 item 32):** the Qwen and Llama baselines were **stopped** on 19/11 (checkpoints kept:
Qwen T4/C4 10,214 of 16,317 seed-0 predictions, Qwen T2 seed 0 complete and 17,827 of 23,447 for seed 1, Llama none; reported as
partial v1). The v1 `api` cell is filled by the VAI model `DeepSeek-V4.1-Flash-1017` (the vopec-chatbot model; 3,600/7,100
credits per 1M input/output tokens, about 1 VND each, 10M-credit quota shared by the team; URL and key only in `.env`) on the
full T4/C4 and T2 matrix, three repetitions. **VAI full run** (started 03:22 UTC 19/11, `scripts/run_m34_v2.sh full 250000000`,
token cap, 4 workers, checkpoints `outputs/m34/v2/`) is **complete**: T4/C4 48,951/48,951 and T2 70,341/70,341. Sonnet and Haiku (no Anthropic key) replace Qwen and Llama as session subagents on a fixed auxiliary
sample: 300 T4 questions x 5 conditions and 500 T2 items, drawn over all 11 wells with seed 20261117, one repetition, outside G2
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`. 192 tests (20/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,
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.
- **Session sample complete (19/11/2026):** Sonnet and Haiku answered all 110 batches (300 T4 questions x 5 conditions, 500 T2 items, one repetition,
collected into `outputs/m34/v2/session/<model>/summary.json`). Macro-family accuracy, Sonnet / Haiku: C4 XML 0.123 / 0.083, C4 HTML 0.177 / 0.147,
C4 OCR 0.187 / 0.150, RAG XML 0.128 / 0.098, zero-shot 0 / 0 (no evidence, answers withheld). Limitations: no read isolation between agents, some agents ran
extra ls/wc, group-agent outputs were quarantined and rerun one batch per agent, batches are 15 T4 / 50 T2 items (not 30 / 100).
- **Protocol v3 and G3 passed (20/11/2026, plan §1.7, §12 item 34).** No human rater exists, so `configs/protocol_v3.yaml`
(+ `.sha256`, extends v2/v1; never edit it) makes the automatic score against the XML answer the G3 reference; threshold
κ ≥ 0.6 unchanged. 100 free-text T4 answers of VAI DeepSeek rep 0 (sample sha `3c8021f9…`, prompt sha `ff32e797…`),
judged blind by session subagents (`scripts/18_m5_judge.py prepare|status|collect`, `outputs/m5/judge/`). Sonnet
(primary) κ 0.98 (well bootstrap CI 0.947–1.0), Haiku 0.90, between judges 0.92; 5 disagreements (one sentence-form
answer the string scorer missed; four OCR "MERSK INSPIRER" accepted by Haiku). This is consistency with the automatic
scorer, not human agreement; T4 headline numbers stay automatic.
- **Final analysis (20/11, plan §1.7).** Paired by-well CIs per repetition: agent − RAG +0.46 to +0.48 (excludes 0);
agent − tool_only −0.08 to −0.12 (agent is worse); OCR − XML +0.02 to +0.04 (includes 0, so H5 is not supported on T4).
Wrong-wellbore rate: RAG 0.30, C4 HTML/OCR 0.36–0.38, C4 XML 0.20, tool modes about 0.05. Code leakage T2(b): TF-IDF
+0.531, DistilBERT +0.27 to +0.29; T3 about 0. DeepSeek − TF-IDF on T2 −0.055 (CI includes 0). Qwen is partial v1, seed 0.
- **Protocol v4: error taxonomy and RQ4 done (20/11/2026, plan §1.7, §12 item 35).** `configs/protocol_v4.yaml` (+ `.sha256`,
extends v3; never edit it) was locked before any error class or EGS value was computed. `scripts/19_m5_errors.py`
(`volve_dia/m5_errors.py`, 24 tests) writes `outputs/m5/errors/` from complete DeepSeek reps 0–2 (primary) and Qwen v1
seed 0 (partial), well-scoped questions. One class per prediction, first rule wins. DeepSeek macro shares (mean of 3 reps):
abstention dominates text retrieval (C4 XML 0.678, HTML 0.535, OCR 0.580, RAG 0.638, zero-shot 0.891), then wrong
wellbore (0.095–0.190). Tool modes mostly err with the right report cited but a wrong value (0.14–0.15), and agent has
6.4% call failures. Aggregation and multi_hop are near 0 with text but about 0.72 with tool_only. For comparison
questions the answer is a wellbore, so a wrong pick counts as wrong wellbore. EGS is adapted to the JSON answer format:
number with a TADI unit plus a cited known DDR report, sections 0. Pooled Spearman with the automatic score is 0.538 /
0.535 / 0.535, so H4 (weak correlation) is not supported. Accuracy at EGS 0 / 1/3 / 2/3 is 0.01 / 0.22 / 0.67. Without
abstentions ρ is about 0.23, and within tool_only ρ is 0.07: EGS mostly separates answers from abstentions. Qwen ρ is 0.33.
## Next
Roadmap and gates: `docs/plan.md` §6, §12 item 1.
1. G2 v2, G3, the error taxonomy and RQ4 are done (20/11). Next: paper writing (M6), T5 if time allows, 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,
while the public Equinor terms (§3.1–3.3) permit commercial use and forbid sale of licensed material.
5. Read in full when access is available: EAGE 2026101276, SPE-236554-MS, SPE-235330-MS, IPTC-25191-MS.
## Conventions
- **Ground truth:** every label and every T4 answer comes from the XML (and WITSML), by code, with provenance. HTML and PDF are renders: never take a label from them. Labels are only *validated* (blind LLM raters, cross-checks with third-party sets, calibrated judge), never created by raters. No human rater is available, so no result may be called a human, author or expert audit.
- **No leakage:** activity codes (`proprietaryCode`, `stateDetailActivity`, `state`) are masked in model inputs for T2 and T3. T3 uses only features from before the event. Primary splits group by well, with leave-one-well-out externally and GroupKFold internally. Baseline tuning
uses training or development wells. Report results with and without the masked codes.
- **Locked protocols:** the evaluation protocol is locked by SHA-256 before the first benchmark baseline run. Never edit a locked protocol or relax a threshold. New decisions go into a new protocol with a recorded deviation. Report results as they come out, including failures.
- **OCR service and Dataset Hub:** the Hub URL, dataset id and API key live only in the untracked `.env` (`DATASET_HUB_URL`, `DATASET_HUB_API_KEY`, `VOLVE_DIA_OCR_HUB_DATASET`); never put them on a command line, in a committed file or in output shown to the user. The OCR service URL lives only in the untracked `.env` (`VOLVE_DIA_OCR_URL`; template `.env.example`). Read it only through `volve_dia.ocr.service_url()`. Never put it on a command line (`runlog` records the command in `logs/index.csv`), in a committed file, or in output shown to the user. The service is shared with vopec-chatbot: keep `workers: 4`. The model, prompt hash, dpi, max_tokens and temperature form the page-cache key, so changing one re-reads every page.
- **Git:** work on `main`. Do not create branches unless the user explicitly asks. Commit only when the user asks. End commit messages with a co-author line for the agent.
- **Language:** code, figures, paper text and commit messages in academic English. `README.md`, `docs/plan.md`, `docs/technical_overview.md`, `report.html` and explanations to the user in Vietnamese.
- **Decisions:** decide from evidence and proceed.
- **Keep docs in sync (every task):** whenever a run starts, finishes, fails or is stopped, or a result, decision, script or file changes, update in the same turn every file that states it: `report.html` (task status, results, decisions, log), `docs/plan.md` (§0, §1, §6, §12), `AGENTS.md` (Status, Next) and where relevant `README.md` (scripts, run commands) and `docs/technical_overview.md` (results story, code map). Before ending the turn, grep these files for older statements about the same item (for example "not started", old counts or dates) and correct them, so no two files disagree.
- **Shared server:** never touch other users' jobs. Set `OMP_NUM_THREADS`, `MKL_NUM_THREADS` and `OPENBLAS_NUM_THREADS` explicitly when running by hand (the machine default is 40); `run_p0.sh` sets them to 4.
- **Long runs:** detach multi-hour runs with `setsid nohup ... > /dev/null 2>&1 &` so they survive the agent session, and wrap them with `scripts/runlog.sh` (the log is in `logs/runs/`). `04_ocr.py` resumes from the page cache.
- **Licence and confidentiality:** This Volve copy ships with `license.txt` stating CC BY-NC-SA 4.0, no resale and attribution.
The [public Volve terms](https://cdn.equinor.com/files/h61q9gi9/global/de6532f6134b9a953f6c41bac47a0c055a3712d3.pdf)
allow commercial use and forbid sale of licensed material. Keep the local non-commercial convention with
attribution and resolve the applicable release terms before G4. `docs/NCKH_Ban TD.DOCX` is an internal PVEP document: never commit or publish it. `docs/danh-gia-huong-NCKH-2026-10-29.md` quotes it, so it is gitignored and stays local. The remote is public: before every push, check that no committed file quotes the internal proposal.
- **Code style:** lines of at most 120 characters; scripts are numbered `scripts/NN_name.py`; tests that need the data carry the `data` marker.
## Not in git (other machines)
`data/` (the Volve copy, OCR hub export, third-party repos), `outputs/`, `logs/runs/`, `.env`, `docs/*.DOCX`, `docs/*.pdf`, `docs/danh-gia-huong-NCKH-2026-10-29.md` and the `.venv` are gitignored. Check the data with `scripts/00_data_manifest.py --check` and regenerate `outputs/` with `scripts/run_p0.sh`, except the OCR page cache `outputs/ocr/pages/`: it holds hours of GPU time, so copy it rather than reading the pages again.
## Skills
Agent skills live in `.agents/skills/` (sources in `skills-lock.json`): scikit-learn, pymc, statistical-analysis, scientific-visualization, scientific-writing, scientific-critical-thinking, literature-review, citation-management, academic-humanizer, mlflow.