# lagrange-labs/deep-prove architecture

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

- Interactive diagram: https://gitdiagram.com/lagrange-labs/deep-prove
- Repository: https://github.com/lagrange-labs/deep-prove

## Overview

DeepProve is a zero-knowledge inference system centered on the zkml Rust library, with a CLI/worker client stack, tensor storage, and inspection tooling. The primary workflow is to load and prepare a model, execute inference, then generate and verify a proof; CLI jobs may be run locally or submitted to a remote proving network. The graph also retains the documented model-family/layer coverage, storage backends, and tensor-inspection tool. Edges rely on README-level capability statements or the shown worker/CLI excerpts; unsampled implementation links are omitted where their callers are not evidenced.

Main entry points: [`zkml/src/iop/prover.rs`](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/iop/prover.rs) (Proof protocol), [`deep-prove/src/bin/worker/main.rs`](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/main.rs) (Worker server), [`deep-prove/src/bin/worker/lpn/proving.rs`](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/lpn/proving.rs) (Worker proving), [`tenstore/src/genstore.rs`](https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/genstore.rs) (Tensor store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Model preparation"]
  node_parser["Model parsers<br/>[onnx.rs]"]
  node_quantization["Model quantization<br/>[mod.rs]"]
  node_llm_driver["LLM driver<br/>[llm.rs]"]
end

subgraph group_inference["Inference engine"]
  node_exec_graph["Execution graph<br/>[exec_graph.rs]"]
  node_model_context["Model context<br/>[context.rs]"]
  node_trace["Inference trace<br/>[trace.rs]"]
  node_layers["Neural layers<br/>[activation.rs]"]
  node_transformer["Transformer layers<br/>[mod.rs]"]
  node_tensor["Tensor runtime<br/>[mod.rs]"]
end

subgraph group_proof["Proof system"]
  node_proof_protocol["Proof protocol<br/>[prover.rs]"]
  node_lookup["Lookup GKR<br/>[prover.rs]"]
  node_commitment["Polynomial commitment<br/>[prover.rs]"]
  node_verifier["Proof verifier<br/>[verifier.rs]"]
end

subgraph group_client["Client stack"]
  node_cli["Proving CLI<br/>[main.rs]"]
  node_local_exec["Local executor<br/>[local.rs]"]
  node_remote_submit["Remote submission<br/>[http.rs]"]
  node_worker["Worker server<br/>[main.rs]"]
  node_worker_api["Worker API<br/>[api.rs]"]
  node_worker_proving["Worker proving<br/>[proving.rs]"]
end

subgraph group_data["Storage and inspection"]
  node_deep_store["Proof data store<br/>[store.rs]"]
  node_tenstore["Tensor store<br/>[genstore.rs]"]
  node_disk_store[("Local disk backend<br/>[local.rs]")]
  node_remote_store["Remote backend<br/>[mod.rs]"]
  node_remote_client["Remote store client<br/>[client.rs]"]
  node_tenvis["Tensor inspector<br/>[core.rs]"]
  node_tenvis_model["Inspection model<br/>[model.rs]"]
  node_tenvis_plot["Model plotting<br/>[plot.rs]"]
end

node_user(("User"))

node_user -->|"submits job"| node_cli
node_cli -->|"runs locally"| node_local_exec
node_cli -->|"submits remotely"| node_remote_submit
node_remote_submit -.->|"dispatches job"| node_worker
node_worker -->|"serves API"| node_worker_api
node_worker -->|"runs proving"| node_worker_proving
node_worker_proving -->|"loads proof data"| node_deep_store
node_worker_proving -->|"parses model"| node_parser
node_parser -.->|"prepares model"| node_quantization
node_quantization -.->|"configures inference"| node_llm_driver
node_llm_driver -->|"runs model"| node_model_context
node_model_context -.->|"executes graph"| node_exec_graph
node_exec_graph -.->|"dispatches layers"| node_layers
node_exec_graph -.->|"dispatches transformer"| node_transformer
node_layers -.->|"operates on tensors"| node_tensor
node_transformer -.->|"operates on tensors"| node_tensor
node_llm_driver -->|"returns trace"| node_trace
node_worker_proving -->|"proves inference"| node_proof_protocol
node_proof_protocol -.->|"uses lookup proofs"| node_lookup
node_proof_protocol -.->|"commits polynomials"| node_commitment
node_proof_protocol -->|"supports verification"| node_verifier
node_worker -->|"configures storage"| node_tenstore
node_tenstore -->|"uses local backend"| node_disk_store
node_tenstore -->|"uses remote backend"| node_remote_store
node_remote_store -->|"sends store requests"| node_remote_client
node_tenvis -->|"loads inspection data"| node_tenvis_model
node_tenvis -->|"plots models"| node_tenvis_plot
node_tenvis_model -.->|"reads stored tensors"| node_tenstore

click node_cli "https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/cli/main.rs"
click node_local_exec "https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/cli/local.rs"
click node_remote_submit "https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/cli/lpn/http.rs"
click node_worker "https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/main.rs"
click node_worker_api "https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/api.rs"
click node_worker_proving "https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/lpn/proving.rs"
click node_parser "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/parser/onnx.rs"
click node_quantization "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/quantization/mod.rs"
click node_llm_driver "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/llm.rs"
click node_exec_graph "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/exec_graph.rs"
click node_model_context "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/context.rs"
click node_trace "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/trace.rs"
click node_layers "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/layers/activation.rs"
click node_transformer "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/layers/transformer/mod.rs"
click node_tensor "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/tensor/mod.rs"
click node_proof_protocol "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/iop/prover.rs"
click node_lookup "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/lookup/logup_gkr/prover.rs"
click node_commitment "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/poly_commit/prover.rs"
click node_verifier "https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/iop/verifier.rs"
click node_deep_store "https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/store.rs"
click node_tenstore "https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/genstore.rs"
click node_disk_store "https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/local.rs"
click node_remote_store "https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/remote/mod.rs"
click node_remote_client "https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/remote/client.rs"
click node_tenvis "https://github.com/lagrange-labs/deep-prove/blob/master/tenvis/src/core.rs"
click node_tenvis_model "https://github.com/lagrange-labs/deep-prove/blob/master/tenvis/src/model.rs"
click node_tenvis_plot "https://github.com/lagrange-labs/deep-prove/blob/master/tenvis/src/plot.rs"

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_parser,node_quantization,node_llm_driver,node_user toneBlue
class node_exec_graph,node_model_context,node_trace,node_layers,node_transformer,node_tensor toneAmber
class node_proof_protocol,node_lookup,node_commitment,node_verifier toneMint
class node_cli,node_local_exec,node_remote_submit,node_worker,node_worker_api,node_worker_proving toneRose
class node_deep_store,node_tenstore,node_disk_store,node_remote_store,node_remote_client,node_tenvis,node_tenvis_model,node_tenvis_plot toneIndigo
```

## Components

### Model preparation

- [Model parsers](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/parser/onnx.rs): `zkml/src/parser/onnx.rs`
- [Model quantization](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/quantization/mod.rs): `zkml/src/quantization/mod.rs`
- [LLM driver](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/llm.rs): `zkml/src/model/llm.rs`

### Inference engine

- [Execution graph](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/exec_graph.rs): `zkml/src/model/exec_graph.rs`
- [Model context](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/context.rs): `zkml/src/model/context.rs`
- [Inference trace](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/model/trace.rs): `zkml/src/model/trace.rs`
- [Neural layers](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/layers/activation.rs): `zkml/src/layers/activation.rs`
- [Transformer layers](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/layers/transformer/mod.rs): `zkml/src/layers/transformer/mod.rs`
- [Tensor runtime](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/tensor/mod.rs): `zkml/src/tensor/mod.rs`

### Proof system

- [Proof protocol](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/iop/prover.rs): `zkml/src/iop/prover.rs`
- [Lookup GKR](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/lookup/logup_gkr/prover.rs): `zkml/src/lookup/logup_gkr/prover.rs`
- [Polynomial commitment](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/poly_commit/prover.rs): `zkml/src/poly_commit/prover.rs`
- [Proof verifier](https://github.com/lagrange-labs/deep-prove/blob/master/zkml/src/iop/verifier.rs): `zkml/src/iop/verifier.rs`

### Client stack

- [Proving CLI](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/cli/main.rs): `deep-prove/src/bin/cli/main.rs`
- [Local executor](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/cli/local.rs): `deep-prove/src/bin/cli/local.rs`
- [Remote submission](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/cli/lpn/http.rs): `deep-prove/src/bin/cli/lpn/http.rs`
- [Worker server](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/main.rs): `deep-prove/src/bin/worker/main.rs`
- [Worker API](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/api.rs): `deep-prove/src/bin/worker/api.rs`
- [Worker proving](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/bin/worker/lpn/proving.rs): `deep-prove/src/bin/worker/lpn/proving.rs`

### Storage and inspection

- [Proof data store](https://github.com/lagrange-labs/deep-prove/blob/master/deep-prove/src/store.rs): `deep-prove/src/store.rs`
- [Tensor store](https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/genstore.rs): `tenstore/src/genstore.rs`
- [Local disk backend](https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/local.rs): `tenstore/src/local.rs`
- [Remote backend](https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/remote/mod.rs): `tenstore/src/remote/mod.rs`
- [Remote store client](https://github.com/lagrange-labs/deep-prove/blob/master/tenstore/src/remote/client.rs): `tenstore/src/remote/client.rs`
- [Tensor inspector](https://github.com/lagrange-labs/deep-prove/blob/master/tenvis/src/core.rs): `tenvis/src/core.rs`
- [Inspection model](https://github.com/lagrange-labs/deep-prove/blob/master/tenvis/src/model.rs): `tenvis/src/model.rs`
- [Model plotting](https://github.com/lagrange-labs/deep-prove/blob/master/tenvis/src/plot.rs): `tenvis/src/plot.rs`

### Other components

- **User**

## Connections

- User → Proving CLI: submits job (evidence: `README.md`)
- Proving CLI → Local executor: runs locally (evidence: `deep-prove/src/bin/cli/main.rs`)
- Proving CLI → Remote submission: submits remotely (evidence: `deep-prove/src/bin/cli/main.rs`)
- Remote submission → Worker server: dispatches job
- Worker server → Worker API: serves API (evidence: `deep-prove/src/bin/worker/main.rs`)
- Worker server → Worker proving: runs proving (evidence: `deep-prove/src/bin/worker/main.rs`)
- Worker proving → Proof data store: loads proof data (evidence: `deep-prove/src/bin/worker/lpn/mod.rs`)
- Worker proving → Model parsers: parses model
- Model parsers → Model quantization: prepares model
- Model quantization → LLM driver: configures inference
- LLM driver → Model context: runs model (evidence: `zkml/src/model/llm.rs`)
- Model context → Execution graph: executes graph
- Execution graph → Neural layers: dispatches layers
- Execution graph → Transformer layers: dispatches transformer
- Neural layers → Tensor runtime: operates on tensors
- Transformer layers → Tensor runtime: operates on tensors
- LLM driver → Inference trace: returns trace (evidence: `zkml/src/model/llm.rs`)
- Worker proving → Proof protocol: proves inference (evidence: `README.md`)
- Proof protocol → Lookup GKR: uses lookup proofs
- Proof protocol → Polynomial commitment: commits polynomials
- Proof protocol → Proof verifier: supports verification (evidence: `README.md`)
- Worker server → Tensor store: configures storage (evidence: `deep-prove/src/bin/worker/main.rs`)
- Tensor store → Local disk backend: uses local backend (evidence: `tenstore/src/genstore.rs`)
- Tensor store → Remote backend: uses remote backend (evidence: `tenstore/src/genstore.rs`)
- Remote backend → Remote store client: sends store requests (evidence: `tenstore/src/remote/mod.rs`)
- Tensor inspector → Inspection model: loads inspection data (evidence: `tenvis/src/main.rs`)
- Tensor inspector → Model plotting: plots models (evidence: `tenvis/src/main.rs`)
- Inspection model → Tensor store: reads stored tensors
