Image-to-Text
PyTorch
Safetensors
PEFT
English
remote-sensing
satellite-imagery
earth-observation
change-detection
visual-grounding
image-captioning
visual-question-answering
optical-sar-fusion
sar
multimodal
lora
Instructions to use thundercode/SatQuery with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use thundercode/SatQuery with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
docs: remove docs/ARCHITECTURE.md (de-duplicated)
Browse files- docs/ARCHITECTURE.md +0 -145
docs/ARCHITECTURE.md
DELETED
|
@@ -1,145 +0,0 @@
|
|
| 1 |
-
# SatQuery AI — Architecture
|
| 2 |
-
|
| 3 |
-
This is the architecture reference for SatQuery AI. It is written as a **hub plus ten deep
|
| 4 |
-
sub-documents**, because the system is large enough that a single file would either be superficial or
|
| 5 |
-
unreadable.
|
| 6 |
-
|
| 7 |
-
> **Status vocabulary used everywhere in these docs:** `IMPLEMENTED` (the code exists and runs) ·
|
| 8 |
-
> `VERIFIED` (checked against evidence) · `MEASURED` (a number was produced) · `ATTEMPTED` (tried,
|
| 9 |
-
> outcome recorded) · `NOT RUN` · `BLOCKED` · `DEFERRED` · `REJECTED` (tried and explicitly not
|
| 10 |
-
> accepted) · `OPEN` (known, unresolved) · `RESOLVED` · `CLOSED`.
|
| 11 |
-
>
|
| 12 |
-
> Every substantive claim in this set carries one of these tags, and every non-obvious claim cites
|
| 13 |
-
> the file it came from.
|
| 14 |
-
|
| 15 |
-
---
|
| 16 |
-
|
| 17 |
-
## 1. The thesis in one paragraph
|
| 18 |
-
|
| 19 |
-
SatQuery AI answers natural-language questions about satellite imagery. It is **not** one large
|
| 20 |
-
vision-language model. It is a **router plus specialists** system: a small learned router reads the
|
| 21 |
-
question and decides *which capability* is being asked for; the controller then runs exactly one
|
| 22 |
-
specialist; an evidence engine aggregates what that specialist produced; a confidence stage attaches
|
| 23 |
-
a calibrated (or honestly uncalibrated) number; and the whole thing is returned as one typed
|
| 24 |
-
`ResultEnvelope`. The only trained parameters in the system are six small modules sitting on frozen,
|
| 25 |
-
publicly-pinned backbones.
|
| 26 |
-
|
| 27 |
-
`docs/ARCHITECTURE_FREEZE.md` section 5 gives each layer exactly one verb, and the whole design
|
| 28 |
-
follows from that sentence:
|
| 29 |
-
|
| 30 |
-
> router **understands**; policy engine **decides**; specialists **compute**; VLM **explains**;
|
| 31 |
-
> evidence engine **proves**.
|
| 32 |
-
|
| 33 |
-
## 2. Sub-documents
|
| 34 |
-
|
| 35 |
-
| # | Document | What it covers |
|
| 36 |
-
|---|---|---|
|
| 37 |
-
| 01 | [System overview](architecture/01-system-overview.md) | the thesis, the component inventory, the frozen-backbone strategy, what is deliberately absent |
|
| 38 |
-
| 02 | [Deployment topology](architecture/02-deployment-topology.md) | the four tiers, the gateway, the outbound tunnel, wake flow, cold start, `transport_mode` |
|
| 39 |
-
| 03 | [Request lifecycle](architecture/03-request-lifecycle.md) | the nine-state controller, validation rules, modality inference, tiling |
|
| 40 |
-
| 04 | [Router](architecture/04-router.md) | frozen MiniLM, the five-head adapter, `interpret()` vs `chooseTask()`, the lexical fallback, the label space |
|
| 41 |
-
| 05 | [Specialists](architecture/05-specialists.md) | all six tasks: entry points, preprocessing, postprocessing, outputs |
|
| 42 |
-
| 06 | [Evidence and confidence](architecture/06-evidence-and-confidence.md) | the evidence schema, the aggregation pipeline, temperature scaling, the eight execution events |
|
| 43 |
-
| 07 | [Configuration freeze](architecture/07-configuration-freeze.md) | the registry, the enforced invariants, the config hash, why it is frozen |
|
| 44 |
-
| 08 | [API contract](architecture/08-api-contract.md) | the four endpoints, the envelopes, error codes, transport headers |
|
| 45 |
-
| 09 | [Frontend](architecture/09-frontend.md) | the static pages, the Analyze console, real-vs-preview, platform traps |
|
| 46 |
-
| 10 | [Observability and operations](architecture/10-observability-and-ops.md) | health, counters, traces, what is and is not observed |
|
| 47 |
-
|
| 48 |
-
## 3. The system at a glance
|
| 49 |
-
|
| 50 |
-
```mermaid
|
| 51 |
-
flowchart TB
|
| 52 |
-
subgraph Client
|
| 53 |
-
U[Browser]
|
| 54 |
-
end
|
| 55 |
-
subgraph Static["Static tier"]
|
| 56 |
-
CF["Cloudflare Pages<br/>satquery.pages.dev"]
|
| 57 |
-
end
|
| 58 |
-
subgraph Gateway["Gateway tier (Render)"]
|
| 59 |
-
R["satquery-orchestrator<br/>validate · CORS · limits · timeouts · errors"]
|
| 60 |
-
end
|
| 61 |
-
subgraph Inference["Inference tier (GitHub Codespace, CPU)"]
|
| 62 |
-
A["FastAPI · build_space_app()"]
|
| 63 |
-
CTRL["Controller (9-state FSM)"]
|
| 64 |
-
ROUTER["Router<br/>MiniLM + 5-head adapter"]
|
| 65 |
-
SPEC["Specialists<br/>vqa · caption · grounding · change · change_vqa · optical_sar"]
|
| 66 |
-
EV["Evidence engine<br/>dedup · order · renumber · cap"]
|
| 67 |
-
CONF["Confidence<br/>temperature scaling"]
|
| 68 |
-
A --> CTRL --> ROUTER --> SPEC --> EV --> CONF
|
| 69 |
-
end
|
| 70 |
-
U -->|HTTPS| CF
|
| 71 |
-
CF -->|"HTTPS JSON /api/*"| R
|
| 72 |
-
R -->|"outbound long-poll POST /tunnel/agent"| A
|
| 73 |
-
CONF -->|ResultEnvelope| R
|
| 74 |
-
R -->|envelope + error translation| CF
|
| 75 |
-
```
|
| 76 |
-
|
| 77 |
-
## 4. Cross-cutting principles
|
| 78 |
-
|
| 79 |
-
These recur in every sub-document and are the reason the code looks the way it does.
|
| 80 |
-
|
| 81 |
-
### 4.1 One config system, no magic numbers
|
| 82 |
-
|
| 83 |
-
Every tunable value lives in `configs/base.yaml`. The loader (`core/config.py`) validates it against
|
| 84 |
-
the frozen architecture and hashes it. **No number is hard-coded in Python.** This is enforced
|
| 85 |
-
socially and structurally: a reviewer who finds a literal in a specialist has found a bug.
|
| 86 |
-
|
| 87 |
-
### 4.2 Frozen backbones, trained modules
|
| 88 |
-
|
| 89 |
-
No backbone is fine-tuned. `all-MiniLM-L6-v2`, `SmolVLM-500M-Instruct`, `RemoteCLIP ViT-B/32` and
|
| 90 |
-
`CROMA-base` are all pinned **by revision** and fetched from the Hub at run time. What this project
|
| 91 |
-
trains is small: a 50,822-parameter router adapter, four heads, and one LoRA adapter. This is what
|
| 92 |
-
makes the system CPU-runnable.
|
| 93 |
-
|
| 94 |
-
### 4.3 Typed contracts between every layer
|
| 95 |
-
|
| 96 |
-
`core/schemas.py` is the binding contract. No specialist may invent its own result shape; every
|
| 97 |
-
specialist returns a `SpecialistResult`. The schemas carry validators that encode real findings —
|
| 98 |
-
for example `Evidence` **refuses** spatial coordinates without a `coordinate_system`, because a bare
|
| 99 |
-
box is meaningless.
|
| 100 |
-
|
| 101 |
-
### 4.4 Honest degradation over confident fabrication
|
| 102 |
-
|
| 103 |
-
The system is built so that "we could not do this" is representable and preferred to a plausible
|
| 104 |
-
guess. Concretely:
|
| 105 |
-
|
| 106 |
-
- a missing calibration artifact yields `method="uncalibrated"`, `calibrated=None` — **never** a
|
| 107 |
-
fabricated fitted number;
|
| 108 |
-
- a missing optional artifact **degrades** a capability rather than crashing the service;
|
| 109 |
-
- a *corrupt* artifact **raises**, because silently treating a corrupt file as "no file" would hide
|
| 110 |
-
an operational defect;
|
| 111 |
-
- the evidence engine records `dropped_over_limit` rather than silently truncating;
|
| 112 |
-
- the grounding specialist marks a result `degraded` when it produces no localisation.
|
| 113 |
-
|
| 114 |
-
### 4.5 Reproducibility is a structural property
|
| 115 |
-
|
| 116 |
-
`EvidenceEngine.aggregate` is pure and deterministic — no clock, no RNG, no I/O. Evidence ids are
|
| 117 |
-
assigned from *sorted position*, not input order, so the same inputs produce byte-identical output.
|
| 118 |
-
`evidence_digest()` exists so that reproducibility is a test assertion rather than a hope.
|
| 119 |
-
|
| 120 |
-
### 4.6 No chain-of-thought anywhere
|
| 121 |
-
|
| 122 |
-
`ExecutionTrace` records **observable facts only** — states, timings, counts, config hash, model
|
| 123 |
-
refs. There is no field for model reasoning and no LLM-generated confidence. This is a deliberate
|
| 124 |
-
constraint from the architecture freeze, not an omission.
|
| 125 |
-
|
| 126 |
-
## 5. What the system deliberately does not have
|
| 127 |
-
|
| 128 |
-
| Absent | Why |
|
| 129 |
-
|---|---|
|
| 130 |
-
| Database, auth, queue | the gateway is stateless by design |
|
| 131 |
-
| GPU requirement | device is chosen via `SATQUERY_DEVICE`; all placement is `.to(device)` |
|
| 132 |
-
| Gradio GUI | the frontend is a separate static tier; `app/space_app.py` serves JSON only |
|
| 133 |
-
| End-to-end benchmark | none exists; none is claimed |
|
| 134 |
-
| Chain-of-thought | traces carry observable facts only |
|
| 135 |
-
| Backbone redistribution | backbones are fetched, pinned by revision |
|
| 136 |
-
|
| 137 |
-
## 6. Where to start reading
|
| 138 |
-
|
| 139 |
-
- **New to the project** → [01 System overview](architecture/01-system-overview.md), then
|
| 140 |
-
[03 Request lifecycle](architecture/03-request-lifecycle.md).
|
| 141 |
-
- **Running it** → [`DEPLOYMENT.md`](DEPLOYMENT.md) and
|
| 142 |
-
[02 Deployment topology](architecture/02-deployment-topology.md).
|
| 143 |
-
- **Auditing the numbers** → [`BENCHMARKS.md`](BENCHMARKS.md) and [`EVALUATION.md`](EVALUATION.md).
|
| 144 |
-
- **Understanding the router defect** → [04 Router](architecture/04-router.md) and
|
| 145 |
-
[`RESEARCH_NOTES.md`](RESEARCH_NOTES.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|