# abhijeetkumar1505/cnde architecture

> Architecture diagram of the GitHub repository abhijeetkumar1505/cnde, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhijeetkumar1505/cnde
- Repository: https://github.com/abhijeetkumar1505/cnde

## Overview

This prototype provides document-grounded NDT question answering: documents are extracted and chunked, indexed for semantic retrieval, then used to generate cited answers that are checked by deterministic verification. The shared pipeline owns retrieval, the abstention gate, generation, and verification. The README documents a Gradio results interface and benchmarking, but `app.py` and `src/evaluation.py` are stubs; their runtime connections are therefore not asserted. Workflow links documented only in the README cite it; implementation excerpts support the pipeline’s direct calls.

Main entry points: [`src/pipeline.py`](https://github.com/abhijeetkumar1505/cnde/blob/main/src/pipeline.py) (QA orchestrator), [`app.py`](https://github.com/abhijeetkumar1505/cnde/blob/main/app.py) (Gradio interface), [`src/ingestion.py`](https://github.com/abhijeetkumar1505/cnde/blob/main/src/ingestion.py) (Format extraction), [`src/retrieval.py`](https://github.com/abhijeetkumar1505/cnde/blob/main/src/retrieval.py) (BGE embeddings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Document ingestion"]
  node_extract["Format extraction<br/>[ingestion.py]"]
  node_chunk["Page-bounded chunks<br/>[ingestion.py]"]
end

subgraph group_retrieval["Search and indexing"]
  node_embedding["BGE embeddings<br/>[retrieval.py]"]
  node_faiss[("FAISS index<br/>[retrieval.py]")]
  node_retrieve["Top-k retrieval<br/>[retrieval.py]"]
end

subgraph group_answering["Answer workflow"]
  node_pipeline["QA orchestrator<br/>[pipeline.py]"]
  node_generation["Cited generation<br/>[generation.py]"]
  node_verification["Answer verification<br/>[verification.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

subgraph group_interfaces["User and evaluation"]
  node_gradio["Gradio interface<br/>[app.py]"]
  node_benchmark["Benchmark metrics<br/>[evaluation.py]"]
end

node_user(("Questioner"))
node_documents["NDT documents"]

node_documents -->|"extracts"| node_extract
node_extract -->|"chunks pages"| node_chunk
node_chunk -->|"embeds chunks"| node_embedding
node_embedding -->|"indexes vectors"| node_faiss
node_pipeline -->|"retrieves evidence"| node_retrieve
node_pipeline -->|"generates answer"| node_generation
node_pipeline -->|"verifies result"| node_verification
node_user -.->|"asks question"| node_gradio
node_gradio -.->|"requests answer"| node_pipeline
node_pipeline -.->|"returns results"| node_gradio
node_benchmark -.->|"uses workflow"| node_pipeline

click node_extract "https://github.com/abhijeetkumar1505/cnde/blob/main/src/ingestion.py"
click node_chunk "https://github.com/abhijeetkumar1505/cnde/blob/main/src/ingestion.py"
click node_embedding "https://github.com/abhijeetkumar1505/cnde/blob/main/src/retrieval.py"
click node_faiss "https://github.com/abhijeetkumar1505/cnde/blob/main/src/retrieval.py"
click node_retrieve "https://github.com/abhijeetkumar1505/cnde/blob/main/src/retrieval.py"
click node_pipeline "https://github.com/abhijeetkumar1505/cnde/blob/main/src/pipeline.py"
click node_generation "https://github.com/abhijeetkumar1505/cnde/blob/main/src/generation.py"
click node_verification "https://github.com/abhijeetkumar1505/cnde/blob/main/src/verification.py"
click node_config "https://github.com/abhijeetkumar1505/cnde/blob/main/src/config.py"
click node_gradio "https://github.com/abhijeetkumar1505/cnde/blob/main/app.py"
click node_benchmark "https://github.com/abhijeetkumar1505/cnde/blob/main/src/evaluation.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_extract,node_chunk toneBlue
class node_embedding,node_faiss,node_retrieve toneAmber
class node_pipeline,node_generation,node_verification,node_config toneMint
class node_gradio,node_benchmark toneRose
class node_user,node_documents toneIndigo
```

## Components

### Document ingestion

- [Format extraction](https://github.com/abhijeetkumar1505/cnde/blob/main/src/ingestion.py): `src/ingestion.py`
- [Page-bounded chunks](https://github.com/abhijeetkumar1505/cnde/blob/main/src/ingestion.py): `src/ingestion.py`

### Search and indexing

- [BGE embeddings](https://github.com/abhijeetkumar1505/cnde/blob/main/src/retrieval.py): `src/retrieval.py`
- [FAISS index](https://github.com/abhijeetkumar1505/cnde/blob/main/src/retrieval.py): `src/retrieval.py`
- [Top-k retrieval](https://github.com/abhijeetkumar1505/cnde/blob/main/src/retrieval.py): `src/retrieval.py`

### Answer workflow

- [QA orchestrator](https://github.com/abhijeetkumar1505/cnde/blob/main/src/pipeline.py): `src/pipeline.py`
- [Cited generation](https://github.com/abhijeetkumar1505/cnde/blob/main/src/generation.py): `src/generation.py`
- [Answer verification](https://github.com/abhijeetkumar1505/cnde/blob/main/src/verification.py): `src/verification.py`
- [Runtime settings](https://github.com/abhijeetkumar1505/cnde/blob/main/src/config.py): `src/config.py`

### User and evaluation

- [Gradio interface](https://github.com/abhijeetkumar1505/cnde/blob/main/app.py): `app.py`
- [Benchmark metrics](https://github.com/abhijeetkumar1505/cnde/blob/main/src/evaluation.py): `src/evaluation.py`

### Other components

- **Questioner**
- **NDT documents**

## Connections

- NDT documents → Format extraction: extracts (evidence: `README.md`)
- Format extraction → Page-bounded chunks: chunks pages (evidence: `src/ingestion.py`)
- Page-bounded chunks → BGE embeddings: embeds chunks (evidence: `README.md`)
- BGE embeddings → FAISS index: indexes vectors (evidence: `README.md`)
- QA orchestrator → Top-k retrieval: retrieves evidence (evidence: `src/pipeline.py`)
- QA orchestrator → Cited generation: generates answer (evidence: `src/pipeline.py`)
- QA orchestrator → Answer verification: verifies result (evidence: `src/pipeline.py`)
- Questioner → Gradio interface: asks question (evidence: `README.md`)
- Gradio interface → QA orchestrator: requests answer
- QA orchestrator → Gradio interface: returns results (evidence: `README.md`)
- Benchmark metrics → QA orchestrator: uses workflow
