How nazib-riasat/19august works
Purpose and Entry Points
GRAFT is a research pipeline for provenance-preserving temporal graph memory and checker-conditioned evidence-set selection. Its stable programmatic entry is the graft Python package; configuration begins with graft/config/loader.py and typed models in graft/schemas.py. Operational entry points are phase scripts such as scripts/verify_handoff.py, scripts/locomo_ingest.py, and scripts/phase3_gate2.py.
Reproducible Runtime and Persistence
Cross-machine determinism is an architectural requirement. Canonical serialization, content-derived IDs, append-only event logging, graph replay, budget accounting, and run manifests establish reproducible experiment identity and auditability.
• graft/canonical.py
• graft/eventlog.py
• graft/graphstore.py
• graft/runtime.py
• graft/ledger.py
Configuration uses frozen schema-backed presets; resolved configuration hashes—not YAML formatting—identify runs.
• graft/config/schema.py
• graft/config/loader.py
• graft/config/presets/default.yaml
Deterministic Evidence Core
The core defines the formal boundary between proposed evidence sets and valid, rewarded terminals: graph resolution, obligation coverage, legality masks, checker verdicts, utility, and reward R = 1[H] * exp(beta*U). Incremental state transitions must agree with the full checker, enabling safe ADD/undo generation.
• graft/core/checker.py
• graft/core/obligations.py
• graft/core/masks.py
• graft/core/reward.py
• graft/core/incremental.py
Synthetic Environment, Learners, and Search
The synthetic layer provides enumerable ProofLattice environments and exact distributional evaluation. Set generation consumes these states through policies, rollouts, a shared trainer, and nine learner arms, including GAFlowNet and checker-conditioned LED variants. Phase-4 search supplies greedy, beam, submodular, PCST, and portfolio selection behind Gate-3 evaluation.
• graft/synth/lattice.py
• graft/synth/exact.py
• graft/setgen/trainer.py
• graft/setgen/learners/gaflownet.py
• graft/setgen/search/gate3.py
Phase-3 calibration and Gate-2 reports/checkpoints are persisted under Phase3_slurm_result/985953/; frozen calibration must remain comparable across runs.
Real-Data Ingestion and Graph Construction
Stage A transforms conversational/corpus inputs into provenance-bearing records via extraction, grounding, NLI verification, support gating, temporal parsing, and obligation parsing. Stage B turns accepted material into graph candidates, encoded/embedded features, learned links, validation, and committed graph updates.
• graft/ingest/pipeline.py
• graft/ingest/extractor.py
• graft/ingest/grounding.py
• graft/ingest/nli.py
• graft/graphbuild/commit.py
• graft/graphbuild/train.py
LoCoMo is externally downloaded, SHA-pinned, and ingested locally; it is evaluation-only. Annotation artifacts for the feasibility phase reside in data/phase2_5/.
Retrieval, Gating, and Reading
Later stages query the constructed graph/corpus through lexical, dense, entity, temporal, expansion, and fusion retrieval; then assess answerability/risk and invoke a reader/orchestrator to produce serialized answers. These are explicit boundaries between evidence acquisition, gate decisions, and answer generation.
• graft/retrieve/pool.py
• graft/retrieve/fuse.py
• graft/gate/decide.py
• graft/gate/model.py
• graft/reader/orchestrator.py
Infrastructure and Dependencies
The project targets Python 3.11/3.12. Base dependencies are in requirements.txt; Phase 3 adds PyTorch via requirements-ml.txt, with CPU training supported and CUDA installation relevant on Blackwell GPUs. Batch execution is supported through scripts/slurm_phase3_narval.sh and stored Slurm results. External datasets include LoCoMo, 2Wiki, and MuSiQue-Ans; model-assisted extraction/linking is represented by prompt and LLM-link modules.
Main entry points: trainer.py Set-generation trainer · checker.py Evidence checker · runtime.py Reproducible runtime · graphstore.py Replayable graph store
Components 21
Runtime & Reproducibility
- Resolved configuration · Frozen schemas and presets produce hashable run settings.
graft/config/loader.py - Reproducible runtime · Creates run identity, manifests, and deterministic execution context.
graft/runtime.py - Canonical identity · Content-derived IDs and canonical serialization.
graft/canonical.py - Append-only event log
graft/eventlog.py - Replayable graph store · Persists committed updates and supports graph replay.
graft/graphstore.py - Budget ledger
graft/ledger.py
Evidence Core
- Evidence checker · Resolves graph evidence and produces legality and terminal verdicts.
graft/core/checker.py - Obligation coverage
graft/core/obligations.py - Incremental transitions · Safe ADD/undo transitions agree with full checking.
graft/core/incremental.py - Utility and reward · Rewards valid terminals using checker-conditioned utility.
graft/core/reward.py
Synthetic Learning & Search
- ProofLattice environment · Enumerable states for controlled evidence-set experiments.
graft/synth/lattice.py - Exact distributional evaluation
graft/synth/exact.py - Set-generation trainer · Shared training loop for checker-conditioned learner arms.
graft/setgen/trainer.py - GAFlowNet learner
graft/setgen/learners/gaflownet.py - Gate-3 selector portfolio · Greedy, beam, submodular, PCST, and portfolio selection.
graft/setgen/search/gate3.py
Data Ingestion & Graph Build
- Corpus and LoCoMo inputs · LoCoMo is SHA-pinned, locally ingested, and evaluation-only.
- Stage A provenance ingestion · Extraction, grounding, NLI, support gating, temporal and obligation parsing.
graft/ingest/pipeline.py - Stage B graph construction · Builds candidates, features, learned links, validation, and commits.
graft/graphbuild/commit.py
Retrieval, Gating & Reading
- Evidence retrieval and fusion · Combines lexical, dense, entity, temporal, and expansion retrieval.
graft/retrieve/fuse.py - Answerability and risk gate
graft/gate/decide.py - Reader orchestrator · Produces serialized answers from gated evidence.
graft/reader/orchestrator.py
Connections 22
- Resolved configuration → Reproducible runtime: resolved settings
- Canonical identity → Reproducible runtime: run identity
- Reproducible runtime → Append-only event log: records events
- Reproducible runtime → Budget ledger: accounts budget
- Append-only event log → Replayable graph store: replay updates
- Obligation coverage → Evidence checker: coverage constraints
- Evidence checker → Incremental transitions: full-check agreement
- Evidence checker → Utility and reward: valid terminal H
- ProofLattice environment → Set-generation trainer: enumerable states
- Evidence checker → Set-generation trainer: legality and verdicts
- Incremental transitions → Set-generation trainer: ADD/undo actions
- Utility and reward → Set-generation trainer: training reward
- Set-generation trainer → GAFlowNet learner: trains learner arm
- GAFlowNet learner → Exact distributional evaluation: evaluated exactly
- Set-generation trainer → Gate-3 selector portfolio: candidate policies
- Corpus and LoCoMo inputs → Stage A provenance ingestion: raw conversations and corpora
- Stage A provenance ingestion → Stage B graph construction: accepted provenance records
- Stage B graph construction → Replayable graph store: committed graph updates
- Replayable graph store → Evidence retrieval and fusion: graph and corpus evidence
- Evidence retrieval and fusion → Answerability and risk gate: fused evidence pool
- Answerability and risk gate → Reader orchestrator: gated context
- Evidence checker → Gate-3 selector portfolio: selection validity