# arunv3rma/memo architecture

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

- Interactive diagram: https://gitdiagram.com/arunv3rma/memo
- Repository: https://github.com/arunv3rma/memo

## Overview

MeMo’s main workflow prepares benchmark corpora, synthesizes reflection QA, fine-tunes a dedicated memory model, and evaluates structured inference with a frozen executive model. The README documents the synthesis stages and three inference stages; the graph preserves those stages without implying undocumented implementation details. It also includes the substantial Cartridges dataset, client, training-support, and visualization modules identified in the source index. Some links rely on README documentation because the corresponding implementation was not sampled.

Main entry points: [`evaluation_pipeline/structured_multi_turn`](https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline/structured_multi_turn) (Answer synthesis), [`baselines/cartridges/cartridges/utils/wandb.py`](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/utils/wandb.py) (Experiment tracking), [`baselines/cartridges/viz/src/App.jsx`](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/App.jsx) (Visualization app), [`data_processing_utils`](https://github.com/arunv3rma/memo/tree/main/data_processing_utils) (Corpus preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation and synthesis"]
  node_preparation["Corpus preparation"]
  node_fact["Fact extraction"]
  node_consolidation["Fact consolidation"]
  node_verification["Fact verification"]
  node_surfacing["Entity surfacing"]
  node_crossdoc["Cross-document synthesis"]
  node_qa_data["Reflection QA data"]
end

subgraph group_models["Memory model training"]
  node_sft["Memory model SFT<br/>[sft_pipeline.py]"]
  node_merged["Merged memory model<br/>[model.py]"]
end

subgraph group_inference["Inference and evaluation"]
  node_grounding["Grounding"]
  node_entity_id["Entity identification"]
  node_memory["Memory model"]
  node_synthesis["Answer synthesis"]
  node_evaluation["Benchmark evaluation"]
end

subgraph group_cartridges["Cartridges framework"]
  node_cartridges_data["Dataset handling<br/>[datasets.py]"]
  node_cartridges_structs["Shared structures<br/>[structs.py]"]
  node_cache[("Trainable cache<br/>[cache.py]")]
  node_client_base["Client interface<br/>[base.py]"]
  node_openai_client["OpenAI client<br/>[openai.py]"]
  node_wandb["Experiment tracking<br/>[wandb.py]"]
  node_viz_server["Visualization API<br/>[server.py]"]
  node_datasets_page["Datasets view<br/>[DatasetsPage.jsx]"]
  node_training_page["Training view<br/>[TrainingPage.jsx]"]
  node_viz_app["Visualization app<br/>[App.jsx]"]
end

node_corpus(("Raw corpora"))
node_user(("User"))
node_answer(("Final answer"))

node_corpus -->|"preprocesses"| node_preparation
node_preparation -->|"feeds corpus"| node_fact
node_fact -->|"extracts facts"| node_consolidation
node_consolidation -->|"consolidates"| node_verification
node_verification -->|"verifies"| node_surfacing
node_surfacing -->|"surfaces entities"| node_crossdoc
node_crossdoc -->|"generates QA"| node_qa_data
node_qa_data -->|"trains on"| node_sft
node_sft -.->|"optionally merges"| node_merged
node_user -->|"submits query"| node_grounding
node_grounding -->|"grounds query"| node_entity_id
node_entity_id -->|"queries memory"| node_memory
node_memory -->|"returns responses"| node_synthesis
node_synthesis -->|"produces answer"| node_answer
node_synthesis -.->|"evaluates output"| node_evaluation
node_cartridges_data -->|"uses structures"| node_cartridges_structs
node_openai_client -->|"implements"| node_client_base
node_wandb -->|"uses structures"| node_cartridges_structs
node_wandb -->|"loads cache"| node_cache
node_viz_app -->|"renders"| node_datasets_page
node_viz_app -->|"renders"| node_training_page

click node_preparation "https://github.com/arunv3rma/memo/tree/main/data_processing_utils"
click node_fact "https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline"
click node_consolidation "https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline"
click node_verification "https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline"
click node_surfacing "https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline"
click node_crossdoc "https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline"
click node_qa_data "https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline"
click node_sft "https://github.com/arunv3rma/memo/blob/main/sft_training/sft_pipeline.py"
click node_merged "https://github.com/arunv3rma/memo/blob/main/model_merging_scripts/model_merge/model.py"
click node_grounding "https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline/structured_multi_turn"
click node_entity_id "https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline/structured_multi_turn"
click node_synthesis "https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline/structured_multi_turn"
click node_evaluation "https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline"
click node_cartridges_data "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/datasets.py"
click node_cartridges_structs "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/structs.py"
click node_cache "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/cache.py"
click node_client_base "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/clients/base.py"
click node_openai_client "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/clients/openai.py"
click node_wandb "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/utils/wandb.py"
click node_viz_server "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/server.py"
click node_datasets_page "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/pages/DatasetsPage.jsx"
click node_training_page "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/pages/TrainingPage.jsx"
click node_viz_app "https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/App.jsx"

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_preparation,node_fact,node_consolidation,node_verification,node_surfacing,node_crossdoc,node_qa_data,node_user toneBlue
class node_sft,node_merged toneAmber
class node_grounding,node_entity_id,node_memory,node_synthesis,node_evaluation toneMint
class node_cartridges_data,node_cartridges_structs,node_cache,node_client_base,node_openai_client,node_wandb,node_viz_server,node_datasets_page,node_training_page,node_viz_app toneRose
class node_corpus,node_answer toneIndigo
```

## Components

### Data preparation and synthesis

- [Corpus preparation](https://github.com/arunv3rma/memo/tree/main/data_processing_utils): `data_processing_utils`
- [Fact extraction](https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline): `data_synthesis_pipeline`
- [Fact consolidation](https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline): `data_synthesis_pipeline`
- [Fact verification](https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline): `data_synthesis_pipeline`
- [Entity surfacing](https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline): `data_synthesis_pipeline`
- [Cross-document synthesis](https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline): `data_synthesis_pipeline`
- [Reflection QA data](https://github.com/arunv3rma/memo/tree/main/data_synthesis_pipeline): `data_synthesis_pipeline`

### Memory model training

- [Memory model SFT](https://github.com/arunv3rma/memo/blob/main/sft_training/sft_pipeline.py): `sft_training/sft_pipeline.py`
- [Merged memory model](https://github.com/arunv3rma/memo/blob/main/model_merging_scripts/model_merge/model.py): `model_merging_scripts/model_merge/model.py`

### Inference and evaluation

- [Grounding](https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline/structured_multi_turn): `evaluation_pipeline/structured_multi_turn`
- [Entity identification](https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline/structured_multi_turn): `evaluation_pipeline/structured_multi_turn`
- **Memory model**
- [Answer synthesis](https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline/structured_multi_turn): `evaluation_pipeline/structured_multi_turn`
- [Benchmark evaluation](https://github.com/arunv3rma/memo/tree/main/evaluation_pipeline): `evaluation_pipeline`

### Cartridges framework

- [Dataset handling](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/datasets.py): `baselines/cartridges/cartridges/datasets.py`
- [Shared structures](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/structs.py): `baselines/cartridges/cartridges/structs.py`
- [Trainable cache](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/cache.py): `baselines/cartridges/cartridges/cache.py`
- [Client interface](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/clients/base.py): `baselines/cartridges/cartridges/clients/base.py`
- [OpenAI client](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/clients/openai.py): `baselines/cartridges/cartridges/clients/openai.py`
- [Experiment tracking](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/cartridges/utils/wandb.py): `baselines/cartridges/cartridges/utils/wandb.py`
- [Visualization API](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/server.py): `baselines/cartridges/viz/src/server.py`
- [Datasets view](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/pages/DatasetsPage.jsx): `baselines/cartridges/viz/src/pages/DatasetsPage.jsx`
- [Training view](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/pages/TrainingPage.jsx): `baselines/cartridges/viz/src/pages/TrainingPage.jsx`
- [Visualization app](https://github.com/arunv3rma/memo/blob/main/baselines/cartridges/viz/src/App.jsx): `baselines/cartridges/viz/src/App.jsx`

### Other components

- **Raw corpora**
- **User**
- **Final answer**

## Connections

- Raw corpora → Corpus preparation: preprocesses (evidence: `README.md`)
- Corpus preparation → Fact extraction: feeds corpus (evidence: `README.md`)
- Fact extraction → Fact consolidation: extracts facts (evidence: `README.md`)
- Fact consolidation → Fact verification: consolidates (evidence: `README.md`)
- Fact verification → Entity surfacing: verifies (evidence: `README.md`)
- Entity surfacing → Cross-document synthesis: surfaces entities (evidence: `README.md`)
- Cross-document synthesis → Reflection QA data: generates QA (evidence: `README.md`)
- Reflection QA data → Memory model SFT: trains on (evidence: `README.md`)
- Memory model SFT → Merged memory model: optionally merges (evidence: `README.md`)
- User → Grounding: submits query (evidence: `README.md`)
- Grounding → Entity identification: grounds query (evidence: `README.md`)
- Entity identification → Memory model: queries memory (evidence: `README.md`)
- Memory model → Answer synthesis: returns responses (evidence: `README.md`)
- Answer synthesis → Final answer: produces answer (evidence: `README.md`)
- Answer synthesis → Benchmark evaluation: evaluates output
- Dataset handling → Shared structures: uses structures (evidence: `baselines/cartridges/cartridges/datasets.py`)
- OpenAI client → Client interface: implements (evidence: `baselines/cartridges/cartridges/clients/openai.py`)
- Experiment tracking → Shared structures: uses structures (evidence: `baselines/cartridges/cartridges/utils/wandb.py`)
- Experiment tracking → Trainable cache: loads cache (evidence: `baselines/cartridges/cartridges/utils/wandb.py`)
- Visualization app → Datasets view: renders (evidence: `baselines/cartridges/viz/src/App.jsx`)
- Visualization app → Training view: renders (evidence: `baselines/cartridges/viz/src/App.jsx`)
