# la-minoo/claim-evidence-checker architecture

> Architecture diagram of the GitHub repository la-minoo/claim-evidence-checker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/la-minoo/claim-evidence-checker
- Repository: https://github.com/la-minoo/claim-evidence-checker

## Overview

clAIm checks whether supplied scientific evidence text supports, contradicts, or leaves a claim undetermined; it is consistency checking, not independent fact verification. Users can submit a claim with their own evidence or retrieve papers for a claim. The backend selects and classifies evidence, then offers token attribution and generated explanations; claim-only retrieval searches Semantic Scholar and scores paper sentences with the same NLI model. The README documents additional API capabilities. Connections below follow the excerpts or README; unsampled implementation details are not inferred.

Main entry points: [`src/infer.py`](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/infer.py) (FastAPI routes), [`app/demo.py`](https://github.com/la-minoo/claim-evidence-checker/blob/main/app/demo.py) (Streamlit demo), [`src/retrieval.py`](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/retrieval.py) (Retrieval endpoint), [`src/llama_chat.py`](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/llama_chat.py) (Chat helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_demo["Streamlit demo<br/>[demo.py]"]
  node_frontend["Web frontend"]
end

subgraph group_analysis["Claim analysis"]
  node_server["API entry point<br/>[main.py]"]
  node_api["FastAPI routes<br/>[infer.py]"]
  node_nli["NLI inference<br/>[infer.py]"]
  node_selection["Sentence selection<br/>[infer.py]"]
  node_model["Fine-tuned model"]
  node_attribution["Integrated Gradients<br/>[attributions.py]"]
end

subgraph group_retrieval["Evidence retrieval"]
  node_retrieval_api["Retrieval endpoint<br/>[retrieval.py]"]
  node_paper_search["Semantic Scholar"]
  node_cache[("Result cache<br/>[retrieval.py]")]
end

subgraph group_explanation["Explanations"]
  node_llm["Chat helper<br/>[llama_chat.py]"]
  node_groq["Groq API"]
  node_ollama["Ollama"]
end

node_user(("User"))

node_user -->|"submits claim"| node_demo
node_user -->|"uses"| node_frontend
node_frontend -.->|"calls API"| node_api
node_demo -->|"selects evidence"| node_selection
node_demo -->|"requests verdict"| node_nli
node_demo -->|"requests papers"| node_retrieval_api
node_demo -->|"requests attribution"| node_attribution
node_server -->|"loads routes"| node_api
node_server -->|"registers route"| node_retrieval_api
node_api -->|"runs inference"| node_nli
node_api -->|"analyzes sentences"| node_selection
node_nli -->|"classifies pair"| node_model
node_api -->|"wraps attribution"| node_attribution
node_retrieval_api -->|"fetches papers"| node_paper_search
node_retrieval_api -->|"scores sentences"| node_nli
node_retrieval_api -->|"reads and writes"| node_cache
node_api -.->|"requests chat"| node_llm
node_llm -.->|"dispatches"| node_groq
node_llm -.->|"fallback"| node_ollama

click node_demo "https://github.com/la-minoo/claim-evidence-checker/blob/main/app/demo.py"
click node_frontend "https://github.com/la-minoo/claim-evidence-checker/tree/main/app2"
click node_server "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/main.py"
click node_api "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/infer.py"
click node_nli "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/infer.py"
click node_selection "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/infer.py"
click node_attribution "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/attributions.py"
click node_retrieval_api "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/retrieval.py"
click node_cache "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/retrieval.py"
click node_llm "https://github.com/la-minoo/claim-evidence-checker/blob/main/src/llama_chat.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_demo,node_frontend,node_user toneBlue
class node_server,node_api,node_nli,node_selection,node_model,node_attribution toneAmber
class node_retrieval_api,node_paper_search,node_cache toneMint
class node_llm,node_groq,node_ollama toneRose
```

## Components

### User interfaces

- [Streamlit demo](https://github.com/la-minoo/claim-evidence-checker/blob/main/app/demo.py): `app/demo.py`
- [Web frontend](https://github.com/la-minoo/claim-evidence-checker/tree/main/app2): `app2`

### Claim analysis

- [API entry point](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/main.py): `src/main.py`
- [FastAPI routes](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/infer.py): `src/infer.py`
- [NLI inference](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/infer.py): `src/infer.py`
- [Sentence selection](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/infer.py): `src/infer.py`
- **Fine-tuned model**
- [Integrated Gradients](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/attributions.py): `src/attributions.py`

### Evidence retrieval

- [Retrieval endpoint](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/retrieval.py): `src/retrieval.py`
- **Semantic Scholar**
- [Result cache](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/retrieval.py): `src/retrieval.py`

### Explanations

- [Chat helper](https://github.com/la-minoo/claim-evidence-checker/blob/main/src/llama_chat.py): `src/llama_chat.py`
- **Groq API**
- **Ollama**

### Other components

- **User**

## Connections

- User → Streamlit demo: submits claim (evidence: `README.md`)
- User → Web frontend: uses (evidence: `README.md`)
- Web frontend → FastAPI routes: calls API
- Streamlit demo → Sentence selection: selects evidence (evidence: `app/demo.py`)
- Streamlit demo → NLI inference: requests verdict (evidence: `app/demo.py`)
- Streamlit demo → Retrieval endpoint: requests papers (evidence: `app/demo.py`)
- Streamlit demo → Integrated Gradients: requests attribution (evidence: `app/demo.py`)
- API entry point → FastAPI routes: loads routes (evidence: `src/main.py`)
- API entry point → Retrieval endpoint: registers route (evidence: `src/main.py`)
- FastAPI routes → NLI inference: runs inference (evidence: `README.md`)
- FastAPI routes → Sentence selection: analyzes sentences (evidence: `README.md`)
- NLI inference → Fine-tuned model: classifies pair (evidence: `src/infer.py`)
- FastAPI routes → Integrated Gradients: wraps attribution (evidence: `README.md`)
- Retrieval endpoint → Semantic Scholar: fetches papers (evidence: `src/retrieval.py`)
- Retrieval endpoint → NLI inference: scores sentences (evidence: `src/retrieval.py`)
- Retrieval endpoint → Result cache: reads and writes (evidence: `src/retrieval.py`)
- FastAPI routes → Chat helper: requests chat (evidence: `src/infer.py`)
- Chat helper → Groq API: dispatches
- Chat helper → Ollama: fallback
