nkshirsa commited on
Commit
75cfa3a
·
verified ·
1 Parent(s): a13a052

Append Prior Art & Inspirations section to README landing page — links to new PRIOR_ART_ANALYSIS.md and SYSTEM_INSPIRATIONS.md

Browse files
Files changed (1) hide show
  1. README.md +725 -0
README.md CHANGED
@@ -1 +1,726 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - scientific-research
5
+ - claim-extraction
6
+ - epistemic-classification
7
+ - contradiction-detection
8
+ - structured-output
9
+ - research-assistant
10
+ - phd-tools
11
+ - multi-agent
12
+ - ecc-harness
13
+ - knowledge-graph
14
+ - calibrated-scoring
15
+ - transformer
16
+ - causal-lm
17
+ - qlora
18
+ - sft
19
+ language:
20
+ - en
21
+ base_model: Qwen/Qwen2.5-3B-Instruct
22
+ datasets:
23
+ - nkshirsa/phd-research-os-sft-data
24
+ pipeline_tag: text-generation
25
+ model-index:
26
+ - name: phd-research-os-brain
27
+ results: []
28
+ ---
29
 
30
+ # PhD Research OS v2.0 — The Epistemic Engine 🧠
31
+
32
+ > **A local-first AI system that reads science papers, extracts findings, labels how trustworthy each one is, and builds a knowledge graph that spots contradictions across papers.**
33
+
34
+ **60 files | 563KB | 143 tests | 87 blindspots audited | 78 future improvements mapped**
35
+
36
+ ---
37
+
38
+ ## 🏗️ Transformer Architecture
39
+
40
+ The entire system is built on top of a **causal decoder-only Transformer** — the same family of architecture behind GPT, LLaMA, and Qwen. Here is exactly how it works, explained so anyone can follow:
41
+
42
+ ```
43
+ ┌─────────────────────────────────────────────────────────────────────┐
44
+ │ TRANSFORMER ARCHITECTURE │
45
+ │ (Decoder-Only, Causal LM) │
46
+ │ │
47
+ │ ┌─────────────────────────────────────────────────────────────┐ │
48
+ │ │ INPUT LAYER │ │
49
+ │ │ │ │
50
+ │ │ Scientific text ──→ Tokenizer (Qwen BPE, 151,936 vocab) │ │
51
+ │ │ "The LOD was 0.8 fM" ──→ [The][_LOD][_was][_0][.8][_fM] │ │
52
+ │ │ │ │
53
+ │ │ Token IDs ──→ Token Embeddings (3072-dim vectors) │ │
54
+ │ │ + Rotary Position Embeddings (RoPE) │ │
55
+ │ └──────────────────────────┬──────────────────────────────────┘ │
56
+ │ ▼ │
57
+ │ ┌─────────────────────────────────────────────────────────────┐ │
58
+ │ │ 36 TRANSFORMER DECODER BLOCKS │ │
59
+ │ │ (repeated 36 times, same structure) │ │
60
+ │ │ │ │
61
+ │ │ For each block: │ │
62
+ │ │ │ │
63
+ │ │ ┌──────────────────────────────────────────────────────┐ │ │
64
+ │ │ │ 1. RMSNorm (normalize values to stable range) │ │ │
65
+ │ │ │ │ │ │
66
+ │ │ │ 2. Grouped-Query Self-Attention (GQA) │ │ │
67
+ │ │ │ • 16 query heads (each 128-dim) │ │ │
68
+ │ │ │ • 2 key-value heads (shared across queries) │ │ │
69
+ │ │ │ • Causal mask: can only look at PAST tokens │ │ │
70
+ │ │ │ • RoPE: encodes where each token sits │ │ │
71
+ │ │ │ • This is HOW the model reads and understands │ │ │
72
+ │ │ │ │ │ │
73
+ │ │ │ 3. RMSNorm (normalize again) │ │ │
74
+ │ │ │ │ │ │
75
+ │ │ │ 4. SwiGLU Feed-Forward Network │ │ │
76
+ │ │ │ • gate_proj: 3072 → 8640 │ │ │
77
+ │ │ │ • up_proj: 3072 → 8640 │ │ │
78
+ │ │ │ • SiLU activation × gate │ │ │
79
+ │ │ │ • down_proj: 8640 → 3072 │ │ │
80
+ │ │ │ • This is WHERE the model stores knowledge │ │ │
81
+ │ │ │ │ │ │
82
+ │ │ │ 5. Residual connections (skip connections) │ │ │
83
+ │ │ │ • Add input back to output at each step │ │ │
84
+ │ │ │ • Prevents information from getting lost │ │ │
85
+ │ │ └──────────────────────────────────────────────────────┘ │ │
86
+ │ │ │ │
87
+ │ │ × 36 blocks = 36 layers of reading comprehension │ │
88
+ │ └──────────────────────────┬──────────────────────────────────┘ │
89
+ │ ▼ │
90
+ │ ┌─────────────────────────────────────────────────────────────┐ │
91
+ │ │ OUTPUT LAYER │ │
92
+ │ │ │ │
93
+ │ │ Final RMSNorm ──→ Language Model Head (3072 → 151,936) │ │
94
+ │ │ ──→ Probability over all possible next tokens │ │
95
+ │ │ ──→ Pick most likely token ──→ Repeat until done │ │
96
+ │ │ │ │
97
+ │ │ Output: Structured JSON with claims, tags, confidence │ │
98
+ │ └─────────────────────────────────────────────────────────────┘ │
99
+ │ │
100
+ │ TOTAL: 3.09 billion parameters │
101
+ │ TRAINABLE (QLoRA r=64): ~160 million (5.2% of total) │
102
+ │ QUANTIZATION: 4-bit NF4 (fits in ~2.5 GB VRAM) │
103
+ └─────────────────────────────────────────────────────────────────────┘
104
+ ```
105
+
106
+ ### What Each Part Does (Plain English)
107
+
108
+ | Component | What It Does | Analogy |
109
+ |-----------|-------------|---------|
110
+ | **Tokenizer** | Chops text into small pieces the model can process | Cutting a sentence into word-cards |
111
+ | **Embeddings** | Turns each word-card into a list of 3,072 numbers | Giving each card a GPS coordinate in meaning-space |
112
+ | **RoPE** | Tells the model where each word sits in the sentence | Page numbers on the word-cards |
113
+ | **Self-Attention** | Each word looks at all previous words to understand context | Reading a sentence and remembering what came before |
114
+ | **GQA (Grouped-Query)** | A memory-efficient version of attention — shares key/value across heads | 16 readers sharing 2 sets of notes instead of each having their own |
115
+ | **Causal Mask** | Prevents looking at future words (only past → present) | No peeking at the next page |
116
+ | **Feed-Forward Network** | Where factual knowledge is stored (patterns, associations) | The brain's long-term memory |
117
+ | **SwiGLU** | A smart activation function that helps the network learn better | A filter that keeps important signals and blocks noise |
118
+ | **Residual Connections** | Adds the input back to the output so information isn't lost | A safety rope — even if a layer learns nothing useful, the original info passes through |
119
+ | **RMSNorm** | Keeps numbers in a stable range so training doesn't explode | A volume knob that prevents the speakers from blowing out |
120
+ | **LM Head** | Converts the final representation into a probability for each word in the vocabulary | The final vote — "what word comes next?" |
121
+
122
+ ### Model Specifications
123
+
124
+ | Specification | Value |
125
+ |--------------|-------|
126
+ | **Architecture** | Transformer (decoder-only, causal language model) |
127
+ | **Base Model** | [Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) |
128
+ | **Parameters** | 3.09 billion total |
129
+ | **Hidden Size** | 3,072 |
130
+ | **Layers** | 36 transformer blocks |
131
+ | **Attention Heads** | 16 query heads, 2 key-value heads (GQA) |
132
+ | **Head Dimension** | 128 |
133
+ | **Intermediate Size** | 8,640 (SwiGLU FFN) |
134
+ | **Vocabulary** | 151,936 tokens (BPE) |
135
+ | **Max Context** | 32,768 tokens (~25 pages of text) |
136
+ | **Position Encoding** | Rotary Position Embedding (RoPE) |
137
+ | **Normalization** | RMSNorm (pre-norm) |
138
+ | **Activation** | SiLU (in SwiGLU gate) |
139
+ | **Precision** | BF16 (training), 4-bit NF4 (inference via QLoRA) |
140
+ | **Fine-Tuning Method** | QLoRA (r=64, α=16, all-linear targets) |
141
+ | **Trainable Parameters** | ~160M of 3.09B (5.2%) |
142
+ | **Training Data** | [nkshirsa/phd-research-os-sft-data](https://huggingface.co/datasets/nkshirsa/phd-research-os-sft-data) (1,900 examples, 6 tasks) |
143
+ | **License** | Apache 2.0 |
144
+
145
+ ### How Fine-Tuning Works (QLoRA)
146
+
147
+ Instead of updating all 3 billion parameters (which would need a huge GPU), we use **QLoRA** — a technique that:
148
+
149
+ 1. **Quantizes** the base model to 4-bit (shrinks it from ~6GB to ~2.5GB in memory)
150
+ 2. **Freezes** all original parameters (they don't change)
151
+ 3. **Adds tiny adapter layers** (LoRA) to every linear layer in the model
152
+ 4. **Only trains the adapters** (~160 million parameters, 5.2% of total)
153
+
154
+ Think of it like this: the base model is a textbook that's already printed. QLoRA adds sticky notes to every page. During training, we only write on the sticky notes — the textbook stays unchanged. At the end, reading the textbook + sticky notes together gives you a model that knows scientific claim extraction.
155
+
156
+ ```
157
+ Base Model (frozen, 4-bit quantized):
158
+ ┌─────────────────────────────┐
159
+ │ Original Qwen2.5-3B weights │ ← 3.09B params, NOT updated
160
+ │ (general knowledge) │
161
+ └─────────────┬───────────────┘
162
+
163
+ LoRA Adapters (trainable):
164
+ ┌─────────────┴───────────────┐
165
+ │ Low-rank matrices (r=64) │ ← ~160M params, UPDATED
166
+ │ Added to every linear layer │
167
+ │ (scientific claim knowledge) │
168
+ └─────────────────────────────┘
169
+
170
+
171
+ Combined output: general knowledge + scientific specialization
172
+ ```
173
+
174
+ ---
175
+
176
+ ## 🔬 What This System Does
177
+
178
+ ```
179
+ ┌─────────────────────────────────────────────────────────────────┐
180
+ │ PhD Research OS Pipeline │
181
+ │ │
182
+ │ 📄 PDF Paper │
183
+ │ │ │
184
+ │ ▼ │
185
+ │ Layer 0: PARSE ─── PDF → sections, tables, figures, equations │
186
+ │ │ │
187
+ │ ▼ │
188
+ │ Layer 1: RESOLVE ── Normalize names, resolve citations, check │
189
+ │ │ retractions │
190
+ │ ▼ │
191
+ │ Layer 2: EXTRACT ── AI Council pulls out claims with labels │
192
+ │ │ (Fact / Interpretation / Hypothesis) │
193
+ │ │ Preserves qualifiers ("may", "suggests") │
194
+ │ ▼ │
195
+ │ Layer 3: DEDUP ──── Find duplicate claims across papers │
196
+ │ │ Merge same findings, track all sources │
197
+ │ ▼ │
198
+ │ Layer 4: GRAPH ──── Build knowledge graph with typed edges │
199
+ │ │ (supports / refutes / extends) │
200
+ │ │ Detect contradictions, find research gaps │
201
+ │ ▼ │
202
+ │ Layer 5: SCORE ──── Code-computed confidence (NOT AI guess) │
203
+ │ │ 3 separate scores per claim │
204
+ │ │ Parser quality caps confidence │
205
+ │ ▼ │
206
+ │ Layer 6: EVALUATE ─ Check against gold standard │
207
+ │ │ Regression gate blocks bad models │
208
+ │ ▼ │
209
+ │ Layer 7: EXPORT ─── Obsidian vault, CSV, BibTeX, courtroom UI │
210
+ │ Full provenance (page, bbox, quote) │
211
+ └─────────────────────────────────────────────────────────────────┘
212
+ ```
213
+
214
+ ### The 3-Score System (Code-Computed, Not AI-Guessed)
215
+
216
+ The AI provides components. **The code computes the final scores.** The AI never directly sets confidence.
217
+
218
+ | Score | Formula | What It Measures |
219
+ |-------|---------|-----------------|
220
+ | **Evidence Quality** | evidence × study_quality × journal_tier × completeness × section_mod | How strong is the evidence behind this claim? |
221
+ | **Truth Likelihood** | evidence_quality + corroboration − conflict_penalty − null_penalty | How likely is this claim to be true? |
222
+ | **Qualifier Strength** | 1.0 − qualifier_count×0.1 − null_penalty − inherited_penalty | How definitive is the language? |
223
+
224
+ **Key gates** (hard rules the AI cannot override):
225
+ - Parser confidence **caps** claim confidence — bad parsing = low trust
226
+ - Large sample + tiny effect → **capped at 0.4** (statistically significant ≠ meaningful)
227
+ - Abstract claims → **forced to Interpretation** with 0.7× penalty
228
+
229
+ ### AI Model Council
230
+
231
+ Four AI "members" process each paper section independently, then debate:
232
+
233
+ | Member | Job | Analogy |
234
+ |--------|-----|---------|
235
+ | **Query Planner** | Breaks questions into searchable sub-queries | The librarian who knows which shelf to check |
236
+ | **Extractor** | Pulls out claims with epistemic tags + qualifiers | The note-taker who writes down key findings |
237
+ | **Critic** | Challenges the extractor — flags errors, missing qualifiers | The skeptic who asks "are you sure about that?" |
238
+ | **Chairman** | Synthesizes final claims with documented reasoning | The judge who makes the final call |
239
+
240
+ ---
241
+
242
+ ## 📖 The Complete Design Document — Explained from Top to Bottom
243
+
244
+ > **For high school students, curious researchers, and anyone who wants to understand WHY every piece of this system exists.**
245
+
246
+ Every system is built from choices. This section explains what each part of the [SYSTEM_DESIGN.md](SYSTEM_DESIGN.md) does, why we chose it, and what problem it solves. If you read nothing else, read this.
247
+
248
+ ---
249
+
250
+ ### Part 1: The System Overview (The Big Picture)
251
+
252
+ The very first thing in the design doc is a giant box diagram showing 7 layers with inputs flowing in at the top and outputs coming out at the bottom.
253
+
254
+ **Why this exists**: Before anyone writes code, they need to see the whole journey. A PDF enters at the top. An Obsidian vault comes out at the bottom. The diagram shows every stop along the way so no one gets lost.
255
+
256
+ **Why 7 layers specifically**: Each layer does ONE job and ONE job only. This is the "single responsibility principle" — the same reason kitchens have separate stations for prep, cooking, and plating. If Layer 4 (the graph) breaks, Layer 2 (extraction) keeps working. You can fix one without touching the others.
257
+
258
+ | Layer | Name | One-Sentence Purpose |
259
+ |-------|------|---------------------|
260
+ | 0 | Structural Ingestion | Turn a messy PDF into clean, structured text with section labels |
261
+ | 1 | Entity Resolution | Figure out what things mean — "NYU" is a university, "0.8 fM" is a measurement |
262
+ | 2 | Qualified Extraction | Find every claim and label it Fact, Interpretation, or Hypothesis |
263
+ | 3 | Canonicalization | If the same finding appears in 3 papers, merge them into one master record |
264
+ | 4 | Knowledge Graph | Connect claims into a web — this supports that, this contradicts this |
265
+ | 5 | Calibrated Scoring | Compute a trust score using math formulas, not AI guessing |
266
+ | 6 | Evaluation | Test the system against expert-labeled papers to make sure it works |
267
+ | 7 | Provenance | Remember exactly which paper, page, and sentence every claim came from |
268
+
269
+ **The cross-cutting box** at the bottom (AI Model Council, Meta-Improver, etc.) exists because some jobs span ALL layers. The Council is used in extraction (Layer 2) AND in conflict detection (Layer 4). Keeping them separate from the main pipeline means they can be upgraded independently.
270
+
271
+ ---
272
+
273
+ ### Part 2: The Two-Model Strategy (Why We Run TWO Brains)
274
+
275
+ The design doc specifies that the system runs TWO models, not one. This might seem wasteful. It is not. Here is why.
276
+
277
+ **The Primary Brain** stays on your local computer and NEVER touches the internet. This is the brain that reads your actual paper PDFs. It is a Qwen3-8B model running at 4-bit quantization.
278
+
279
+ **Why local?** Science papers contain unpublished data, patent ideas, and student thesis drafts. If you upload that to ChatGPT, it becomes training data for OpenAI. Local models stay private forever.
280
+
281
+ **Why Qwen3-8B?** We compared Qwen2.5-3B and Qwen3-8B:
282
+
283
+ | Test | Qwen2.5-3B | Qwen3-8B | What This Means |
284
+ |------|-----------|----------|----------------|
285
+ | Math reasoning (AIME) | ~15% | ~45% | Qwen3 can handle equations and statistics 3× better |
286
+ | JSON accuracy | ~65% | ~80% | Qwen3 produces valid structured output more reliably |
287
+ | Context window | 32K tokens | 128K tokens | Qwen3 can read entire 100-page supplements at once |
288
+
289
+ The 8B model needs ~5GB for weights + ~4GB for KV cache at 128K context. This fits a 16GB consumer GPU. The 3B model would use less memory but makes too many errors to be trustworthy for science.
290
+
291
+ **The Companion Brain** lives on the internet (Claude API, GPT-4o-mini, or OpenRouter). It never sees raw paper text. It only gets metadata, queries, and anonymized claims.
292
+
293
+ **Why two brains?** The companion brain checks for paper retractions on CrossRef, searches arXiv for new papers, and validates repository URLs. These tasks need the internet. The primary brain reads sensitive unpublished data. These tasks must stay offline. One brain cannot do both jobs safely.
294
+
295
+ ---
296
+
297
+ ### Part 3: Training Pipeline — The 4-Stage Journey
298
+
299
+ The model does not start smart. It must be taught. The design doc specifies a 4-stage training pipeline. Here is why each stage exists and why you cannot skip any.
300
+
301
+ **Stage 1: SFT (Supervised Fine-Tuning)**
302
+ - **What it does**: Show the model thousands of examples of paper text paired with correct claim extractions. Like showing a student thousands of solved math problems.
303
+ - **Why it exists first**: The model must learn the BASIC pattern — "given this paragraph, produce this JSON with these fields" — before it can learn anything subtle.
304
+ - **Why QLoRA**: Full fine-tuning of 3B parameters needs a $10,000 GPU. QLoRA trains 160M adapter parameters on a $500 GPU. The adapters are "sticky notes" on the original model.
305
+
306
+ **Stage 2: DPO (Direct Preference Optimization)**
307
+ - **What it does**: Show the model PAIRS — one correct extraction and one slightly wrong extraction — and teach it to prefer the correct one.
308
+ - **Why it comes AFTER SFT**: A student who has never seen a correct answer cannot judge between two answers. SFT teaches "what is correct." DPO teaches "why A is better than B."
309
+ - **Why it matters**: DPO fixes the "almost right" problem. SFT might produce JSON with all fields present but the wrong epistemic tag. DPO specifically penalizes tag errors.
310
+
311
+ **Stage 3: GRPO (Group Relative Policy Optimization)**
312
+ - **What it does**: The model generates 8 different answers for the same prompt. A reward function scores each one. The model learns to generate higher-scoring answers.
313
+ - **Why it comes AFTER DPO**: GRPO needs the model to already understand the task well enough to generate plausible variations. A random model would generate garbage that all score zero.
314
+ - **Why it matters**: GRPO bakes in JSON validity, schema compliance, and qualifier preservation using MATH-BASED reward functions — not human judgment. The reward function is CODE, not a person.
315
+
316
+ **Stage 4: ConfTuner (Calibration Tuning)**
317
+ - **What it does**: After the model produces correct answers, fix its confidence calibration. A model that says "95% confident" for correct answers and "95% confident" for wrong answers is broken.
318
+ - **Why it comes LAST**: You cannot calibrate confidence until the model is already producing correct answers. Calibrating garbage is meaningless.
319
+ - **Why it matters**: Science requires honest uncertainty. If the model is 50% confident, the user must know that. If the model lies and says 90% confident, bad decisions follow.
320
+
321
+ ---
322
+
323
+ ### Part 4: Layer 0 — Structural Ingestion (Why PDFs Are Hard)
324
+
325
+ **The problem**: PDFs are not documents. They are instructions for where to place ink on paper. The computer sees "put letter T at position (72, 340)" not "this is a paragraph about detection limits."
326
+
327
+ **Why we need 5 different tools**:
328
+
329
+ | Tool | What It Does | Why We Chose It |
330
+ |------|-------------|-----------------|
331
+ | **Marker** | PDF → structured markdown with layout awareness | Knows the difference between a heading, a paragraph, and a caption |
332
+ | **Nougat** | Scientific PDFs → LaTeX equations | Can read math formulas that other tools turn into gibberish |
333
+ | **GROBID** | Headers, authors, citations, references | The academic standard — extracts bibliographic metadata |
334
+ | **LayoutLMv3** | Classifies page regions (text, table, figure, equation) | Machine vision for documents — "this region is a table" |
335
+ | **PlotDigitizer** | Quantitative plots → (x,y) CSV coordinates | Turns images of graphs into actual numbers |
336
+
337
+ **Why not just use PyMuPDF?** PyMuPDF reads text in reading order. But scientific papers have multi-column layouts, floating figures, and tables that span pages. PyMuPDF often merges table cells with body text. Marker uses machine learning to understand document LAYOUT, not just text sequence.
338
+
339
+ **Why section-aware chunking**: If you split a paper at page 5, you might cut a table in half. The design specifies chunking by SECTION (Introduction, Methods, Results) with 1-paragraph overlap. This means every chunk has complete context. A Results chunk includes the paragraph before and after, so the AI sees "As shown in Figure 3..." and knows Figure 3 exists.
340
+
341
+ **Why per-region quality scoring**: Not every part of a PDF is readable equally. A scanned figure might have OCR errors. A handwritten annotation might be noise. The system assigns a `parse_confidence` score to every region. Low confidence regions get flagged so the user knows not to trust claims from that region.
342
+
343
+ ---
344
+
345
+ ### Part 5: Layer 1 — Entity Resolution (What Is This Thing?)
346
+
347
+ **The problem**: "The NYU team used 0.8 fM" contains four entities: NYU (institution), team (group), 0.8 fM (measurement), and an implied method. The computer does not know any of this without help.
348
+
349
+ **Why we normalize entities**: If Paper A says "University of New York" and Paper B says "NYU," the system must know these are the same institution. Otherwise the knowledge graph treats them as unrelated nodes and misses connections.
350
+
351
+ **Why we resolve citations**: A paper might say "as shown in [32]." The system must find reference 32 in the bibliography, get its DOI, and look up the actual paper. Only then can it tag a claim as "inherited citation" (this paper is repeating someone else's finding, not producing a new one).
352
+
353
+ **Why we check retractions**: A paper might be retracted because the data was fraudulent. If the system does not know this, it treats fraudulent claims as trustworthy. The design specifies periodic checks against CrossRef and Retraction Watch.
354
+
355
+ **Why Version of Record (VoR) lineage**: Scientists often publish a preprint on arXiv, then a final version in a journal. The preprint might have errors that the journal version fixes. The system must track: preprint → journal version → erratum → retraction. Each version supersedes the previous one.
356
+
357
+ ---
358
+
359
+ ### Part 6: Layer 2 — Qualified Extraction (The AI Council)
360
+
361
+ **The problem**: AI models make mistakes. They hallucinate numbers. They drop the word "may" and turn a tentative finding into a fact. They miss qualifiers like "in 10 mM PBS only" that limit where a result applies.
362
+
363
+ **Why we use a COUNCIL instead of one model**: One model is one opinion. Four models debating produces better answers for the same reason that four doctors reviewing a case produces a better diagnosis than one doctor. The design specifies:
364
+
365
+ 1. **Query Planner** breaks the paper into sub-questions — "find the detection limit," "find the sample size," "find the p-value"
366
+ 2. **Two Extractors** independently pull claims. If they disagree, that disagreement IS information.
367
+ 3. **Critic** reviews both extractions and flags errors
368
+ 4. **Chairman** synthesizes the final answer, resolving disagreements with documented reasoning
369
+
370
+ **Why Round 1 is PARALLEL**: The extractors must not see each other's work. If Extractor B sees Extractor A's answer, B might anchor on A's mistakes. Parallel execution guarantees independent judgment.
371
+
372
+ **Why Round 2 shares TAGS but NOT confidence**: If Extractor A tags a claim as "Fact" and Extractor B tags it as "Interpretation," the Council must debate WHY. But if they share confidence scores, the lower-confidence extractor might cave to the higher-confidence one. Confidence is hidden to prevent anchoring.
373
+
374
+ **Why we need constrained decoding (Guidance engine)**: The AI is asked to output JSON. Without constraints, it might produce:
375
+ ```
376
+ The detection limit was 0.8 fM {
377
+ "claim": ...
378
+ }
379
+ ```
380
+ The Guidance library GUARANTEES that `epistemic_tag` is one of {Fact, Interpretation, Hypothesis, Conflict_Hypothesis}. It does this by controlling which tokens the model is allowed to generate at each position. The model literally CANNOT output an invalid tag.
381
+
382
+ **Why we preserve qualifiers**: "The method MAY reduce costs" and "The method reduces costs" are completely different claims. Dropping "may" turns an uncertain hypothesis into a confident fact. The system has a specific qualifier preservation reward function that checks whether hedging words from the source appear in the extraction.
383
+
384
+ ---
385
+
386
+ ### Part 7: Layer 3 — Canonicalization (Deduplication)
387
+
388
+ **The problem**: If 50 papers study COVID-19 vaccines, the phrase "vaccines are effective" might appear in all 50. Without deduplication, the knowledge graph has 50 identical nodes. The user sees 50 copies of the same claim.
389
+
390
+ **Why embedding-based similarity**: Word-based deduplication fails. "The vaccine showed 95% efficacy" and "Efficacy of 95% was demonstrated by the vaccine" share almost no words but mean the SAME thing. The design specifies embedding models that convert sentences to number vectors. Similar meaning = similar vectors, regardless of wording.
391
+
392
+ **Why cosine similarity threshold of 0.85**: Below 0.70, claims are definitely different. Above 0.85, they are probably the same. Between 0.70 and 0.85, the system flags them for human review. This threshold was chosen empirically — it is not a magic number.
393
+
394
+ **Why temporal versioning**: A claim from 2020 might say "vaccine efficacy unknown." The same claim from 2021 might say "vaccine efficacy 95%." These are NOT duplicates. They are sequential versions of the same scientific story. The system stores a version history: `version 1: preprint_2020` → `version 2: journal_2021`.
395
+
396
+ ---
397
+
398
+ ### Part 8: Layer 4 — Knowledge Graph (The Web of Science)
399
+
400
+ **The problem**: Science is not a list of facts. It is a web of relationships. Finding A supports Finding B. Finding C contradicts Finding B. Method X was used in both Study Y and Study Z. A list cannot represent this.
401
+
402
+ **Why SQLite instead of Neo4j**: Neo4j is a professional graph database. It is also external software that requires installation, licensing, and maintenance. SQLite is built into Python. It requires zero setup. For a PhD student running this on a laptop, "works immediately" beats "theoretically better."
403
+
404
+ **Why typed edges**: An edge without a type is just "connected." The design specifies 7 edge types:
405
+
406
+ | Edge Type | What It Means | Why It Matters |
407
+ |-----------|-------------|---------------|
408
+ | `supports` | A provides evidence for B | The strongest positive relationship |
409
+ | `refutes` | A contradicts B | Triggers conflict detection in the Courtroom UI |
410
+ | `extends` | A adds conditions to B | "Works in water" extends "Works in ideal conditions" |
411
+ | `depends_on` | A assumes B is true | If B is retracted, A's validity is questioned |
412
+ | `supersedes` | A replaces B (newer data) | Old claims are marked outdated |
413
+ | `blocks` | A is a null finding (no effect) | Prevents false connections |
414
+ | `investigative_hypothesis` | Inferred (not directly observed) | Marked differently because it is weaker evidence |
415
+
416
+ **Why we NEVER auto-generate `supports` across multiple hops**: If A supports B, and B supports C, it does NOT follow that A supports C. This is the "transitivity fallacy" — common in science but logically invalid. The design explicitly bans this.
417
+
418
+ **Why gap analysis**: The system looks for pairs of well-connected entities with NO edge between them. If "graphene" connects to 50 methods and "biosensor" connects to 50 methods, but NO paper connects graphene to biosensors, that is a research gap. It is a publishable finding.
419
+
420
+ ---
421
+
422
+ ### Part 9: Layer 5 — Calibrated Scoring (Why Code Computes Trust)
423
+
424
+ **The problem**: If you ask an AI "how confident are you?" it will make up a number. GPT-4 might say "95% confident" for a completely hallucinated claim. Humans trust numbers. Fake numbers are dangerous.
425
+
426
+ **Why the AI provides COMPONENTS, not scores**: The AI outputs `evidence_strength: 900`, `study_quality_weight: 1000`, `journal_tier_weight: 1000`. The CODE multiplies these together using fixed formulas. The AI never touches the final confidence number.
427
+
428
+ **Why fixed-point math (×1000)**: Floating-point numbers have rounding errors. `0.1 + 0.2 ≠ 0.3` in computers. The design stores all probabilities as integers from 0 to 1000. 950 means "95.0% confident." This is exact. No rounding. No drift.
429
+
430
+ **Why 3 separate scores instead of 1**: One number hides what is wrong. A claim might have perfect evidence (Score 1 = 1000) but terrible language qualifiers (Score 3 = 300). A single average of 650 hides the problem. Three scores show: "the evidence is strong, but the claim is hedged."
431
+
432
+ **Why parser confidence CAPS the claim score**: If the PDF parser was only 60% confident it read the table correctly, the claim CANNOT score above 600. This prevents the classic failure: "garbage in, gospel out."
433
+
434
+ **Why the statistical gate exists**: A study with N=10,000 and effect size d=0.01 is "statistically significant" (p<0.001) but practically meaningless. The effect is too small to matter. The design has a hard rule: if N>1000 and |effect|<0.1, cap confidence at 400. This prevents the system from treating "statistically significant" as "important."
435
+
436
+ ---
437
+
438
+ ### Part 10: Layer 6 — Evaluation (How Do You Know It Works?)
439
+
440
+ **The problem**: A system that processes science papers must be TESTED. But testing AI is hard because the answers are not binary right/wrong. "Is this claim well-extracted?" is a judgment call.
441
+
442
+ **Why we need a GOLD STANDARD**: The design specifies 10 papers where human experts have labeled every claim, tag, qualifier, and conflict. This is the ground truth. Without it, you are driving without a map.
443
+
444
+ **Why paper-level test splits**: If you randomly split claims into train/test, claims from the SAME paper might appear in both. The model memorizes paper-specific phrases instead of learning general extraction. The design specifies splitting by PAPER — all claims from Paper A go to training, all claims from Paper B go to testing.
445
+
446
+ **Why LLM-as-Judge**: For fuzzy criteria like "is this claim faithful to the source text?" there is no code formula. The design uses a separate LLM (not the one being tested) as a judge. But the judge is also imperfect, so results are treated as estimates, not truth.
447
+
448
+ **Why stochastic testing**: LLMs give different answers each time. Running evaluation once gives one number that might be 5% higher or lower next time. The design specifies running evaluations 3-5 times and reporting the range.
449
+
450
+ **Why hidden holdout**: The team developing the system might unconsciously optimize for the test set. A truly hidden holdout — 3 papers that NO ONE on the team has seen during development — catches this. Evaluated quarterly.
451
+
452
+ ---
453
+
454
+ ### Part 11: Layer 7 — Provenance (Where Did This Come From?)
455
+
456
+ **The problem**: A claim in the knowledge graph might have been extracted 6 months ago using an old model version. If the model has since improved, the old claim might be wrong. But you cannot know unless you track EVERYTHING.
457
+
458
+ **Why every claim stores a full lineage**:
459
+ ```json
460
+ {
461
+ "pipeline_version": "2.1.0",
462
+ "model_checkpoint": "research-os-grpo-v2-step-5000",
463
+ "parser_version": "marker-1.2.0",
464
+ "taxonomy_version": "quantum_bio_v1",
465
+ "prompt_hash": "sha256:a3b4c5...",
466
+ "extraction_timestamp": "2026-04-23T10:30:00Z"
467
+ }
468
+ ```
469
+
470
+ This is like a food label that tells you which farm, factory, and truck touch your apple. If a bad batch of apples makes people sick, you trace the batch number. If a model checkpoint produces bad extractions, you trace the checkpoint hash.
471
+
472
+ **Why the security sandbox**: The system validates repository URLs and downloads code. A malicious URL could execute harmful code. The sandbox runs these checks in isolation: HTTP GET only, 60-second timeout, 100MB download limit, no code execution.
473
+
474
+ **Why the epistemic embargo**: A researcher analyzing unpublished data needs privacy. The embargo mode stores claims in a private subgraph that NO other user can see. After paper submission, one click moves them to the shared lab graph.
475
+
476
+ ---
477
+
478
+ ### Part 12: The UI — Progressive Disclosure
479
+
480
+ **The problem**: Science produces overwhelming output. 100 papers → 3,000+ claims. Showing everything at once paralyzes the user.
481
+
482
+ **Why progressive disclosure levels**: The design specifies 5 levels of detail, like peeling an onion:
483
+
484
+ | Level | What You See | When You Need It |
485
+ |-------|-------------|-----------------|
486
+ | 0 | Dashboard — health scores and today's queue | First thing every morning |
487
+ | 1 | Claim text + tag + confidence + source | Deciding if a claim is worth reading |
488
+ | 2 | The 3 separate scores (evidence, truth, qualifier) | Understanding WHY a claim scored low |
489
+ | 3 | Source quote + page + bbox + council votes | Verifying the claim against the original paper |
490
+ | 4 | 2-hop subgraph (neighbors and edges) | Understanding how this claim connects to others |
491
+ | 5 | Raw LLM outputs + token distributions | Debugging when something goes wrong |
492
+
493
+ **Why the Courtroom UI**: When 3 papers contradict each other, the system displays them side by side — like a courtroom with 3 witnesses. The user sees the methods, sample sizes, and p-values for each. The system does NOT pick a winner. It presents the evidence and lets the researcher decide.
494
+
495
+ **Why Manual Synthesis Mode**: After using the system for months, researchers might start trusting it blindly. Manual mode hides ALL AI output — no scores, no conflict flags, no suggestions. The researcher draws connections manually, then switches back to compare. This built-in friction prevents over-reliance.
496
+
497
+ ---
498
+
499
+ ### Part 13: Appendix A — Future Architecture (Why We Are Planning Ahead)
500
+
501
+ The SYSTEM_DESIGN.md includes an Appendix A that describes improvements validated by peer-reviewed research. These are NOT implemented yet. They are roadmap items for Phase F and beyond.
502
+
503
+ **Why MAGMA (Multi-Graph Memory) matters**: The current knowledge graph mixes temporal, causal, semantic, and entity relationships into one edge space. This is like storing all your files in one giant folder. MAGMA creates separate folders (graphs) for each relationship type. When you ask "Why did the 2023 paper disagree?" the system only searches the CAUSAL graph, not everything.
504
+
505
+ **Why post-Transformer architectures matter**: The current Transformer (Qwen3-8B) has a "quadratic attention bottleneck." At 128K tokens, every new token must look at ALL previous tokens. This is like a student re-reading the entire textbook before every new page. It is slow and memory-hungry.
506
+
507
+ New architectures solve this:
508
+ - **Mamba (SSM)**: Compresses history into a hidden state. Like a speed-reader who keeps a mental summary instead of re-reading every page. 5× faster on long sequences.
509
+ - **RWKV**: Constant memory during inference. Like having a notebook where you only write the latest summary, not every note ever taken.
510
+ - **Jamba/Griffin (Hybrid)**: Keep a few Transformer layers for precise short-range attention, add SSM layers for cheap long-range memory. Best of both worlds.
511
+ - **MoE (Mixture of Experts)**: 30B total parameters, only 3B active per token. Like a hospital with 30 specialists where each patient sees only the relevant 3.
512
+
513
+ **Why CompreSSM matters**: Training SSMs from scratch at small dimension produces weak models. CompreSSM starts LARGE (state dimension 256), trains for a while, then uses control theory (Hankel singular values) to identify which dimensions matter and surgically removes the rest. Result: a compact model that outperforms one trained small from the start.
514
+
515
+ **Why gradual migration, not a hard switch**: The Transformer ecosystem (AWQ quantization, vLLM serving, GRPO in TRL) is mature. SSM ecosystems are newer. The design recommends:
516
+ 1. **Now**: Keep Transformer (stable, tested, ecosystem)
517
+ 2. **Phase F**: Test hybrid model on holdout data, compare metrics
518
+ 3. **Year 2+**: If hybrids win, migrate ingestion pipeline to SSM backbone
519
+ 4. **Always**: Companion brain stays on frontier APIs (Claude, GPT-4o) — only the local primary brain migrates
520
+
521
+ ---
522
+
523
+ ## 📊 Resources
524
+
525
+ | Resource | Link | What's Inside |
526
+ |----------|------|---------------|
527
+ | **Model + Code** | [nkshirsa/phd-research-os-brain](https://huggingface.co/nkshirsa/phd-research-os-brain) | This repo — 60 files of code, design docs, tests |
528
+ | **Training Data** | [nkshirsa/phd-research-os-sft-data](https://huggingface.co/datasets/nkshirsa/phd-research-os-sft-data) | 1,900 multi-task examples across 6 tasks |
529
+ | **Taxonomy GUI** | [nkshirsa/phd-research-os-taxonomy](https://huggingface.co/spaces/nkshirsa/phd-research-os-taxonomy) | Live Gradio Space — explore the epistemic taxonomy |
530
+ | **Training Space** | [nkshirsa/phd-research-os-train](https://huggingface.co/spaces/nkshirsa/phd-research-os-train) | ZeroGPU micro-batch training interface |
531
+ | **Blindspot Audit** | [BLINDSPOT_AUDIT_COMPLETE.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/BLINDSPOT_AUDIT_COMPLETE.md) | 87 failure modes across 4 discovery epochs |
532
+ | **System Design** | [SYSTEM_DESIGN.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/SYSTEM_DESIGN.md) | Complete 7-layer architecture + Appendix A (MAGMA, post-Transformer architectures, CompreSSM) |
533
+ | **Future Improvements** | [FUTURE_IMPROVEMENTS.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/FUTURE_IMPROVEMENTS.md) | 78 blindspots found by reading every code file (high-school readable) |
534
+
535
+ ---
536
+
537
+ ## 🚀 Quick Start
538
+
539
+ ```bash
540
+ git clone https://huggingface.co/nkshirsa/phd-research-os-brain
541
+ cd phd-research-os-brain
542
+ pip install gradio pymupdf
543
+ python -m phd_research_os_v2.app
544
+ # Open http://localhost:7860
545
+ ```
546
+
547
+ Works immediately with heuristic extraction. Add an API key for AI-powered extraction:
548
+ ```bash
549
+ export ANTHROPIC_API_KEY=sk-... # or OPENAI_API_KEY
550
+ ```
551
+
552
+ ---
553
+
554
+ ## 🧬 Epistemic Separation Engine
555
+
556
+ The same finding means different things depending on where it appears in a paper:
557
+
558
+ | Source Section | Confidence Modifier | Why |
559
+ |---------------|-------------------|-----|
560
+ | Results (with statistics) | 1.0× (full weight) | Direct data — the strongest evidence |
561
+ | Supplement | 1.0× (full weight) | Same as results, just in a different file |
562
+ | Methods | 1.0× (protocol, not a claim) | Describes what was done, not what was found |
563
+ | Discussion | 0.75× (penalized) | Author's interpretation — goes beyond the data |
564
+ | Abstract | 0.7× (forced to Interpretation) | Often overstates what the results actually show |
565
+
566
+ ---
567
+
568
+ ## 🤖 ECC Harness — Companion AI System
569
+
570
+ ```python
571
+ from phd_research_os.agent_os import AgentOS
572
+
573
+ aos = AgentOS()
574
+ agent = aos.spawn_companion("DataQualityAuditor")
575
+ task = aos.assign_task(agent, "Audit last 50 claims for hallucination patterns")
576
+ result = aos.run_task(task)
577
+ proposals = aos.get_proposals(agent) # Review what the agent found
578
+ aos.approve_proposal(proposals[0]) # Human approves changes
579
+ ```
580
+
581
+ 5 built-in companion types:
582
+
583
+ | Agent | What It Does |
584
+ |-------|-------------|
585
+ | **DataQualityAuditor** | Checks claims for hallucinations and suspicious confidence |
586
+ | **PromptOptimizer** | Improves system prompts via A/B testing |
587
+ | **DomainExpander** | Generates training examples for new scientific fields |
588
+ | **CalibrationAnalyst** | Analyzes Brier scores, recommends weight adjustments |
589
+ | **CitationChaser** | Finds new papers that support or contradict existing claims |
590
+
591
+ All companion output goes through **Proposals** — the agent can suggest changes but a human must approve them.
592
+
593
+ ---
594
+
595
+ ## 📐 Quantum-Bio Taxonomy V2
596
+
597
+ Evidence from different study types gets different weights:
598
+
599
+ | Study Type | Weight | Example |
600
+ |-----------|--------|---------|
601
+ | In vivo | 1.00 | Animal/human experiment |
602
+ | Direct physical measurement | 1.00 | Electron microscopy image |
603
+ | Mathematical proof | 0.95 | Formal theorem |
604
+ | In vitro | 0.85 | Cell culture experiment |
605
+ | First-principles simulation | 0.80 | Density functional theory |
606
+ | Phenomenological simulation | 0.60 | Curve fitting model |
607
+ | Review | 0.40 | Literature survey |
608
+ | Perspective | 0.20 | Expert opinion piece |
609
+
610
+ ---
611
+
612
+ ## ✅ Tests
613
+
614
+ ```
615
+ test_v2_integration.py — 24 ✅ (full pipeline)
616
+ test_db.py — 22 ✅ (data layer)
617
+ test_agent_os.py — 21 ✅ (ECC harness)
618
+ test_taxonomy.py — 27 ✅ (taxonomy)
619
+ test_skills_and_meta.py — 30 ✅ (skills + meta)
620
+ test_council.py — 19 ✅ (AI council)
621
+ Total: 143 passing
622
+ ```
623
+
624
+ ---
625
+
626
+ ## 📈 Training Pipeline
627
+
628
+ **Current**: SFT (Supervised Fine-Tuning) with QLoRA on Qwen2.5-3B-Instruct
629
+
630
+ **Planned 4-stage pipeline**:
631
+ 1. **SFT** — "Here's the right answer, learn it" ✅ Built
632
+ 2. **DPO** — "This answer is better than that one" 📋 Designed
633
+ 3. **GRPO** — "Reward for good JSON, correct tags, preserved qualifiers" 📋 Designed
634
+ 4. **ConfTuner** — "Make your confidence scores match reality" 📋 Designed
635
+
636
+ **Training options**:
637
+ - **ZeroGPU**: [nkshirsa/phd-research-os-train](https://huggingface.co/spaces/nkshirsa/phd-research-os-train) — click Train repeatedly
638
+ - **Local** (needs GPU): `python train.py`
639
+ - **HF Jobs**: Single continuous run on dedicated GPU (recommended)
640
+
641
+ ---
642
+
643
+ ## 🔍 Honest Status — What's Built vs. Planned
644
+
645
+ | Feature | Status | Details |
646
+ |---------|--------|---------|
647
+ | Database (all 7 layers) | ✅ Implemented | SQLite with full schema for claims, graph, conflicts |
648
+ | PDF parser | 🚧 Basic | PyMuPDF/pdfplumber work; Marker (ML-based) not yet integrated |
649
+ | Claim extraction | 🚧 Mock + AI | Heuristic fallback works; real AI extraction needs API key |
650
+ | Deduplication | 🚧 Basic | Jaccard word overlap; embedding-based similarity not yet added |
651
+ | Knowledge graph | 🚧 Basic | Structure and queries work; conflict detection uses word overlap |
652
+ | Scoring engine | ✅ Implemented | 3-score formula with all gates and caps |
653
+ | Evaluation harness | 🚧 Basic | Metric counting works; gold standard comparison not yet built |
654
+ | Obsidian export | ✅ Implemented | Claims, canonicals, conflicts, dashboard |
655
+ | AI Council | 🚧 Sequential | Prompts defined; parallel debate not yet implemented |
656
+ | Agent OS / ECC Harness | ✅ Implemented | Full lifecycle, audit trail, proposals |
657
+ | Constrained decoding | 📋 Designed | Guidance library integration specified but not built |
658
+ | 4-stage training | 🚧 Stage 1 only | SFT built; DPO, GRPO, ConfTuner designed |
659
+
660
+ ---
661
+
662
+ ## 📋 Documentation
663
+
664
+ | Document | Size | What It Contains |
665
+ |----------|------|-----------------|
666
+ | [SYSTEM_DESIGN.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/SYSTEM_DESIGN.md) | 71KB | Complete 7-layer architecture + Appendix A (MAGMA, post-Transformer architectures, CompreSSM) with training pipeline |
667
+ | [BLINDSPOT_AUDIT_COMPLETE.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/BLINDSPOT_AUDIT_COMPLETE.md) | 45KB | 87 failure modes found by adversarial thinking |
668
+ | [FUTURE_IMPROVEMENTS.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/FUTURE_IMPROVEMENTS.md) | 39KB | 78 practical problems found by reading every code file |
669
+ | [DEPLOYMENT_ARM.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/DEPLOYMENT_ARM.md) | 3KB | ARM/local deployment guide |
670
+
671
+ ---
672
+
673
+ ## License
674
+
675
+ Apache 2.0 — use it, modify it, build on it. Just include the license.
676
+
677
+
678
+ ---
679
+
680
+ ## 🔬 Prior Art & Inspirations — Standing on the Shoulders of Giants
681
+
682
+ > **We searched every relevant system, paper, and tool. Nobody has built the complete system we're building. But we found 15 systems that each do pieces of what we do — and we're adopting the best parts.**
683
+
684
+ We analyzed 15 published systems, 12 open-source tools, 8 HuggingFace datasets, and 6 HuggingFace models that do something similar to PhD Research OS. Here's the honest picture.
685
+
686
+ ### The Big Scoreboard — Who Has What
687
+
688
+ | Capability | Our System | Best Rival | Gap |
689
+ |------------|:---------:|:----------:|:---:|
690
+ | **Claim extraction from papers** | 🟡 Designed | 🟢 PaperQA2 (superhuman) | They're proven; we're not yet |
691
+ | **Epistemic labels (Fact/Interpretation/Hypothesis)** | 🟢 **Unique** | 🟡 KGX3 (paper-level only) | **Nobody does claim-level** |
692
+ | **Typed knowledge graph** | 🟢 **Unique** | 🟡 Paper Circle (structural, not epistemic) | Our edges carry epistemic meaning |
693
+ | **Contradiction detection** | 🟡 Designed | 🟢 PaperQA2 (2.34× better than PhDs) | They can prove it works; we can't yet |
694
+ | **Code-computed confidence scores** | 🟢 **Unique** | ❌ Nobody | **Nobody does formula-based scoring** |
695
+
696
+ **Analogy**: If AI research systems were restaurants, PaperQA2 would be the Michelin-starred place that's been open for years. We're the ambitious new restaurant with a unique menu that nobody else offers — but we haven't opened our doors yet. The plan is to learn from the best while cooking dishes nobody else serves.
697
+
698
+ ### What We're Adopting (The Short Version)
699
+
700
+ | What | From Where | Why | Type |
701
+ |------|-----------|-----|------|
702
+ | SPECTER2 embeddings | [AllenAI](https://huggingface.co/allenai/specter2_base) | Fix our word-overlap deduplication | 🔵 Direct plug-in |
703
+ | SciFact benchmark | [AllenAI](https://huggingface.co/datasets/bigbio/scifact) | Measure our extraction quality | 🔵 Direct plug-in |
704
+ | SciRIFF training data (137K examples) | [AllenAI](https://huggingface.co/datasets/allenai/SciRIFF) | Replace/supplement our 1,900 synthetic examples | 🔵 Direct plug-in |
705
+ | Nougat equation parser | [Meta](https://huggingface.co/facebook/nougat-base) | Fix garbled equations | 🔵 Direct plug-in |
706
+ | RCS pre-filtering technique | PaperQA2 | Filter noise before extraction | 🟣 Adapted technique |
707
+ | Deterministic language filters | KGX3 | Code-based epistemic validation | 🟣 Adapted technique |
708
+ | Coverage checking pattern | Paper Circle | Prevent silent omissions | 🟣 Adapted pattern |
709
+ | "Refuse to answer" behavior | PaperQA2 | Know when to say "I don't know" | 🟣 Adapted behavior |
710
+ | Epistemic Velocity (new feature) | CLAIRE + PaperQA2 | Track confidence trends over time | 🆕 Inspired by |
711
+ | Devil's Advocate Mode (new feature) | CLAIRE + KGX3 | Actively challenge high-confidence claims | 🆕 Inspired by |
712
+
713
+ ### Full Documentation
714
+
715
+ | Document | Size | What It Contains |
716
+ |----------|------|-----------------|
717
+ | [PRIOR_ART_ANALYSIS.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/PRIOR_ART_ANALYSIS.md) | 40KB+ | 15 systems analyzed — what they do, how they compare, honest scoreboard |
718
+ | [SYSTEM_INSPIRATIONS.md](https://huggingface.co/nkshirsa/phd-research-os-brain/blob/main/SYSTEM_INSPIRATIONS.md) | 35KB+ | 16 concrete adoption/adaptation items with code examples, integration map, priority order |
719
+
720
+ ### Our 3 Genuine Innovations (Not Found Anywhere Else)
721
+
722
+ 1. **Claim-Level Epistemic Classification** — KGX3 rates whole papers; we rate individual claims within papers. That's like the difference between rating a restaurant (them) vs rating each dish (us).
723
+
724
+ 2. **Code-Computed Calibrated Confidence** — Other systems ask the AI "how confident are you?" and trust the answer. We have the AI provide raw measurements, then Python code computes the score using fixed formulas the AI can never override. Like a teacher who grades the test herself instead of asking the student "what grade do you think you deserve?"
725
+
726
+ 3. **The Integrated 7-Layer Local-First Pipeline** — Other systems are like food delivery apps (each brings one dish). We're building a kitchen that cooks everything and remembers every recipe forever — all on your laptop, never sending your data to the cloud.