| # PhD Research OS β Complete System Design |
| ## Version 2.0 | Post-Audit Architecture |
|
|
| **Date**: 2026-04-23 |
| **Status**: DESIGN COMPLETE β Ready for phased implementation |
| **Addresses**: All 87 blindspots from the audit |
| **Hardware Target**: 16-24GB VRAM consumer GPU (RTX 4090 / RTX 3090 / A6000) |
|
|
| --- |
|
|
| ## 1. System Overview |
|
|
| ``` |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| β PhD Research OS v2.0 β |
| β "The Epistemic Engine" β |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£ |
| β β |
| β ββββ INPUTS βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β |
| β β PDF Bundles β Supplements β Datasets β Code Repos β Lab Notes β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 0: STRUCTURAL INGESTION βββββββββββββββββββββββββββββββ β |
| β β Marker β Nougat β GROBID β Region Classifier β Plot Digitizer β β |
| β β Section-aware chunks β Bounding boxes β Quality scores β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 1: ENTITY RESOLUTION ββββββββββββββββββββββββββββββββββ β |
| β β Ontology normalizer β Citation resolver β VoR lineage β Retract. β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 2: QUALIFIED EXTRACTION βββββββββββββββββββββββββββββββ β |
| β β AI Model Council (parallel) β Epistemic Separation Engine β β |
| β β Qualifier preservation β Statistical extraction β OOD gating β β |
| β β Guidance constrained decoding β Source quotes + bboxes β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 3: CANONICALIZATION βββββββββββββββββββββββββββββββββββ β |
| β β Embedding dedup β Canonical registry β Alias merging β β |
| β β Evidence aggregation β Temporal versioning β Lineage diff β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 4: KNOWLEDGE GRAPH ββββββββββββββββββββββββββββββββββββ β |
| β β SQLite-backed graph β Typed epistemic edges β Lab lineage β β |
| β β Method compatibility β Transitive constraints β Gap analysis β β |
| β β Null evidence β Conflict clustering β Versioned ontology β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 5: CALIBRATED SCORING βββββββββββββββββββββββββββββββββ β |
| β β Code-computed confidence β 3 separate scores β Statistical gateβ β |
| β β Parser confidence propagation β Section modifiers β Brier mon. β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 6: EVALUATION βββββββββββββββββββββββββββββββββββββββββ β |
| β β LLM-as-Judge CI/CD β Versioned golden set β Stochastic tests β β |
| β β Hidden holdout β Fatigue management β Counter-metrics β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ LAYER 7: PROVENANCE & REPRODUCIBILITY βββββββββββββββββββββββ β |
| β β Version pinning β Output lineage β PDF.js viewer β Containers β β |
| β β Security sandbox β License checking β Epistemic Embargo β β |
| β ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β |
| β βΌ β |
| β ββββ OUTPUTS ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β |
| β β Obsidian Vault β Courtroom UI β Gap Analysis β Decision Objectsβ β |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β |
| β β |
| β ββββ CROSS-CUTTING βββββββββββββββββββββββββββββββββββββββββββββββ β |
| β β AI Model Council β Meta-Improver β Superpowers Skills β β |
| β β ECC Harness β Companion Agents β Manual Synthesis Mode β β |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| ``` |
|
|
| --- |
|
|
| ## 2. Model Architecture |
|
|
| ### 2.1 The Two-Model Strategy |
|
|
| The system runs TWO models, not one. This solves the local-vs-online tension: |
|
|
| ``` |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| β PRIMARY BRAIN (Fully Local β Never Touches Internet) β |
| β β |
| β Model: Qwen3-8B Q4 AWQ β |
| β VRAM: ~5GB weights + ~4GB KV cache (PolarQuant) β |
| β Total: ~9GB (fits 16GB GPU with room for batch) β |
| β Context: 128K tokens (full paper length) β |
| β Serving: Ollama (simplest) or vLLM (fastest) β |
| β β |
| β Tasks: β |
| β β’ Claim extraction (Layer 2) β |
| β β’ Epistemic classification β |
| β β’ Confidence component estimation β |
| β β’ Conflict hypothesis generation β |
| β β’ Query decomposition β |
| β β’ Decision object generation β |
| β β |
| β Constrained decoding: Guidance engine β |
| β Training: SFT β DPO β GRPO (4-stage pipeline) β |
| β Privacy: ALL paper data stays local β |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ |
| β COMPANION BRAIN (Online β For Non-Sensitive Tasks) β |
| β β |
| β Model: Claude API / GPT-4o-mini / OpenRouter β |
| β OR: Local Qwen3-30B-A3B MoE Q4 (~6GB, 3B active) β |
| β β |
| β Tasks: β |
| β β’ Meta-Improver external scanning (arXiv, GitHub) β |
| β β’ Prompt optimization A/B testing β |
| β β’ Training data generation for new domains β |
| β β’ Retraction/correction checking (needs internet) β |
| β β’ Repository URL validation β |
| β β |
| β Privacy: NEVER sees raw paper text β |
| β Only receives: metadata, queries, anonymized claims β |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| ``` |
|
|
| ### 2.2 Why Qwen3-8B, Not Qwen2.5-3B |
|
|
| | Metric | Qwen2.5-3B | Qwen3-8B | Improvement | |
| |--------|-----------|----------|-------------| |
| | AIME (math reasoning) | ~15% | ~45%+ | 3Γ | |
| | MATH-500 | ~85% | ~95%+ | +10 pts | |
| | JSON structural accuracy (SFT) | ~65% | ~80%+ | +15 pts | |
| | Context window | 32K | 128K | 4Γ | |
| | Hybrid thinking mode | No | Yes | New capability | |
| | VRAM at Q4 AWQ | ~2.5GB | ~5GB | Acceptable | |
|
|
| ### 2.3 Alternative: Qwen3-30B-A3B MoE (The Stealth Option) |
|
|
| For users with 8GB+ VRAM who want maximum quality: |
| - 30B total parameters, only 3B activated per token (Mixture of Experts) |
| - ~6GB at Q4 quantization |
| - Quality equivalent to dense 14B+ models |
| - Apache 2.0 license |
| - Available: `Qwen/Qwen3-30B-A3B-Instruct-2507` (1M downloads) |
|
|
| ### 2.4 Multimodal: Qwen3-VL-8B-Instruct |
|
|
| For figure/diagram processing (Layer 0): |
| - Same architecture as text model but with vision encoder |
| - Available: `Qwen/Qwen3-VL-8B-Instruct` (3.9M downloads) |
| - AWQ 4-bit: `cyankiwi/Qwen3-VL-8B-Instruct-AWQ-4bit` (~5GB) |
| - Handles: figure classification, diagram understanding, micrograph analysis |
| - Does NOT replace plot digitizer for quantitative data |
|
|
| ### 2.5 VLM for Multimodal Figures: Qwen3-VL-30B-A3B-Instruct |
|
|
| For maximum figure understanding with MoE efficiency: |
| - Available: `Qwen/Qwen3-VL-30B-A3B-Instruct` (1.5M downloads) |
| - AWQ: `QuantTrio/Qwen3-VL-30B-A3B-Instruct-AWQ` (667K downloads) |
| - Only 3B active params β fits alongside primary brain |
|
|
| --- |
|
|
| ## 3. Training Pipeline (4-Stage) |
|
|
| ### Stage 1: SFT on Domain Data |
|
|
| ```python |
| # Current implementation (train.py) β KEEP but upgrade base model |
| from trl import SFTConfig, SFTTrainer |
| from peft import LoraConfig |
| |
| trainer = SFTTrainer( |
| model="Qwen/Qwen3-8B", # Upgraded from Qwen2.5-3B |
| args=SFTConfig( |
| output_dir="./research-os-sft", |
| num_train_epochs=3, |
| per_device_train_batch_size=2, |
| gradient_accumulation_steps=8, |
| learning_rate=2e-4, |
| max_length=4096, # Longer for paper sections |
| assistant_only_loss=True, |
| bf16=True, |
| gradient_checkpointing=True, |
| push_to_hub=True, |
| hub_model_id="nkshirsa/phd-research-os-brain-v2", |
| ), |
| train_dataset=expanded_dataset, # 10K+ examples (up from 1,900) |
| peft_config=LoraConfig(r=64, lora_alpha=16, target_modules="all-linear"), |
| ) |
| trainer.train() |
| ``` |
|
|
| ### Stage 2: DPO on Preference Pairs |
|
|
| ```python |
| from trl import DPOConfig, DPOTrainer |
| |
| # Dataset: pairs of (correct extraction, incorrect extraction) for same text |
| trainer = DPOTrainer( |
| model="./research-os-sft", # From stage 1 |
| args=DPOConfig( |
| output_dir="./research-os-dpo", |
| learning_rate=5e-7, |
| num_train_epochs=1, |
| max_length=4096, |
| bf16=True, |
| push_to_hub=True, |
| ), |
| train_dataset=preference_dataset, |
| peft_config=LoraConfig(r=64, target_modules="all-linear"), |
| ) |
| ``` |
|
|
| ### Stage 3: GRPO with Epistemic Reward Functions |
|
|
| This is the critical stage that bakes JSON reliability and epistemic correctness into the model: |
|
|
| ```python |
| from trl import GRPOTrainer, GRPOConfig |
| from trl.rewards import think_format_reward |
| import json |
| |
| # ββ Reward Function 1: JSON Validity ββ |
| def json_validity_reward(completions, **kwargs): |
| """Binary reward: is the output valid JSON?""" |
| rewards = [] |
| for completion in completions: |
| content = completion[0]["content"] if isinstance(completion, list) else completion |
| try: |
| json.loads(content) |
| rewards.append(1.0) |
| except (json.JSONDecodeError, TypeError): |
| rewards.append(0.0) |
| return rewards |
| |
| # ββ Reward Function 2: Schema Compliance ββ |
| REQUIRED_KEYS = {"text", "epistemic_tag", "confidence", "missing_fields", "status"} |
| VALID_TAGS = {"Fact", "Interpretation", "Hypothesis", "Conflict_Hypothesis"} |
| |
| def schema_compliance_reward(completions, **kwargs): |
| """Reward for matching the Research OS claim schema.""" |
| rewards = [] |
| for completion in completions: |
| content = completion[0]["content"] if isinstance(completion, list) else completion |
| score = 0.0 |
| try: |
| data = json.loads(content) |
| claims = data if isinstance(data, list) else data.get("claims", [data]) |
| |
| for claim in claims: |
| if not isinstance(claim, dict): |
| continue |
| # Key presence: 0.3 |
| present_keys = set(claim.keys()) & REQUIRED_KEYS |
| score += 0.3 * len(present_keys) / len(REQUIRED_KEYS) |
| # Valid epistemic tag: 0.3 |
| if claim.get("epistemic_tag") in VALID_TAGS: |
| score += 0.3 |
| # Confidence in range: 0.2 |
| conf = claim.get("confidence", -1) |
| if isinstance(conf, (int, float)) and 0 <= conf <= 1: |
| score += 0.2 |
| # Status consistency: 0.2 |
| missing = claim.get("missing_fields", []) |
| status = claim.get("status", "") |
| if (missing and status == "Incomplete") or (not missing and status == "Complete"): |
| score += 0.2 |
| |
| if claims: |
| score /= len(claims) |
| except: |
| pass |
| rewards.append(score) |
| return rewards |
| |
| # ββ Reward Function 3: Qualifier Preservation ββ |
| HEDGING_WORDS = {"may", "might", "could", "suggests", "possibly", "potentially", |
| "appears", "seems", "likely", "unlikely", "not significant"} |
| |
| def qualifier_preservation_reward(completions, prompts, **kwargs): |
| """Reward for preserving hedging language from source text.""" |
| rewards = [] |
| for completion, prompt in zip(completions, prompts): |
| content = completion[0]["content"] if isinstance(completion, list) else completion |
| prompt_text = prompt[0]["content"] if isinstance(prompt, list) else prompt |
| |
| # Find hedging words in source |
| source_hedges = {w for w in HEDGING_WORDS if w in prompt_text.lower()} |
| if not source_hedges: |
| rewards.append(0.5) # Neutral if no hedging in source |
| continue |
| |
| # Check if hedging is preserved in extraction |
| try: |
| data = json.loads(content) |
| claims = data if isinstance(data, list) else data.get("claims", [data]) |
| claim_text = " ".join(c.get("text", "") for c in claims if isinstance(c, dict)).lower() |
| |
| preserved = sum(1 for h in source_hedges if h in claim_text) |
| rewards.append(preserved / len(source_hedges)) |
| except: |
| rewards.append(0.0) |
| return rewards |
| |
| # ββ GRPO Training ββ |
| trainer = GRPOTrainer( |
| model="./research-os-dpo", # From stage 2 |
| reward_funcs=[ |
| json_validity_reward, # Weight: 0.3 |
| schema_compliance_reward, # Weight: 0.4 |
| qualifier_preservation_reward, # Weight: 0.3 |
| ], |
| args=GRPOConfig( |
| output_dir="./research-os-grpo", |
| learning_rate=1e-6, |
| num_generations=8, |
| max_completion_length=2048, |
| bf16=True, |
| gradient_checkpointing=True, |
| logging_steps=10, |
| push_to_hub=True, |
| hub_model_id="nkshirsa/phd-research-os-brain-v2", |
| reward_weights=[0.3, 0.4, 0.3], |
| ), |
| train_dataset=prompt_dataset, # "prompt" column with paper excerpts |
| peft_config=LoraConfig(r=64, target_modules="all-linear"), |
| ) |
| trainer.train() |
| ``` |
|
|
| ### Stage 4: Calibration Fine-Tuning (ConfTuner) |
|
|
| After GRPO, apply ConfTuner with tokenized Brier score loss to fix confidence calibration. This is a specialized fine-tuning pass that targets only the confidence output tokens. |
|
|
| --- |
|
|
| ## 4. Layer Specifications |
|
|
| ### 4.0 Layer 0: Structural Ingestion Engine |
|
|
| **Purpose**: Convert PDF bundles into section-aware, bbox-annotated, quality-scored structured regions. |
|
|
| **Technology Stack**: |
|
|
| | Component | Tool | Purpose | |
| |-----------|------|---------| |
| | Layout detection | Marker (VikParuchuri/marker) | PDF β structured markdown with layout awareness | |
| | Math/equation | Nougat (facebookresearch/nougat) | Scientific PDFs β LaTeX equations | |
| | Bibliographic | GROBID | Headers, authors, citations, references | |
| | Region classifier | LayoutLMv3 or DocTR | Classify page regions: text, table, figure, equation | |
| | Plot digitizer | PlotDigitizer (algorithmic) | Quantitative plots β CSV of (x,y) coordinates | |
| | VLM for figures | Qwen3-VL-8B-Instruct Q4 AWQ | Semantic figure understanding | |
| | OCR quality | Per-span confidence scoring | Flag degraded regions | |
|
|
| **Output Schema** (per region): |
|
|
| ```json |
| { |
| "region_id": "REG_00042", |
| "document_type": "main|supplement_1|supplement_2", |
| "page": 5, |
| "bbox": [72, 340, 540, 420], |
| "region_type": "body_text|table|figure|equation|caption|header|reference|footnote", |
| "section": "results", |
| "subsection": "3.2_sensitivity_characterization", |
| "content": { |
| "text": "The LOD was 0.8 Β± 0.03 fM (Table 2)", |
| "markdown": "The LOD was 0.8 Β± 0.03 fM ([Table 2](#table-2))", |
| "parse_method": "marker", |
| "parse_confidence": 0.95, |
| "ocr_source": false |
| }, |
| "cross_references": [ |
| {"ref_text": "Table 2", "ref_type": "table", "resolved_to": "REG_00038", "verified": true} |
| ], |
| "extraction_status": "extractable|low_confidence|unextractable", |
| "quality_flags": [], |
| "figures": { |
| "detected": true, |
| "figure_type": "scatter_plot|bar_chart|diagram|micrograph|schematic", |
| "digitizable": true, |
| "digitized_data": null |
| } |
| } |
| ``` |
|
|
| **Chunking Strategy**: Section-aware, NOT page-based. |
| 1. Marker identifies section boundaries (Introduction, Methods, Results subsections) |
| 2. Chunk by section with 1-paragraph overlap to preceding and following sections |
| 3. Tables always kept whole (never split across chunks) |
| 4. Figure + caption always kept together |
| 5. Maximum chunk size: 4096 tokens (model context allows it) |
|
|
| **Paper Bundle Handling**: |
| ``` |
| Input: { |
| "main_pdf": "path/to/paper.pdf", |
| "supplements": ["path/to/supplement_1.pdf", "path/to/supplement_data.xlsx"], |
| "code_repo": "https://github.com/author/repo", |
| "dataset": "https://zenodo.org/record/12345" |
| } |
| ``` |
|
|
| ### 4.1 Layer 1: Entity Resolution |
|
|
| **Purpose**: Normalize entities, resolve citations, check retractions, establish version lineage. |
|
|
| **Components**: |
|
|
| ``` |
| Entity Normalizer |
| βββ Gene/protein names β UniProt ID |
| βββ Chemical names β PubChem CID |
| βββ Disease names β MeSH ID |
| βββ Assay names β BAO ontology |
| βββ Abbreviations β canonical form (LRU cache) |
| βββ Custom domain ontology (user-extensible) |
| |
| Citation Chain Resolver |
| βββ In-text "[32]" β reference list β DOI |
| βββ DOI β CrossRef metadata |
| βββ Check: is cited paper in knowledge base? |
| βββ If yes: link claim to original source |
| βββ If no: flag as "citation_orphan" for potential ingestion |
| βββ Classify: primary claim vs inherited citation |
| |
| Version of Record (VoR) Lineage |
| βββ Before ingestion: query DOI/arXiv for version chain |
| βββ If preprint exists in DB and VoR arriving: supersede |
| βββ If VoR exists and erratum arriving: amend specific claims |
| βββ If retraction: invalidate ALL claims, propagate penalty |
| βββ Store full lineage: preprint_doi β vor_doi β errata β retraction |
| |
| Retraction Checker |
| βββ CrossRef "update-to" relationship |
| βββ Retraction Watch database (periodic sync via companion model) |
| βββ Propagate retraction status through citation chains |
| ``` |
|
|
| ### 4.2 Layer 2: Qualified Extraction |
|
|
| **Purpose**: Extract claims with full epistemic qualification using the AI Model Council. |
|
|
| **Council Architecture** (Parallel-Then-Merge): |
|
|
| ``` |
| Round 1 (PARALLEL β no visibility between members): |
| ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ |
| β Query Plannerβ β Extractor β β Extractor 2 β β Critic β |
| β (decompose) β β (Qwen3-8B) β β (if heterog.)β β (adversarial)β |
| ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ |
| β β β β |
| βΌ βΌ βΌ βΌ |
| sub-queries claims_A claims_B critique |
| |
| Round 2 (DEBATE β see tags and reasoning, NOT confidence): |
| All members see each other's epistemic tags and reasoning chains |
| Each member can revise their classification |
| Confidence scores remain HIDDEN (prevents anchoring) |
| |
| Round 3 (SYNTHESIS β Chairman): |
| Chairman sees everything including confidence |
| Applies completeness penalty (code-enforced, not prompt-instructed) |
| Resolves disagreements with documented reasoning |
| Tags each claim with council_vote_distribution |
| ``` |
|
|
| **Epistemic Separation Engine**: |
|
|
| | Section | Epistemic Default | Confidence Modifier | |
| |---------|-------------------|-------------------| |
| | Results (with statistics) | Fact (if p < threshold) | 1.0 | |
| | Results (narrative) | Interpretation | 0.85 | |
| | Methods | Protocol metadata (not a claim) | N/A | |
| | Abstract | Interpretation (forced) | 0.7 penalty | |
| | Discussion | Interpretation or Hypothesis | 0.75 penalty | |
| | Conclusion | Cross-check against Results | 0.8 if supported, 0.5 if not | |
| | Supplement | Same as main body section rules | 1.0 (no penalty for supplement source) | |
|
|
| **Constrained Decoding** (Guidance engine): |
|
|
| ```python |
| from guidance import models, gen, select |
| |
| TAGS = ["Fact", "Interpretation", "Hypothesis", "Conflict_Hypothesis"] |
| |
| lm = models.Transformers("./research-os-grpo") # Local model |
| |
| with lm: |
| output = lm + f""" |
| Analyze this scientific text and extract claims. |
| |
| Text: {section_text} |
| Section: {section_name} |
| |
| <reasoning>{gen("reasoning", max_tokens=500)}</reasoning> |
| |
| Claims: |
| [ |
| {{ |
| "text": "{gen("claim_text", max_tokens=200)}", |
| "epistemic_tag": "{select(TAGS, name="tag")}", |
| "confidence_components": {{ |
| "evidence_strength": {gen("ev_str", regex=r"0\.[0-9][0-9]?[0-9]?", name="evidence")}, |
| "qualifiers": ["{gen("qualifiers", max_tokens=100)}"] |
| }}, |
| "source_quote": "{gen("source_quote", max_tokens=200)}", |
| "source_page": {gen("page", regex=r"[0-9]+", name="page")}, |
| "is_null_result": {select(["true", "false"], name="is_null")}, |
| "is_inherited_citation": {select(["true", "false"], name="is_inherited")} |
| }} |
| ] |
| """ |
| # output["tag"] is GUARANTEED to be in TAGS |
| # output["is_null"] is GUARANTEED to be boolean |
| ``` |
|
|
| **Claim Schema v2** (expanded from v1): |
|
|
| ```json |
| { |
| "claim_id": "CLM_00042", |
| "text": "The LOD was 0.8 fM in 10 mM PBS", |
| "epistemic_tag": "Fact", |
| "confidence": 0.855, |
| "confidence_components": { |
| "evidence_strength": 900, |
| "study_quality_weight": 1000, |
| "journal_tier_weight": 1000, |
| "completeness_penalty": 1000, |
| "section_modifier": 1000, |
| "qualifier_penalty": 950 |
| }, |
| "qualifiers": ["in 10 mM PBS only", "n=5"], |
| "missing_fields": [], |
| "status": "Complete", |
| "is_null_result": false, |
| "is_inherited_citation": false, |
| "causal_direction": "observed_correlation", |
| "statistical_evidence": { |
| "p_value": 0.001, |
| "effect_size": 2.1, |
| "effect_size_type": "cohens_d", |
| "sample_size": 5, |
| "confidence_interval": [0.6, 1.0], |
| "practical_significance": true |
| }, |
| "source_quote": "The limit of detection was determined to be 0.8 fM using the 3Ο/slope method.", |
| "source_page": 5, |
| "source_bbox": [72, 340, 540, 365], |
| "source_section": "results", |
| "source_doi": "10.1234/example", |
| "council_vote": { |
| "extractor_1": {"tag": "Fact", "reasoning": "Direct measurement with statistics"}, |
| "extractor_2": {"tag": "Fact", "reasoning": "Quantitative with clear methodology"}, |
| "critic": {"tag": "Fact", "reasoning": "Supported by Table 2 data"}, |
| "chairman": {"tag": "Fact", "reasoning": "Unanimous agreement, strong statistics"} |
| }, |
| "granularity": "atomic", |
| "parent_claim_id": null, |
| "sub_claims": [], |
| "ontology_version": "quantum_bio_v1", |
| "pipeline_version": "2.1.0", |
| "taxonomy_version": "quantum_bio_v1", |
| "extraction_timestamp": "2026-04-23T10:30:00Z" |
| } |
| ``` |
|
|
| ### 4.3 Layer 3: Canonicalization |
|
|
| **Purpose**: Deduplicate claims, merge aliases, aggregate evidence, track temporal versions. |
|
|
| ``` |
| New claim arrives β |
| 1. Embed claim text (local embedding model or Qwen3-8B last-hidden-state) |
| 2. Search existing canonical claims (cosine similarity) |
| 3. If similarity > 0.85: |
| βββ MERGE: Add new source as evidence for existing canonical claim |
| βββ Update evidence_count, source_list, confidence (re-aggregate) |
| βββ If confidence_components differ significantly: flag for human review |
| βββ Store alias mapping: new_claim_id β canonical_claim_id |
| 4. If similarity 0.70-0.85: |
| βββ FLAG as "potential duplicate β review recommended" |
| βββ Show both claims in review queue with similarity score |
| 5. If similarity < 0.70: |
| βββ CREATE new canonical claim |
| ``` |
|
|
| **Temporal Versioning**: |
| ``` |
| canonical_claim: |
| version_history: [ |
| {version: 1, source: "preprint_2024", confidence: 0.65, date: "2024-03"}, |
| {version: 2, source: "vor_2024", confidence: 0.85, date: "2024-09"}, |
| {version: 3, source: "new_study_2025", confidence: 0.90, date: "2025-02"} |
| ] |
| current_version: 3 |
| supersedes: null |
| superseded_by: null |
| ``` |
|
|
| ### 4.4 Layer 4: Knowledge Graph |
|
|
| **Implementation**: SQLite-backed adjacency list (NOT Neo4j β keeps the system local and zero-dependency). |
|
|
| **Schema**: |
|
|
| ```sql |
| CREATE TABLE graph_nodes ( |
| node_id TEXT PRIMARY KEY, -- canonical_claim_id or entity_id |
| node_type TEXT NOT NULL, -- claim | entity | method | condition |
| label TEXT NOT NULL, |
| properties TEXT, -- JSON |
| created_at TEXT NOT NULL |
| ); |
| |
| CREATE TABLE graph_edges ( |
| edge_id TEXT PRIMARY KEY, |
| source_node TEXT NOT NULL, |
| target_node TEXT NOT NULL, |
| edge_type TEXT NOT NULL, -- supports | refutes | extends | depends_on | |
| -- supersedes | blocks | investigative_hypothesis | |
| -- method_uses | condition_applies |
| confidence INTEGER NOT NULL, -- Fixed-point Γ1000 |
| evidence_sources TEXT, -- JSON array of source DOIs |
| is_inferred INTEGER DEFAULT 0, -- 0=observed, 1=inferred (transitive) |
| inference_chain TEXT, -- JSON: hop details if inferred |
| method_compatible INTEGER, -- NULL=unchecked, 0=incompatible, 1=compatible |
| created_at TEXT NOT NULL, |
| updated_at TEXT NOT NULL, |
| FOREIGN KEY(source_node) REFERENCES graph_nodes(node_id), |
| FOREIGN KEY(target_node) REFERENCES graph_nodes(node_id) |
| ); |
| |
| -- Index for fast graph traversal |
| CREATE INDEX idx_edges_source ON graph_edges(source_node); |
| CREATE INDEX idx_edges_target ON graph_edges(target_node); |
| CREATE INDEX idx_edges_type ON graph_edges(edge_type); |
| ``` |
|
|
| **Edge Types**: |
|
|
| | Type | Meaning | Confidence Rule | |
| |------|---------|----------------| |
| | `supports` | Claim A provides evidence for Claim B | From source text, observed | |
| | `refutes` | Claim A contradicts Claim B | From source text or conflict detection | |
| | `extends` | Claim A adds conditions/parameters to B | Section analysis | |
| | `depends_on` | Claim A assumes Claim B is true | Citation chain analysis | |
| | `supersedes` | Claim A replaces older Claim B (newer data) | Temporal versioning | |
| | `blocks` | Null finding: no evidence of relationship | Null result extraction | |
| | `investigative_hypothesis` | Inferred multi-hop (NOT observed) | min(hop_confidences) Γ 0.5 | |
| |
| **Transitive Inference Constraints**: |
| - NEVER auto-generate `supports` across multiple hops |
| - Only `investigative_hypothesis` edges for multi-hop |
| - Require method_compatible=1 for each hop before generating inference |
| - Default queries return observed edges only |
| - `include_inferred=True` flag required for graph queries that include inferences |
|
|
| **Gap Analysis Protocol**: |
| ```python |
| def find_gaps(self, domain_id: str) -> list: |
| """Find structural holes in the knowledge graph.""" |
| # 1. Get all entities in domain |
| entities = self.get_entities(domain_id) |
| |
| # 2. For each entity pair in same domain |
| for a, b in combinations(entities, 2): |
| # 3. Check if edge exists |
| edges = self.get_edges(a.id, b.id) |
| if not edges: |
| # 4. Check if both are well-connected (dense neighborhood) |
| a_degree = self.get_degree(a.id) |
| b_degree = self.get_degree(b.id) |
| if a_degree > 3 and b_degree > 3: |
| # 5. This is a high-value gap |
| info_gain = (a_degree + b_degree) / max_degree |
| gaps.append({ |
| "entity_a": a, "entity_b": b, |
| "information_gain": info_gain, |
| "suggested_action": "experiment" if info_gain > 0.7 else "literature_search" |
| }) |
| |
| return sorted(gaps, key=lambda g: -g["information_gain"]) |
| ``` |
|
|
| ### 4.5 Layer 5: Calibrated Scoring |
|
|
| **Purpose**: Compute confidence using CODE, not LLM. Three separate scores. |
|
|
| ```python |
| def compute_claim_scores(claim: dict, source: dict, section: str) -> dict: |
| """ |
| Code-computed scoring. The LLM provides COMPONENTS, |
| the code computes the FINAL SCORES. |
| |
| The LLM NEVER sets the final confidence directly. |
| """ |
| # ββ Score 1: Evidence Quality ββ |
| evidence_strength = claim["confidence_components"]["evidence_strength"] # From LLM |
| study_quality = taxonomy.get_weight(source["study_type"], domain_id) # From taxonomy |
| journal_tier = JOURNAL_TIER_WEIGHTS[source["journal_tier"]] # From config |
| completeness = 700 if claim["missing_fields"] else 1000 # Binary: code enforced |
| section_mod = SECTION_MODIFIERS[section] # From config |
| |
| # Fixed-point multiplication chain |
| evidence_quality = (evidence_strength * study_quality // 1000 |
| * journal_tier // 1000 |
| * completeness // 1000 |
| * section_mod // 1000) |
| |
| # ββ Score 2: Claim Truth Likelihood ββ |
| # Based on evidence quality + source count + conflict status |
| source_count_bonus = min(claim["evidence_count"] * 50, 200) # Max +0.2 for multiple sources |
| conflict_penalty = -300 if claim.get("has_active_conflict") else 0 |
| null_evidence_penalty = -200 if claim.get("has_null_evidence") else 0 |
| |
| truth_likelihood = min(1000, max(0, |
| evidence_quality + source_count_bonus + conflict_penalty + null_evidence_penalty |
| )) |
| |
| # ββ Score 3: Qualifier Strength ββ |
| # How definitive is the claim's language? |
| qualifier_count = len(claim.get("qualifiers", [])) |
| is_null = claim.get("is_null_result", False) |
| is_inherited = claim.get("is_inherited_citation", False) |
| |
| qualifier_strength = 1000 |
| if qualifier_count > 0: |
| qualifier_strength -= qualifier_count * 100 # -0.1 per qualifier |
| if is_null: |
| qualifier_strength = min(qualifier_strength, 500) # Cap at 0.5 for null results |
| if is_inherited: |
| qualifier_strength -= 200 # -0.2 for inherited citations |
| qualifier_strength = max(0, qualifier_strength) |
| |
| # ββ Statistical Evidence Gate ββ |
| stats = claim.get("statistical_evidence", {}) |
| if stats.get("effect_size") is not None: |
| effect = stats["effect_size"] |
| sample_n = stats.get("sample_size", 0) |
| |
| # Large N + tiny effect = statistically significant but practically meaningless |
| if sample_n > 1000 and abs(effect) < 0.1: |
| # Override: this is NOT practically significant |
| evidence_quality = min(evidence_quality, 400) # Cap at 0.4 |
| claim["practical_significance"] = False |
| |
| # ββ Parser Confidence Propagation ββ |
| parse_conf = claim.get("parse_confidence", 1000) |
| evidence_quality = min(evidence_quality, parse_conf) # Parser uncertainty CAPS claim |
| |
| return { |
| "evidence_quality": evidence_quality, # Fixed-point Γ1000 |
| "truth_likelihood": truth_likelihood, # Fixed-point Γ1000 |
| "qualifier_strength": qualifier_strength, # Fixed-point Γ1000 |
| "composite_confidence": (evidence_quality + truth_likelihood + qualifier_strength) // 3, |
| "practical_significance": claim.get("practical_significance", True), |
| } |
| ``` |
|
|
| ### 4.6 Layer 6: Evaluation |
|
|
| **Evaluation Pipeline** (runs in CI/CD on every prompt/model/taxonomy change): |
|
|
| ``` |
| 1. STRUCTURAL TESTS (existing 119 tests β code correctness) |
| βββ pytest tests/ β all pass? |
| |
| 2. GOLDEN DATASET REGRESSION (versioned annotations) |
| βββ Extraction recall β₯ 70% |
| βββ Hallucination rate β€ 10% |
| βββ Epistemic accuracy β₯ 60% |
| βββ Qualifier preservation rate β₯ 80% (NEW) |
| βββ Null result detection rate β₯ 50% (NEW) |
| |
| 3. LLM-AS-JUDGE (faithfulness & grounding) |
| βββ Faithfulness: does extracted claim appear in source text? |
| βββ Grounding: can claim be traced to specific source quote? |
| βββ Tag correctness: does epistemic tag match expert judgment? |
| βββ Qualifier preservation: are hedging words maintained? |
| βββ Run on 5 golden papers, 3 times each (stochastic check) |
| |
| 4. CALIBRATION CHECK (monthly) |
| βββ Brier score from calibration_log |
| βββ Alert if ECE > 0.25 |
| βββ Trigger ConfTuner re-training if needed |
| |
| 5. HIDDEN HOLDOUT (never seen during development) |
| βββ 3 papers reserved, never used in training or golden set |
| βββ Evaluated quarterly |
| βββ Detects benchmark overfitting |
| ``` |
|
|
| **Versioned Annotation Guidelines**: |
| ``` |
| /evaluation/ |
| βββ guidelines_v1.0.md # Annotation rules (version controlled) |
| βββ golden_dataset/ |
| β βββ paper_001.json # Annotated under guidelines v1.0 |
| β βββ paper_002.json # Annotated under guidelines v1.0 |
| β βββ paper_006.json # Annotated under guidelines v1.1 |
| βββ frozen_anchors/ # NEVER re-annotated |
| β βββ paper_001_frozen.json |
| β βββ paper_002_frozen.json |
| βββ holdout/ # NEVER seen during development |
| βββ paper_H1.json |
| βββ paper_H2.json |
| ``` |
|
|
| ### 4.7 Layer 7: Provenance & Reproducibility |
|
|
| **Output Lineage** (every claim tagged): |
| ```json |
| { |
| "pipeline_version": "2.1.0", |
| "model_checkpoint": "research-os-grpo-v2-step-5000", |
| "parser_version": "marker-1.2.0", |
| "taxonomy_version": "quantum_bio_v1", |
| "prompt_hash": "sha256:a3b4c5...", |
| "extraction_timestamp": "2026-04-23T10:30:00Z", |
| "guidance_schema_version": "1.0" |
| } |
| ``` |
|
|
| **Security Sandbox** (for repository validation): |
| ``` |
| ββββ SANDBOX (isolated from main system) ββββββββββββββββββ |
| β β’ Timeout: 60 seconds max per URL check β |
| β β’ Network: HTTP GET only, no POST/PUT/DELETE β |
| β β’ Download limit: 100MB per artifact β |
| β β’ No code execution (dry-run validation only) β |
| β β’ Actual code execution requires human authorization β |
| β β’ Credential isolation: no access to main DB or API keysβ |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| ``` |
|
|
| **Epistemic Embargo** (for IP protection): |
| ``` |
| User creates "Private Graph" β |
| All claims extracted in this mode go to private subgraph β |
| Private subgraph is NOT visible to other users / companion agents β |
| After paper submission: user clicks "Merge to Lab Graph" β |
| Claims move from private to shared graph with full provenance |
| ``` |
|
|
| --- |
|
|
| ## 5. UI Architecture |
|
|
| ### 5.1 Courtroom UI (Conflict Resolution) |
|
|
| ``` |
| Default View (Review Queue): |
| β οΈ 3-way conflict detected β Debye screening threshold |
| Papers: Chen 2022, Nakamura 2023, Williams 2024 |
| Comparability confidence: 0.58 (method differences detected) |
| [Review] [Defer] [Dismiss] |
| |
| Expanded View (Courtroom β click to open): |
| βββββββββββββββ¬ββββββββββββββ¬ββββββββββββββ |
| β Chen 2022 β Nakamura 23 β Williams 24 β |
| β ACS Nano T1 β Biosens. T1 β Sensors T3 β |
| βββββββββββββββΌββββββββββββββΌββββββββββββββ€ |
| β Claim text β Claim text β Claim text β |
| β (nestable) β (nestable) β (nestable) β |
| βββββββββββββββΌββββββββββββββΌββββββββββββββ€ |
| β Method box β Method box β Method box β |
| β N=5 p<.001 β N=12 p<.01 β N=3 p=.12 β |
| β [PDFπ] β [PDFπ] β [PDFπ] β |
| βββββββββββββββ΄ββββββββββββββ΄ββββββββββββββ |
| |
| System Analysis (Level 5 β unverified): |
| "These claims are not directly comparable..." |
| Confidence in analysis: 0.62 |
| |
| Council Votes: Ext1: scope_diff | Ext2: value_mismatch | Critic: scope_diff |
| |
| [Agree] [Override with custom] [Defer β need more info] |
| |
| β οΈ Missing competitor evidence: |
| "3 papers cited by these sources are not yet ingested" |
| [Ingest Park 2023] [Ingest Liu 2024] [Ingest Fernandez 2023] |
| ``` |
|
|
| ### 5.2 Progressive Disclosure Levels |
|
|
| ``` |
| Level 0: Dashboard |
| Epistemic Health Score per claim cluster |
| Today's review queue (priority-ranked) |
| |
| Level 1: Claim Detail |
| Text + tag + composite confidence + source |
| [Expand to see scoring breakdown] |
| |
| Level 2: Scoring Breakdown |
| 3 separate scores (evidence, truth, qualifier) |
| Statistical evidence if available |
| Parser confidence for this region |
| |
| Level 3: Provenance Chain |
| Source quote + page + bbox |
| Council vote distribution |
| Pipeline version + model checkpoint |
| |
| Level 4: Graph Neighborhood |
| 2-hop subgraph around this claim |
| Typed edges visible |
| Inferred edges dashed + labeled |
| |
| Level 5: Full Debug |
| Raw LLM outputs from each council member |
| Token-level confidence distribution |
| Parse regions and quality flags |
| ``` |
|
|
| ### 5.3 Manual Synthesis Mode |
|
|
| ``` |
| [Toggle] π§ Manual Synthesis Mode: ON |
| |
| In this mode: |
| β
Claims displayed (text + source) |
| β
Organized by topic clusters |
| β NO confidence scores shown |
| β NO conflict flags shown |
| β NO gap analysis shown |
| β NO system suggestions |
| |
| The researcher draws connections manually. |
| Then switches back to compare with system's analysis. |
| ``` |
|
|
| --- |
|
|
| ## 6. Local Deployment |
|
|
| ### 6.1 Minimal Setup (16GB VRAM) |
|
|
| ```bash |
| # 1. Install Ollama (simplest local LLM server) |
| curl -fsSL https://ollama.com/install.sh | sh |
| |
| # 2. Pull quantized model (after fine-tuning and uploading GGUF) |
| ollama pull nkshirsa/research-os-brain:q4_k_m |
| |
| # 3. Verify it's running |
| curl http://localhost:11434/api/generate -d '{"model": "research-os-brain:q4_k_m", "prompt": "test"}' |
| |
| # 4. Start the Research OS |
| pip install -r requirements.txt |
| python -m phd_research_os.serve --model ollama://research-os-brain:q4_k_m --port 8080 |
| |
| # 5. Open UI |
| # http://localhost:8080 |
| ``` |
|
|
| ### 6.2 VRAM Budget |
|
|
| ``` |
| Qwen3-8B Q4 AWQ weights: ~5.0 GB |
| PolarQuant KV cache (128K): ~3.8 GB |
| Qwen3-VL-8B Q4 (for figures): ~5.0 GB (loaded on-demand, not persistent) |
| Guidance engine overhead: ~0.5 GB |
| ChromaDB embeddings: ~0.5 GB |
| ββββββββββββββββββββββββββββββββββββββ |
| Total (text only): ~9.8 GB β fits 16GB GPU |
| Total (with VLM loaded): ~14.8 GB β fits 16GB GPU (tight) |
| Total (with VLM on-demand): ~9.8 GB β swap VLM in/out per figure |
| ``` |
|
|
| --- |
|
|
| ## 7. Data Flow (Complete Pipeline) |
|
|
| ``` |
| PDF Bundle arrives |
| β |
| βΌ |
| LAYER 0: Structural Ingestion |
| βββ Marker: layout-aware markdown with section boundaries |
| βββ Nougat: equations β LaTeX (routed by region classifier) |
| βββ GROBID: references β structured citations |
| βββ Figure regions β classify β VLM (semantic) or Digitizer (quantitative) |
| βββ Per-region quality scoring (parse_confidence, ocr_confidence) |
| βββ Cross-reference verification (Figure 3 β correct figure object?) |
| βββ Output: list of annotated regions with bbox, section, quality |
| β |
| βΌ |
| LAYER 1: Entity Resolution |
| βββ Normalize entities (gene names, chemicals, assays β canonical IDs) |
| βββ Resolve in-text citations ([32] β DOI β metadata) |
| βββ Check VoR lineage (is this a preprint we already have?) |
| βββ Check retraction status (CrossRef + Retraction Watch) |
| βββ Tag: primary vs inherited claims |
| β |
| βΌ |
| LAYER 2: Qualified Extraction (AI Model Council) |
| βββ Round 1 (parallel): Query Planner + 2 Extractors + Critic |
| β Each independently processes section-aware chunks |
| β Guidance engine enforces: valid JSON, valid tags, valid ranges |
| β Section modifier applied (Abstract=0.7, Results=1.0, Discussion=0.75) |
| βββ Round 2 (debate): Share tags + reasoning (NOT confidence) |
| βββ Round 3 (chairman): Synthesize final claims |
| β Apply completeness penalty (code-enforced: 0.7 if missing fields) |
| β Preserve qualifiers from source text |
| β Extract statistical evidence (N, p, d, CI) |
| β Tag null results, inherited citations, causal direction |
| βββ Output: list of qualified claims with full provenance |
| β |
| βΌ |
| LAYER 3: Canonicalization |
| βββ Embed each new claim |
| βββ Compare against existing canonical claims (cosine > 0.85 = merge) |
| βββ Merge: add source as evidence, update confidence aggregation |
| βββ Create: new canonical claim with first source |
| βββ Temporal versioning: if same claim from VoR supersedes preprint version |
| β |
| βΌ |
| LAYER 4: Knowledge Graph |
| βββ Insert claim as graph node |
| βββ Create edges from citation analysis (supports, depends_on) |
| βββ Run conflict detector (keyword + embedding similarity for candidates) |
| βββ Council evaluates candidate conflicts β typed edges (refutes, scope_diff) |
| βββ Check for null evidence β blocking edges |
| βββ Update method-compatibility metadata on edges |
| βββ Cluster related conflicts into case files |
| βββ Run gap analysis (if in Research Landscape mode) |
| β |
| βΌ |
| LAYER 5: Calibrated Scoring (CODE-COMPUTED) |
| βββ evidence_quality = evidence Γ quality Γ tier Γ completeness Γ section |
| βββ truth_likelihood = evidence_quality + source_bonus - conflict_penalty |
| βββ qualifier_strength = 1.0 - qualifier_countΓ0.1 - null_penalty - inherited_penalty |
| βββ Statistical evidence gate: large N + tiny effect β cap confidence |
| βββ Parser confidence propagation: parse_confidence caps evidence_quality |
| βββ Store all 3 scores + composite on claim |
| β |
| βΌ |
| LAYER 6: Evaluation (on config change) |
| βββ Regression gate against golden dataset |
| βββ LLM-as-Judge faithfulness + grounding check |
| βββ Brier score monitoring (monthly) |
| βββ Hidden holdout benchmark (quarterly) |
| β |
| βΌ |
| LAYER 7: Provenance |
| βββ Tag claim with full pipeline version lineage |
| βββ Store bbox + source quote for UI traceability |
| βββ Export: Obsidian vault, Courtroom UI, CSV, BibTeX |
| ``` |
|
|
| --- |
|
|
| ## 8. Implementation Phases (Aligned with PhD Timeline) |
|
|
| ### Phase A: Foundation (Weeks 1-6) β MUST BE FIRST |
|
|
| | Week | Task | Deliverable | |
| |------|------|-------------| |
| | 1-2 | Integrate Marker for PDF β structured markdown | Section-aware regions with bbox | |
| | 3 | Add Nougat routing for equation-heavy regions | LaTeX preservation | |
| | 4 | Implement section-aware chunking (replace page-based) | Semantic chunks | |
| | 5 | Add quality scoring per-region | parse_confidence on every span | |
| | 6 | Integrate Guidance engine for constrained decoding | Guaranteed valid JSON output | |
| |
| ### Phase B: Identity (Weeks 7-12) |
| |
| | Week | Task | Deliverable | |
| |------|------|-------------| |
| | 7-8 | Claim canonicalization with embedding dedup | Canonical registry | |
| | 9 | Entity normalization (abbreviations, synonyms) | Ontology mapper | |
| | 10-11 | Citation chain resolution ([32] β DOI) | Primary vs inherited tagging | |
| | 12 | VoR lineage detection | Preprint β VoR superseding | |
| |
| ### Phase C: Structure (Weeks 13-20) |
| |
| | Week | Task | Deliverable | |
| |------|------|-------------| |
| | 13-14 | SQLite-backed knowledge graph with typed edges | Graph schema + CRUD | |
| | 15-16 | Qualifier preservation + null result handling | Blocking edges | |
| | 17-18 | Method-compatibility layer | Comparability confidence | |
| | 19-20 | Conflict clustering into case files | Case file UI | |
| |
| ### Phase D: Calibration (Weeks 21-26) |
| |
| | Week | Task | Deliverable | |
| |------|------|-------------| |
| | 21-22 | Epistemic Separation Engine (section modifiers) | Section-aware scoring | |
| | 23-24 | Statistical evidence extraction (N, p, d, CI) | Practical significance gate | |
| | 25-26 | GRPO training with epistemic reward functions | Trained model v2 | |
| |
| ### Phase E: Judgment (Weeks 27-32) |
| |
| | Week | Task | Deliverable | |
| |------|------|-------------| |
| | 27-28 | Courtroom UI with PDF.js bounding box viewer | Provenance display | |
| | 29-30 | Council parallel-then-merge architecture | Hidden confidence protocol | |
| | 31-32 | Conflict clustering + case file resolution | Batch conflict resolution | |
| |
| ### Phase F: Longevity (Ongoing, PhD Year 1+) |
| |
| | Task | Trigger | |
| |------|---------| |
| | Versioned ontology with backward-compatible queries | 3rd taxonomy update | |
| | VoR lineage tracking | First preprint β VoR encounter | |
| | Ongoing Brier calibration monitoring | 50+ calibration data points | |
| | Gold-standard drift detection | 2nd annotation batch | |
| | Gap Analysis Protocol | 100+ papers ingested | |
| | Manual Synthesis Mode | Thesis writing phase | |
| |
| --- |
| |
| ## 9. File Structure (v2.0) |
| |
| ``` |
| phd-research-os/ |
| βββ SYSTEM_DESIGN.md # THIS DOCUMENT |
| βββ BLINDSPOT_AUDIT_COMPLETE.md # 87-blindspot audit |
| β |
| βββ phd_research_os/ # Core Python package |
| β βββ __init__.py |
| β β |
| β βββ layer0/ # Structural Ingestion |
| β β βββ parser.py # Marker + Nougat + GROBID orchestrator |
| β β βββ region_classifier.py # LayoutLMv3 region classification |
| β β βββ chunker.py # Section-aware chunking |
| β β βββ figure_router.py # VLM vs Digitizer routing |
| β β βββ plot_digitizer.py # Quantitative plot β CSV |
| β β βββ quality_scorer.py # Per-span quality scoring |
| β β βββ cross_ref_verifier.py # Figure/Table reference integrity |
| β β |
| β βββ layer1/ # Entity Resolution |
| β β βββ entity_normalizer.py # Ontology-aware normalization |
| β β βββ citation_resolver.py # In-text [32] β DOI |
| β β βββ vor_lineage.py # Version of Record tracking |
| β β βββ retraction_checker.py # CrossRef + Retraction Watch |
| β β |
| β βββ layer2/ # Qualified Extraction |
| β β βββ council.py # Parallel-then-merge council (upgraded) |
| β β βββ epistemic_separator.py # Abstract vs Results scoring |
| β β βββ qualifier_extractor.py # Hedging, negation, conditions |
| β β βββ statistical_extractor.py # N, p, d, CI extraction |
| β β βββ constrained_decoder.py # Guidance engine integration |
| β β βββ ood_detector.py # Mahalanobis distance OOD gating |
| β β |
| β βββ layer3/ # Canonicalization |
| β β βββ deduplicator.py # Embedding-based near-duplicate detection |
| β β βββ canonical_registry.py # Canonical claim management |
| β β βββ alias_merger.py # Alias mapping and merging |
| β β βββ temporal_versioner.py # Claim version history |
| β β |
| β βββ layer4/ # Knowledge Graph |
| β β βββ graph.py # SQLite-backed graph with typed edges |
| β β βββ conflict_detector.py # Pairwise conflict detection (upgraded) |
| β β βββ conflict_clusterer.py # Case file generation |
| β β βββ method_compatibility.py # Cross-paper method comparison |
| β β βββ gap_analyzer.py # Structural hole detection |
| β β βββ transitive_constraints.py # Multi-hop inference safety |
| β β |
| β βββ layer5/ # Calibrated Scoring |
| β β βββ scorer.py # Code-computed 3-score system |
| β β βββ statistical_gate.py # Effect size / practical significance |
| β β βββ section_modifiers.py # Abstract/Results/Discussion weights |
| β β βββ calibration_monitor.py # Brier score tracking |
| β β |
| β βββ layer6/ # Evaluation |
| β β βββ regression_gate.py # Golden dataset regression |
| β β βββ llm_judge.py # Faithfulness/grounding evaluation |
| β β βββ stochastic_tester.py # Run-N-times variance check |
| β β βββ annotation_drift.py # Gold-standard drift detection |
| β β |
| β βββ layer7/ # Provenance |
| β β βββ lineage_tagger.py # Pipeline version tagging |
| β β βββ security_sandbox.py # Isolated URL/repo validation |
| β β βββ license_checker.py # Usage rights verification |
| β β βββ embargo_manager.py # Private graph / merge workflow |
| β β |
| β βββ ui/ # Gradio UI |
| β β βββ app.py # Main application |
| β β βββ courtroom.py # Conflict resolution courtroom |
| β β βββ dashboard.py # Epistemic health dashboard |
| β β βββ pdf_viewer.py # PDF.js with bbox highlighting |
| β β βββ manual_synthesis.py # AI-free exploration mode |
| β β βββ export.py # CSV, BibTeX, JSON, Obsidian export |
| β β |
| β βββ core/ # Shared infrastructure |
| β β βββ db.py # SQLite data layer (existing, extended) |
| β β βββ taxonomy.py # Quantum-Bio V2 (existing) |
| β β βββ agents.py # Brain interface (existing, upgraded) |
| β β βββ agent_os.py # ECC Harness (existing) |
| β β βββ meta_improver.py # Meta-Improver (existing) |
| β β βββ skills/ # Superpowers (existing) |
| β β |
| β βββ training/ # Model training |
| β β βββ train_sft.py # Stage 1: SFT |
| β β βββ train_dpo.py # Stage 2: DPO |
| β β βββ train_grpo.py # Stage 3: GRPO with epistemic rewards |
| β β βββ train_calibration.py # Stage 4: ConfTuner |
| β β βββ reward_functions.py # JSON validity, schema, qualifier rewards |
| β β βββ generate_dataset.py # Synthetic + real data generation |
| β β |
| β βββ config/ # Version-controlled configuration |
| β βββ prompts/ # All system prompts (git-tracked) |
| β βββ taxonomy/ # Domain taxonomies |
| β βββ scoring/ # Weight tables, thresholds |
| β βββ evaluation/ # Golden dataset + guidelines |
| β |
| βββ tests/ |
| β βββ test_layer0.py # Structural ingestion tests |
| β βββ test_layer1.py # Entity resolution tests |
| β βββ test_layer2.py # Extraction tests |
| β βββ test_layer3.py # Canonicalization tests |
| β βββ test_layer4.py # Knowledge graph tests |
| β βββ test_layer5.py # Scoring tests |
| β βββ test_layer6.py # Evaluation tests |
| β βββ test_layer7.py # Provenance tests |
| β βββ test_db.py # Data layer (existing 22 tests) |
| β βββ test_agent_os.py # ECC harness (existing 21 tests) |
| β βββ test_taxonomy.py # Taxonomy (existing 27 tests) |
| β βββ test_skills_and_meta.py # Skills + meta (existing 30 tests) |
| β βββ test_council.py # Council (existing 19 tests) |
| β |
| βββ docs/ |
| βββ ARCHITECTURE.md # Project map (existing) |
| βββ AGENTS.md # Agent registry (existing) |
| βββ USAGE.md # Daily workflow guide |
| βββ ANNOTATION_GUIDELINES.md # Versioned golden dataset rules |
| βββ DEPLOYMENT.md # Local setup guide |
| ``` |
| |
| --- |
|
|
| ## 10. Success Criteria |
|
|
| The system is DONE when: |
|
|
| 1. **A researcher can drop a PDF and get back epistemic-tagged claims with source bounding boxes in under 5 minutes** |
| 2. **Two claims from different papers that say the same thing are automatically recognized as the same canonical claim** |
| 3. **A null result creates a blocking edge, not a gap, in the knowledge graph** |
| 4. **An Abstract claim that overstates the Results gets automatically penalized** |
| 5. **The courtroom shows three conflicting papers side-by-side with method comparison and the researcher can resolve in 2 clicks** |
| 6. **The gap analyzer identifies untested entity pairs and generates Decision Objects** |
| 7. **The system knows when it doesn't know β OOD papers, unextractable regions, and uncalibrated confidence all surface to the human** |
| 8. **All of the above works on a 16GB consumer GPU with zero internet dependency for paper processing** |
|
|
| --- |
|
|
| *This design addresses all 87 blindspots from the complete audit.* |
| *Implementation timeline: ~32 weeks pre-PhD + ongoing during PhD Year 1-3.* |
| *The hardest part is not building it. It's keeping it honest.* |
|
|
| --- |
|
|
| ## Appendix A: Future Architecture Directions |
|
|
| > **Status**: Research-Backed Design Proposals β Not Yet Implemented |
| > |
| > The following sections describe architecture improvements validated by recent peer-reviewed research. Each addresses a specific bottleneck in the current v2.0 design. Implementation is targeted for Phase F (Longevity) or beyond. |
|
|
| --- |
|
|
| ### A.1 Multi-Graph Agentic Memory (MAGMA Architecture) |
|
|
| **Source**: Jiang et al., *MAGMA: A Multi-Graph based Agentic Memory Architecture for AI Agents*, arXiv:2601.03236 |
|
|
| **Problem**: The current Layer 4 Knowledge Graph uses a single graph with typed edges (`supports`, `refutes`, `extends`, `depends_on`, `supersedes`, `blocks`, `investigative_hypothesis`). All relational information β semantic similarity, temporal ordering, causal inference, and entity references β is stored in one monolithic edge space. This entangles orthogonal dimensions of reasoning and limits interpretability. When a user asks "Why did the 2023 paper reach a different conclusion?", the system must traverse edges that mix temporal, causal, and semantic relationships without query-adaptive guidance. |
|
|
| **MAGMA's Solution**: Decouple memory representation into four orthogonal relation graphs over a shared node set: |
|
|
| | Graph | Edge Semantics | Use Case in Research OS | |
| |-------|---------------|------------------------| |
| | **Temporal Graph** `π’_temp` | Strictly ordered pairs `(n_i, n_j)` where `Ο_i < Ο_j` | Chronological claim evolution: preprint β VoR β erratum β retraction | |
| | **Causal Graph** `π’_causal` | Directed edges representing logical entailment | "Because method X was used, result Y follows" | |
| | **Semantic Graph** `π’_sem` | Undirected edges: `cos(v_i, v_j) > ΞΈ_sim` | Conceptually similar claims across different papers | |
| | **Entity Graph** `π’_ent` | Bipartite edges: events β abstract entity nodes | Object permanence: "LOD" entity linked to all claims mentioning it | |
|
|
| **Query-Adaptive Traversal**: Instead of static graph lookups, MAGMA formulates retrieval as policy-guided traversal. A Router `β` decomposes the user query into structured control signals: |
|
|
| 1. **Intent Classification** `T_q β {Why, When, Entity, What}` β "Why" queries bias traversal toward `π’_causal`; "When" queries bias toward `π’_temp` |
| 2. **Temporal Parsing** `[Ο_s, Ο_e]` β hard time-window filter before graph traversal |
| 3. **Representation Extraction** β dense embedding `qβ` for semantic anchor search + sparse keywords for lexical matching |
|
|
| **Anchor Identification**: Multi-signal fusion via Reciprocal Rank Fusion (RRF): |
| ``` |
| S_anchor = Top_K( Ξ£_{m β {vec, key, time}} 1 / (k + r_m(n)) ) |
| ``` |
|
|
| **Adaptive Beam Search**: From anchors, expand context using a dynamic transition score: |
| ``` |
| S(n_j | n_i, q) = exp( Ξ»β Β· Ο(type(e_ij), T_q) [structural alignment] |
| + Ξ»β Β· sim(nβ_j, qβ) ) [semantic affinity] |
| ``` |
| where `Ο` rewards edge types matching the query intent (e.g., causal edges for "Why" queries). |
|
|
| **Why This Is a Clear Improvement for the Research OS**: |
| - The system already stores temporal, causal, and entity information β but crammed into a single `edge_type` column. MAGMA's separation makes each dimension independently queryable and interpretable. |
| - Long-horizon reasoning across hundreds of papers requires chronological traversal ("what did we believe in 2020 vs 2024?"), causal traversal ("what methods caused this result?"), and semantic traversal ("what else is like this?") β a single graph forces all three into one edge space. |
| - The policy-guided router aligns retrieval with the user's actual intent, rather than returning generic nearest-neighbor results. |
| - Experiments on LoCoMo (9K-token avg. conversations) and LongMemEval (100K+ token contexts) show consistent outperformance vs. monolithic memory baselines. |
|
|
| **Implementation Path**: |
| - Phase 1: Extend `graph_edges` schema to support `graph_id β {semantic, temporal, causal, entity}` (SQLite migration) |
| - Phase 2: Implement Router `β` as a lightweight classifier (can reuse Qwen3-8B with a classification head) |
| - Phase 3: Replace static `get_edges()` with policy-guided traversal engine |
| - Phase 4: Add adaptive `Ξ»β, Ξ»β` weights tuned on researcher query logs |
|
|
| --- |
|
|
| ### A.2 Post-Transformer Model Architecture: The Linear-Scaling Era |
|
|
| **Sources**: |
| - Gu & Dao, *Mamba: Linear-Time Sequence Modeling with Selective State Spaces*, 2023 |
| - Peng et al., *RWKV: Reinventing RNNs for the Transformer Era*, 2023 |
| - Team et al., *Jamba: A Hybrid Transformer-Mamba Language Model*, 2024 |
| - DeepSeek-AI, *DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model*, 2024 |
| - Nazari et al., *The Curious Case of In-Training Compression of State Space Models (CompreSSM)*, arXiv:2510.02823 |
|
|
| **Problem**: The current Research OS is built on decoder-only Transformers (Qwen2.5-3B β Qwen3-8B). For 128K-context paper ingestion, the Transformer faces three scaling walls that become exponentially worse as the knowledge base grows: |
|
|
| | Wall | Transformer Behavior | Impact on Research OS | |
| |------|---------------------|----------------------| |
| | **Memory Wall** | KV cache grows linearly with sequence length: `2 Γ n_layers Γ n_heads Γ d_head Γ seq_len` bytes per batch item | At 128K context, KV cache alone consumes ~3.8GB. Processing 10 papers simultaneously exhausts 16GB VRAM before model weights are counted. | |
| | **Compute Wall** | Self-attention is `O(nΒ²)` in sequence length. Doubling a paper's length quadruples attention compute. | Ingesting a 200K-token supplement (not uncommon in genomics) is 4Γ slower than a 100K-token paper, not 2Γ. | |
| | **Energy Wall** | Every new token requires attending to ALL previous tokens, even if 99% are irrelevant. | Long-term batch processing of paper libraries becomes prohibitively expensive on consumer hardware. | |
|
|
| **The Post-Transformer Landscape**: Four validated architecture families replace the `O(nΒ²)` bottleneck with `O(n)` or sub-quadratic scaling: |
|
|
| #### A.2.1 State Space Models (SSMs) β Mamba Family |
|
|
| **Core Mechanism**: Instead of "looking back" at every previous token (attention), SSMs compress history into a hidden state vector `h(k+1) = AΒ·h(k) + BΒ·x(k)`. The state acts as a "speed-reader's memory" β a compressed summary of everything seen so far. |
|
|
| **Why It Fits the Research OS**: |
| - **5Γ throughput** on consumer GPUs for long sequences (confirmed in Mamba benchmarks) |
| - **Constant memory** during inference: state dimension is fixed regardless of sequence length. No KV cache. |
| - **Genomic-scale sequences**: Mamba handles 1M+ token contexts (e.g., full genome sequences, large supplement bundles) |
| - **Energy efficiency**: State updates are matrix-vector products, not matrix-matrix attention operations |
|
|
| **CompreSSM Enhancement (arXiv:2510.02823)**: A principled in-training compression framework for SSMs. Using Hankel singular value (HSV) analysis from control theory, CompreSSM identifies which state dimensions carry meaningful signal and surgically truncates low-energy dimensions during training. Key insight: SSMs trained large then compressed during training retain task-critical structure that models trained directly at small dimension lose. |
|
|
| **Implication for Research OS Training**: If the system migrates to an SSM backbone (e.g., a Mamba-based encoder for paper ingestion), CompreSSM enables: |
| - Start with a large state dimension (e.g., 256) for fast convergence |
| - Apply balanced truncation at fixed intervals during the first 10% of training |
| - End with a compact model (e.g., 32-dimensional state) that matches or exceeds the large model's performance |
| - **Wall-clock speedup**: Empirically validated ~2-4Γ faster training for equivalent final accuracy |
|
|
| #### A.2.2 RWKV β Parallel Training, RNN Inference |
|
|
| **Core Mechanism**: Receptance-Weighted Key-Value combines Transformer-like parallel training with RNN-like constant-memory inference. Uses a time-mixing formulation that decays past information exponentially (like an EMA filter), so distant tokens contribute less without explicit attention computation. |
|
|
| **Why It Fits**: |
| - **Constant memory during inference**: `O(1)` memory per layer, independent of conversation length |
| - **Fast inference**: 1 token/sec stays 1 token/sec at turn 1,000 (unlike Transformers, which slow as KV cache grows) |
| - **Good for interactive UI**: The Courtroom UI and Manual Synthesis Mode require responsive inference during long sessions |
|
|
| #### A.2.3 Hybrid Models β Jamba / Griffin |
|
|
| **Core Mechanism**: Interleave a few Transformer layers (for precise short-range "sharpness") with many SSM or recurrent layers (for cheap long-range memory). Jamba uses 1 Transformer layer per 7 Mamba layers. Griffin uses Gated Linear Recurrent layers with local attention. |
|
|
| **Why It Fits**: |
| - **Best of both worlds**: Transformer layers handle precise claim-to-claim attention within a paragraph; SSM layers handle document-wide context compression |
| - **Production-grade**: Jamba is already deployed at scale; Griffin powers Gemma-2's long-context variant |
| - **Minimal migration cost**: Can reuse existing Transformer-trained weights for the attention layers while adding SSM layers |
|
|
| #### A.2.4 Mixture-of-Experts (MoE) |
|
|
| **Core Mechanism**: Sparse activation. A 30B-parameter model activates only 3B parameters per token. Each token is routed to 1-2 "expert" sub-networks. The remaining 27B parameters are dormant for that token. |
|
|
| **Why It Fits**: |
| - **Huge model, tiny compute**: Quality of a 14B+ dense model with the inference cost of a 3B model |
| - **Already in design**: The SYSTEM_DESIGN.md already mentions Qwen3-30B-A3B MoE as a "stealth option" |
| - **Specialization potential**: Different experts could specialize per scientific domain (biochemistry, materials science, quantum computing) β a natural fit for the domain taxonomy |
| |
| --- |
| |
| ### A.3 Why Migrate? The 128K-Context Reality |
| |
| The Research OS targets 128K-token contexts (~100 pages of dense scientific text). At this scale, the Transformer quadratic bottleneck is not theoretical β it is the primary hardware constraint: |
| |
| | Metric | Transformer (Qwen3-8B) | Mamba-2 (2.8B) | RWKV-6 (3B) | Jamba (8B) | |
| |--------|----------------------|----------------|-------------|------------| |
| | Context Scaling | `O(nΒ²)` | `O(n)` | `O(n)` | `O(n)` hybrid | |
| | KV Cache at 128K | ~3.8 GB | **None** | **None** | ~0.5 GB | |
| | Throughput (128K β 128K) | 1.0Γ baseline | **5.2Γ** | 4.1Γ | 3.5Γ | |
| | Inference Memory Growth | Linear | **Constant** | **Constant** | Sub-linear | |
| | Training Stability | Mature | Good (CompreSSM helps) | Good | Good | |
| |
| **Recommendation**: The Research OS should plan a **gradual migration** rather than a hard switch: |
| |
| 1. **Short-term (Phase D/E)**: Continue with Qwen3-8B Transformer. The ecosystem (AWQ quantization, vLLM serving, GRPO training in TRL) is mature. The design already targets this. |
| |
| 2. **Medium-term (Phase F)**: Integrate a **hybrid model** as an optional ingestion backbone. A Jamba-style architecture (e.g., fine-tuning a hybrid model on the existing SFT dataset) can be tested alongside the Transformer. The Council architecture (Layer 2) is model-agnostic β it calls an API, not a specific architecture. |
| |
| 3. **Long-term (Year 2+)**: If the knowledge base grows to 1,000+ papers and batch ingestion becomes the norm, migrate the ingestion pipeline to an **SSM backbone** (Mamba-2 or RWKV). The claim extraction and epistemic classification tasks map cleanly to SSM sequence modeling. CompreSSM-style in-training compression would reduce training costs for domain adaptation. |
| |
| 4. **Companion Brain**: The Meta-Improver and external scanning agents (which touch the internet) can continue using frontier Transformer APIs (Claude, GPT-4o). Only the **local Primary Brain** (which processes raw paper text and must handle 128K contexts) benefits from the architecture migration. |
| |
| --- |
| |
| ### A.4 Summary: What to Add to the Implementation Roadmap |
| |
| | Phase | Addition | Rationale | |
| |-------|----------|-----------| |
| | **Phase C (Weeks 13-20)** | Extend graph schema to multi-graph (temporal, causal, semantic, entity) | MAGMA separation improves interpretability and query accuracy. SQLite can support this with `graph_id` column + composite indexes. | |
| | **Phase D (Weeks 21-26)** | Add policy-guided traversal prototype for Layer 4 | Router + adaptive beam search for "Why" and "When" queries. Lightweight β does not require new model training. | |
| | **Phase F (Ongoing)** | Evaluate hybrid model (Jamba-style) for Primary Brain | Test on a holdout paper set. Compare extraction recall, epistemic accuracy, and VRAM usage vs. Qwen3-8B baseline. | |
| | **Phase F (Ongoing)** | If hybrid evaluation succeeds, add SSM/MoE model options to deployment config | `ollama pull jamba-research-os` or equivalent. Keep Transformer as default for stability. | |
| | **Year 2+** | Explore CompreSSM for in-training compression if training custom SSM domain models | Only if the project graduates to training its own backbone rather than fine-tuning off-the-shelf models. | |
|
|
| --- |
|
|
| *This appendix was added on 2026-04-23 based on peer-reviewed research. All claims are attributed to specific papers. The Research OS v2.0 design remains valid; these are forward-looking enhancements for Phase F and beyond.* |
|
|
|
|
| --- |
|
|
| ## Appendix B: Prior Art Integration β Lessons from 15 Similar Systems |
|
|
| **Date Added**: 2026-04-23 |
| **Status**: ACTIONABLE β Maps each external system to specific PhD Research OS layers |
| **Source**: Comprehensive prior art analysis of 15 published systems across 6 capability areas |
|
|
| > **For the full analysis, see [PRIOR_ART_ANALYSIS.md](PRIOR_ART_ANALYSIS.md) and [SYSTEM_INSPIRATIONS.md](SYSTEM_INSPIRATIONS.md).** |
|
|
| ### B.1 Systems Analyzed |
|
|
| We searched research papers, open-source code, commercial products, and HuggingFace repositories to find every system that overlaps with PhD Research OS. Nobody has built the complete system we've designed, but every piece exists somewhere. Here's how the landscape maps to our architecture. |
|
|
| ``` |
| PhD Research OS vs. The World |
| |
| Layer 0 (Parse) β Nougat (Meta), GROBID, Marker β ADOPT directly |
| Layer 1 (Resolve) β Semantic Scholar API, CrossRef β ADOPT as data sources |
| Layer 2 (Extract) β PaperQA2's RCS technique β ADAPT for pre-extraction filtering |
| β KGX3's language-game filters β ADAPT as epistemic trigger words |
| β Paper Circle's Coverage Checker β ADAPT as Completeness Auditor |
| β CritiCal's self-critique β ADAPT for Council workflow |
| Layer 3 (Dedup) β SPECTER2 (AllenAI) β ADOPT directly for embeddings |
| Layer 4 (Graph) β SciBERT-NLI β ADOPT as fast contradiction pre-filter |
| β CLAIRE's investigation loop β ADAPT for deep conflict analysis |
| β SciERC's relation taxonomy β ADOPT for structural edge types |
| Layer 5 (Score) β CLUE's uncertainty explanation β INSPIRE confidence explanations |
| β NEW: Epistemic Velocity Tracking (inspired by CLAIRE + PaperQA2) |
| Layer 6 (Evaluate) β SciFact benchmark β ADOPT as evaluation standard |
| β SciRIFF training data β ADOPT for model training |
| Layer 7 (Export) β ORKG's human contribution model β INSPIRE feedback loops |
| β NEW: Epistemic Provenance Levels (inspired by Paper Circle + ORKG) |
| ``` |
|
|
| ### B.2 Direct Adoptions β Tools to Plug In |
|
|
| | Tool | HuggingFace / GitHub | Target Layer | What It Fixes | |
| |------|---------------------|-------------|---------------| |
| | **SPECTER2** | [`allenai/specter2_base`](https://huggingface.co/allenai/specter2_base) | Layer 3 | Replaces word-overlap dedup with meaning-based dedup | |
| | **SciFact** | [`bigbio/scifact`](https://huggingface.co/datasets/bigbio/scifact) | Layer 6 | Gives us a standard benchmark for claim verification | |
| | **SciRIFF** | [`allenai/SciRIFF`](https://huggingface.co/datasets/allenai/SciRIFF) | Training | 137K expert examples β 72Γ our current data | |
| | **Nougat** | [`facebook/nougat-base`](https://huggingface.co/facebook/nougat-base) | Layer 0 | Fixes equation parsing (garbled β proper LaTeX) | |
| | **SciBERT-NLI** | [`gsarti/scibert-nli`](https://huggingface.co/gsarti/scibert-nli) | Layer 4 | Fast contradiction pre-filter (check 500K pairs cheaply) | |
|
|
| ### B.3 Adapted Techniques β Rebuild for Our Needs |
|
|
| | Technique | Source System | Our Adaptation | Target Layer | |
| |-----------|-------------|---------------|-------------| |
| | **RCS (Rerank + Contextual Summarize)** | PaperQA2 | Pre-Extraction Filter: score chunks for claim density before Council | Layer 2 (pre-processing) | |
| | **Deterministic language-game filters** | KGX3 | Epistemic Trigger Words: rule-based validator alongside AI classification | Layer 2 (validation) | |
| | **Coverage Checker** | Paper Circle | Completeness Auditor: verify nothing was silently omitted | Layer 2 (post-processing) | |
| | **Refuse to answer** | PaperQA2 | Low Confidence Quarantine: claims below 0.3 β separate queue | Layers 2, 4, 7 | |
| | **Dual evidence checking** | FactReview | Cross-Reference Verification: check against both paper and knowledge graph | Between Layers 2-4 | |
| | **Investigation loop** | CLAIRE | Conflict Investigation Protocol: deep analysis before flagging contradictions | Layer 4 | |
| | **Self-critique for calibration** | CritiCal | Council Self-Critique step: Extractor writes uncertainty BEFORE Critic reviews | Layer 2 | |
|
|
| ### B.4 New Features Inspired by Prior Art |
|
|
| | Feature | Inspired By | What It Does | |
| |---------|-----------|-------------| |
| | **Epistemic Velocity** | CLAIRE + PaperQA2 | Tracks how claim confidence changes over time (rising/falling/volatile) | |
| | **Devil's Advocate Mode** | CLAIRE + KGX3 | Automatically challenges high-confidence claims with counter-evidence | |
| | **Epistemic Provenance Levels** | ORKG + Paper Circle | Tracks human verification level (0=unreviewed β 4=peer-reviewed) | |
| | **Confidence Decomposition Display** | CLUE | Shows WHY a score is what it is, not just the number | |
|
|
| ### B.5 What Makes Us Unique (Confirmed by Analysis) |
|
|
| After analyzing all 15 systems, three capabilities exist in NO published open-source system: |
|
|
| 1. **Claim-level epistemic labels** β KGX3 classifies whole papers (like rating a restaurant). We classify individual claims (like rating each dish). Nobody else does claim-level with a persistent KG. |
|
|
| 2. **Code-computed calibrated confidence** β Every other system either asks the AI "how confident are you?" (PaperQA2) or gives binary labels (SciFact's SUPPORTS/REFUTES). Our 3-score formula computed by Python code, where the AI provides raw components but never touches the final number, is unique. |
|
|
| 3. **The integrated local-first 7-layer pipeline** β PaperQA2 does retrieval + QA (no persistent KG). Paper Circle does KG construction (no epistemic labels). AgentSLR does systematic reviews (no KG at all). Nobody combines all 7 layers into one local-first privacy-preserving system. |
|
|
| ### B.6 Implementation Phases for Prior Art Integration |
|
|
| These integrate into the existing Phase A-F timeline from Section 8: |
|
|
| | Phase | Prior Art Integration | Aligns With | |
| |-------|----------------------|-------------| |
| | A (Weeks 1-6) | DA-4: Nougat integration, DA-1: SPECTER2 for embeddings | Foundation | |
| | B (Weeks 7-12) | DA-2: SciFact benchmark, DA-3: SciRIFF training data | Identity | |
| | C (Weeks 13-20) | DA-5: SciBERT-NLI pre-filter, AD-6: Investigation Protocol | Structure | |
| | D (Weeks 21-26) | AD-1: Pre-Extraction Filter (RCS), AD-3: Epistemic Trigger Words | Calibration | |
| | E (Weeks 27-32) | AD-4: Completeness Auditor, NF-2: Devil's Advocate Mode | Judgment | |
| | F (Ongoing) | NF-1: Epistemic Velocity, NF-3: Provenance Levels | Longevity | |
|
|
| --- |
|
|
| *Appendix B added 2026-04-23. Based on analysis of 15 published systems, 12 open-source tools, and 14+ HuggingFace resources. Full details in [PRIOR_ART_ANALYSIS.md](PRIOR_ART_ANALYSIS.md) and [SYSTEM_INSPIRATIONS.md](SYSTEM_INSPIRATIONS.md).* |
|
|