CRP-2.1: Section 3 Architecture Deep-Dive — COMPLETE
Expanded Section 3 (Architecture) from ~158 lines to ~340 lines of LaTeX, more than doubling its content to 3+ pages in NeurIPS format.
Full Public Reader
CRP-2.1: Section 3 Architecture Deep-Dive — COMPLETE
What Changed
Expanded Section 3 (Architecture) from ~158 lines to ~340 lines of LaTeX, more than doubling its content to 3+ pages in NeurIPS format.
Added Content
### 1. Algorithm Pseudocode Blocks (4 algorithms total)
- Algorithm 1 (new): `Cog-RLM Query Pipeline` — full end-to-end pipeline with parallel retrieval, decomposition routing, context assembly, and generation
- Algorithm 2 (new): `Semantic RAG Retrieval` — embedding computation, cosine similarity, threshold filtering, top-k selection
- Algorithm 3 (existing, expanded): `Graph-Augmented Context Retrieval via BFS` — entity matching, multi-source BFS initialization, depth-bounded traversal with formatted output
- Algorithm 4 (new): `RLM Recursive Query Resolution` — recursive decomposition with depth bounding, base case handling, sub-query aggregation
### 2. TikZ Flow Diagram (redesigned)
- Complete pipeline visualization: Query -> Parallel Retrieval (3 layers) -> Decomposition Decision Diamond -> RLM branch -> Context Assembly -> LLM -> Response
- Mathematical annotations ($C_{\text{static}}$, $C_{\text{rag}}$, $C_{\text{graph}}$, $\phi$, $\mathcal{P}$, $\mathcal{M}$)
- Dashed bounding box for parallel retrieval layer
- Yes/no routing on decomposition decision
### 3. Mathematical Formalization
- Static context: $C_{\text{static}} = \bigoplus_{i=1}^{|\mathcal{T}|} \texttt{format}(t_i, \text{desc}(t_i))$
- Embedding: $\mathbf{e}_i = f_{\text{enc}}(q_i) \in \mathbb{R}^{384}$
- Cosine similarity: Eq. 2 with $\epsilon = 10^{-8}$ stability term
- RAG retrieval: Eq. 3 with threshold $\tau$ and top-k formulation
- Graph density: $\rho = |E| / |V|(|V|-1) \approx 0.117$
- Entity matching: Eq. 4 — substring matching formalized
- Classifier: Eq. 6 — signal set $\Sigma$ with keyword matching
- Decomposition: Eq. 7 — LLM-based sub-query generation
- Prompt assembly: Eq. 8 — four-section concatenation with $\oplus$
### 4. Decomposition Classifier Analysis
- Signal set $\Sigma$ with 12 multi-hop indicator phrases
- Precision 1.0, recall 0.875 on 103-question evaluation
- Rationale for keyword vs LLM-based classification (latency analysis)
- Decomposition examples with concrete sub-query breakdown
### 5. Prompt Template Analysis
- Four-section prompt structure formalized
- Five behavioral constraints (R1-R5) documented
- Dual-domain instruction rationale (grounding vs general knowledge)
- Generation parameters: T=0.5, top-p=0.9, max 300 tokens
- Context budget analysis: ~2,800 tokens at max capacity
### 6. Additional Technical Details
- Static topic table (Table 2): 7 categories, 15 topics
- Knowledge base entry format with Q-A alignment rationale
- Graph node schema with type distribution
- Hub-and-spoke topology analysis
- Traversal depth analysis (d=1 vs d=2 vs d=3 tradeoffs)
- RAG threshold analysis ($k=3$, $\tau=0.25$)
## Compilation
- `pdflatex` compiles cleanly with zero errors, zero warnings
- Output: 16 pages, 290KB PDF
- All cross-references resolve correctly
## Source Code Referenced
- `twin_server_v3.py` — inference pipeline, decomposition classifier, prompt template
- `local_finetune/data/knowledge_graph.json` — graph structure (25 nodes, 70 edges)
- `twin_rag_server.py` — RAG retrieval implementation (v2 baseline)
## Lines Changed
- Before: Section 3 was lines 120-278 (~158 lines)
- After: Section 3 is lines 121-461 (~340 lines)
- Net addition: +182 lines of LaTeX
Promotion Decision
Promote into a technical note or architecture paper with implementation anchors.
Source Anchor
Comp-Core/packages/cognitive-twin/paper/latex/CRP-2.1-COMPLETE.md
Detected Structure
Method · Evaluation · References · Math · Code Anchors · Architecture