# continual-intelligence/seal architecture

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

- Interactive diagram: https://gitdiagram.com/continual-intelligence/seal
- Repository: https://github.com/continual-intelligence/seal

## Overview

SEAL trains language models to generate self-edits—finetuning data and update directives—in response to new inputs. Its documented domains are factual-knowledge incorporation and few-shot task adaptation. In the ARC workflow, task examples are represented and augmented, prompts are prepared for inference, and candidate outputs are combined and evaluated; self-editing additionally generates update configurations and applies model updates. The factual-knowledge branch includes question-data generation, continual self-edits, inner-loop servers, and querying. Some latter modules are indexed but unsampled, so their internal behavior and connections are shown only where documented or referenced.

Main entry points: [`few-shot/self-edit.py`](https://github.com/continual-intelligence/seal/blob/main/few-shot/self-edit.py) (Self-edit loop), [`general-knowledge/src/utils.py`](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/utils.py) (Model API utilities), [`few-shot/ttt.py`](https://github.com/continual-intelligence/seal/blob/main/few-shot/ttt.py) (Task adaptation), [`few-shot/inference/preprocess.py`](https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/preprocess.py) (Inference preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fewshot["Few-shot adaptation"]
  node_fewshot_edit["Self-edit loop<br/>[self-edit.py]"]
  node_fewshot_ttt["Task adaptation<br/>[ttt.py]"]
  node_model_inference["Model inference<br/>[engine.py]"]
  node_inference_variants["Inference variants<br/>[engine_vllm.py]"]
  node_baseline_inference["No-LoRA inference<br/>[engine_no_lora.py]"]
  node_model_updates["Model updates<br/>[update_model.py]"]
end

subgraph group_arc["ARC task components"]
  node_arc_tasks["ARC tasks<br/>[arc.py]"]
  node_task_representers["Task representation<br/>[representers.py]"]
  node_message_builders["Message formatting<br/>[messagers.py]"]
  node_task_augmenters["Task augmentation<br/>[augmenters.py]"]
  node_task_preprocessing["Inference preprocessing<br/>[preprocess.py]"]
  node_output_voting["Output voting<br/>[voting.py]"]
  node_arc_evaluation["Task evaluation<br/>[eval.py]"]
end

subgraph group_knowledge["Factual knowledge"]
  node_knowledge_questions["Question data<br/>[make_squad_data.py]"]
  node_knowledge_edits["Continual self-edits"]
  node_inner_ga["GA inner server<br/>[GA_server.py]"]
  node_inner_ttt["TTT inner server<br/>[TTT_server.py]"]
  node_knowledge_queries["Knowledge queries<br/>[query_server.py]"]
  node_cpt_ga["CPT with GA<br/>[CPT_GA.py]"]
  node_cpt_fullft["CPT full finetune<br/>[CPT_fullFT.py]"]
  node_cpt["CPT querying<br/>[CPT.py]"]
end

subgraph group_shared["Shared model services"]
  node_service_utils["Model API utilities<br/>[utils.py]"]
  node_lm_api["Language-model API<br/>[lm_api.py]"]
end

node_researcher(("Experimenter"))
node_llm{{"Language model"}}
node_openai{{"OpenAI API"}}

node_researcher -->|"starts adaptation"| node_fewshot_edit
node_researcher -->|"starts knowledge edits"| node_knowledge_edits
node_fewshot_edit -->|"reads tasks"| node_arc_tasks
node_fewshot_edit -->|"configures formats"| node_task_representers
node_fewshot_edit -->|"formats messages"| node_message_builders
node_fewshot_edit -->|"configures edits"| node_task_augmenters
node_fewshot_edit -->|"preprocesses tasks"| node_task_preprocessing
node_fewshot_edit -->|"requests generations"| node_model_inference
node_fewshot_edit -->|"applies updates"| node_model_updates
node_fewshot_edit -->|"combines candidates"| node_output_voting
node_fewshot_edit -->|"evaluates outputs"| node_arc_evaluation
node_fewshot_ttt -->|"uses representations"| node_task_representers
node_fewshot_ttt -->|"uses formatting"| node_message_builders
node_fewshot_ttt -->|"updates model"| node_model_updates
node_task_preprocessing -->|"transforms tasks"| node_arc_tasks
node_task_preprocessing -->|"applies transforms"| node_task_augmenters
node_model_inference -.->|"generates tokens"| node_llm
node_inference_variants -.->|"generates tokens"| node_llm
node_baseline_inference -.->|"generates tokens"| node_llm
node_knowledge_edits -->|"loads question data"| node_knowledge_questions
node_knowledge_edits -->|"uses utilities"| node_service_utils
node_inner_ga -->|"uses utilities"| node_service_utils
node_inner_ttt -->|"uses utilities"| node_service_utils
node_knowledge_queries -->|"uses utilities"| node_service_utils
node_cpt_ga -->|"uses utilities"| node_service_utils
node_cpt_fullft -->|"uses utilities"| node_service_utils
node_cpt -.->|"uses utilities"| node_service_utils
node_service_utils -->|"requests completions"| node_openai
node_lm_api -.->|"calls API"| node_openai

click node_arc_tasks "https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/arc.py"
click node_fewshot_edit "https://github.com/continual-intelligence/seal/blob/main/few-shot/self-edit.py"
click node_fewshot_ttt "https://github.com/continual-intelligence/seal/blob/main/few-shot/ttt.py"
click node_task_representers "https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/representers.py"
click node_message_builders "https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/messagers.py"
click node_task_augmenters "https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/augmenters.py"
click node_task_preprocessing "https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/preprocess.py"
click node_model_inference "https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/engine.py"
click node_inference_variants "https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/engine_vllm.py"
click node_baseline_inference "https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/engine_no_lora.py"
click node_model_updates "https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/update_model.py"
click node_output_voting "https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/voting.py"
click node_arc_evaluation "https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/eval.py"
click node_knowledge_questions "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/data_generation/make_squad_data.py"
click node_knowledge_edits "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/continual/continual_self_edits.py"
click node_inner_ga "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/inner/GA_server.py"
click node_inner_ttt "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/inner/TTT_server.py"
click node_knowledge_queries "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/query_server.py"
click node_cpt_ga "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/CPT_GA.py"
click node_cpt_fullft "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/CPT_fullFT.py"
click node_cpt "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/CPT.py"
click node_service_utils "https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/utils.py"
click node_lm_api "https://github.com/continual-intelligence/seal/blob/main/few-shot/utils/lm_api.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_fewshot_edit,node_fewshot_ttt,node_model_inference,node_inference_variants,node_baseline_inference,node_model_updates toneBlue
class node_arc_tasks,node_task_representers,node_message_builders,node_task_augmenters,node_task_preprocessing,node_output_voting,node_arc_evaluation toneAmber
class node_knowledge_questions,node_knowledge_edits,node_inner_ga,node_inner_ttt,node_knowledge_queries,node_cpt_ga,node_cpt_fullft,node_cpt,node_openai toneMint
class node_service_utils,node_lm_api toneRose
class node_researcher,node_llm toneIndigo
```

## Components

### Few-shot adaptation

- [Self-edit loop](https://github.com/continual-intelligence/seal/blob/main/few-shot/self-edit.py): `few-shot/self-edit.py`
- [Task adaptation](https://github.com/continual-intelligence/seal/blob/main/few-shot/ttt.py): `few-shot/ttt.py`
- [Model inference](https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/engine.py): `few-shot/inference/engine.py`
- [Inference variants](https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/engine_vllm.py): `few-shot/inference/engine_vllm.py`
- [No-LoRA inference](https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/engine_no_lora.py): `few-shot/inference/engine_no_lora.py`
- [Model updates](https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/update_model.py): `few-shot/arclib/update_model.py`

### ARC task components

- [ARC tasks](https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/arc.py): `few-shot/arclib/arc.py`
- [Task representation](https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/representers.py): `few-shot/arclib/representers.py`
- [Message formatting](https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/messagers.py): `few-shot/arclib/messagers.py`
- [Task augmentation](https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/augmenters.py): `few-shot/arclib/augmenters.py`
- [Inference preprocessing](https://github.com/continual-intelligence/seal/blob/main/few-shot/inference/preprocess.py): `few-shot/inference/preprocess.py`
- [Output voting](https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/voting.py): `few-shot/arclib/voting.py`
- [Task evaluation](https://github.com/continual-intelligence/seal/blob/main/few-shot/arclib/eval.py): `few-shot/arclib/eval.py`

### Factual knowledge

- [Question data](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/data_generation/make_squad_data.py): `general-knowledge/src/data_generation/make_squad_data.py`
- [Continual self-edits](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/continual/continual_self_edits.py): `general-knowledge/src/continual/continual_self_edits.py`
- [GA inner server](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/inner/GA_server.py): `general-knowledge/src/inner/GA_server.py`
- [TTT inner server](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/inner/TTT_server.py): `general-knowledge/src/inner/TTT_server.py`
- [Knowledge queries](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/query_server.py): `general-knowledge/src/query/query_server.py`
- [CPT with GA](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/CPT_GA.py): `general-knowledge/src/query/CPT_GA.py`
- [CPT full finetune](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/CPT_fullFT.py): `general-knowledge/src/query/CPT_fullFT.py`
- [CPT querying](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/query/CPT.py): `general-knowledge/src/query/CPT.py`

### Shared model services

- [Model API utilities](https://github.com/continual-intelligence/seal/blob/main/general-knowledge/src/utils.py): `general-knowledge/src/utils.py`
- [Language-model API](https://github.com/continual-intelligence/seal/blob/main/few-shot/utils/lm_api.py): `few-shot/utils/lm_api.py`

### Other components

- **Experimenter**
- **Language model**
- **OpenAI API**

## Connections

- Experimenter → Self-edit loop: starts adaptation
- Experimenter → Continual self-edits: starts knowledge edits
- Self-edit loop → ARC tasks: reads tasks (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Task representation: configures formats (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Message formatting: formats messages (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Task augmentation: configures edits (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Inference preprocessing: preprocesses tasks (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Model inference: requests generations (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Model updates: applies updates (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Output voting: combines candidates (evidence: `few-shot/self-edit.py`)
- Self-edit loop → Task evaluation: evaluates outputs (evidence: `few-shot/self-edit.py`)
- Task adaptation → Task representation: uses representations (evidence: `few-shot/ttt.py`)
- Task adaptation → Message formatting: uses formatting (evidence: `few-shot/ttt.py`)
- Task adaptation → Model updates: updates model (evidence: `few-shot/ttt.py`)
- Inference preprocessing → ARC tasks: transforms tasks (evidence: `few-shot/inference/preprocess.py`)
- Inference preprocessing → Task augmentation: applies transforms (evidence: `few-shot/inference/preprocess.py`)
- Model inference → Language model: generates tokens
- Inference variants → Language model: generates tokens
- No-LoRA inference → Language model: generates tokens
- Continual self-edits → Question data: loads question data (evidence: `general-knowledge/src/continual/continual_self_edits.py`)
- Continual self-edits → Model API utilities: uses utilities (evidence: `general-knowledge/src/continual/continual_self_edits.py`)
- GA inner server → Model API utilities: uses utilities (evidence: `general-knowledge/src/inner/GA_server.py`)
- TTT inner server → Model API utilities: uses utilities (evidence: `general-knowledge/src/inner/TTT_server.py`)
- Knowledge queries → Model API utilities: uses utilities (evidence: `general-knowledge/src/query/query_server.py`)
- CPT with GA → Model API utilities: uses utilities (evidence: `general-knowledge/src/query/CPT_GA.py`)
- CPT full finetune → Model API utilities: uses utilities (evidence: `general-knowledge/src/query/CPT_fullFT.py`)
- CPT querying → Model API utilities: uses utilities
- Model API utilities → OpenAI API: requests completions (evidence: `general-knowledge/src/utils.py`)
- Language-model API → OpenAI API: calls API
