Spaces:
Running on Zero
Running on Zero
File size: 14,807 Bytes
70650b7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | # HearthNet Phase 3 β Spec Set Overview
**Phase 3 scope:** research-shaped, 6β12 months. This is where HearthNet stops being a product and starts being a protocol. Each module here is an investment in a long-term capability where the engineering is the easy part β the hard part is establishing trust, governance, and standards.
**Stance:** Phase 3 specs are **roadmaps**, not contracts. Where a Phase-1/2 spec answers "what does this *do*?", a Phase-3 spec answers "what would we *build* if we were ready to commit?". Concrete enough to start, loose enough to be wrong about details without invalidating the direction.
---
## 0. Reading these specs
Phase 3 specs deviate from the Phase 1 / 2 template in three respects:
1. **Stability tag is `experimental` for new capabilities** unless explicitly promoted later. Mesh nodes ignore experimental capabilities unless the operator opts in via `policy.research.enable = true`.
2. **Each module carries an "Open research questions" section** that is longer than the spec itself, by design. Phase 3 modules answer *some* of their open questions before shipping; the rest stay open.
3. **Acceptance criteria are described, not enumerated**. The point isn't to grade an implementation against a checklist; it's to say "we'll know this is working whenβ¦"
If you read a Phase 3 spec and feel uncertain about how something works, that uncertainty is faithful to the state of the work. The spec is doing its job by being honest about that.
---
## 1. Module map (Phase 3)
### New numbered modules
| ID | Module | Spec file | Concern |
|-----|------------------------------|-------------------------------------------------|----------------------------------------------------------------------|
| M26 | Distributed Inference | `modules/M26-distributed-inference.md` | Layer-sharded LLMs across nodes (Petals-style), small models only |
| M27 | MoE Expert Routing | `modules/M27-moe-routing.md` | Route queries to the right expert (machine or human) via learned scorer |
| M28 | Federated Learning | `modules/M28-fedlearn.md` | FedAvg on LoRA layers; per-community fine-tuning without sharing data |
| M29 | LoRA Long-Distance Beacons | `modules/M29-lora-beacons.md` | 868MHz "community alive" beacons; no AI traffic; emergency-only |
| M30 | Evidence / EBKH | `modules/M30-evidence-ebkh.md` | Claim graph alongside the event log; provenance + verifiability |
| M31 | Civil Defence Pilot | `modules/M31-civil-defense.md` | THW / DRK / KatS bridge; compliance profile; audit trail |
| M32 | Protocol Standardisation | `modules/M32-protocol-standard.md` | Reference implementation, conformance suite, governance for the spec |
### New cross-cutting modules
| ID | Module | Spec file | Concern |
|-----|-----------------------|---------------------------------------------------|------------------------------------------------------|
| X08 | Tensor Transport | `cross-cutting/X08-tensor-transport.md` | High-throughput chunked tensor passing for M26 |
| X09 | Conformance Suite | `cross-cutting/X09-conformance-suite.md` | Black-box tests defining what "HearthNet-compliant" means |
### Modifications to earlier modules
| Phase 1/2 module | Phase 3 extension |
|------------------|-------------------|
| M03 Bus | Optional MoE routing layer between dispatcher and handler (M27) |
| M04 LLM | Optional `experimental.distributed_llm.chat@1.0` backend (M26) |
| X02 Event log | Optional `evidence.*` claim records side-by-side with events (M30) |
| M14 Federation | Federated learning rounds use federation as the trust substrate (M28) |
| X03 Observability | Per-call expert-routing trace; per-shard tensor-transport metrics (M27, X08) |
---
## 2. Dependency graph (Phase 3 additions on top of Phases 1β2)
```
βββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 1 + Phase 2 (unchanged) β
ββββββ¬βββββββββββββββββ¬βββββββββββββββ¬βββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ
β X08 β β M27 β β M30 β
β Tensor β β MoE β β EBKH β
β Transp. β β Routing β β Evidenceβ
βββββββ¬βββββ βββββββ¬βββββ ββββββ¬ββββββ
βΌ β β
ββββββββββββ β β
β M26 β β β
β Distrib.β β β
β Infer. β β β
ββββββββββββ β β
βΌ βΌ
ββββββββββββ ββββββββββββ
β M28 β β M31 β
β FedLearnβ β CivDef. β
ββββββββββββ ββββββββββββ
Standalone (no software deps, governance / hardware):
ββββββββββββ
β M29 β (hardware)
β LoRa β
β Beacons β
ββββββββββββ
ββββββββββββ
β X09 β (process)
β Conform.β
ββββββββββββ
ββββββββββββ
β M32 β (governance)
β Standardβ
ββββββββββββ
```
Most Phase 3 modules are independent of each other. The exceptions:
- M26 depends on X08
- M27 informs M26 (MoE routing picks which expert/shard)
- M28 reuses M14 federation for cross-community rounds
- M31 reuses M30 for evidence-grade emergency claims
---
## 3. File tree additions
```
hearthnet/
βββ distributed_inference/ # M26
β βββ __init__.py
β βββ shard.py
β βββ pipeline.py
β βββ routing.py
β βββ backends/
β βββ petals_like.py
β βββ small_model_layered.py
β
βββ moe/ # M27
β βββ __init__.py
β βββ router.py
β βββ scorer.py
β βββ human_in_the_loop.py
β
βββ fedlearn/ # M28
β βββ __init__.py
β βββ coordinator.py
β βββ round.py
β βββ lora_diff.py
β βββ aggregation.py
β
βββ lora_beacons/ # M29 β hardware integration; tiny Python surface
β βββ __init__.py
β βββ beacon_bridge.py # serial protocol to a LoRa USB stick
β βββ policy.py
β
βββ evidence/ # M30
β βββ __init__.py
β βββ claim.py
β βββ claim_graph.py
β βββ provenance.py
β βββ ebkh_bridge.py # bridge to Christof's EBKH v3+
β
βββ civil_defense/ # M31
β βββ __init__.py
β βββ profile.py # THW / DRK / KatS member types
β βββ audit.py
β βββ nrw_katastrophenschutz.py
β
βββ transport/
β βββ tensor.py # X08
β
βββ conformance/ # X09
βββ __init__.py
βββ runner.py
βββ suites/
β βββ identity.py
β βββ transport.py
β βββ bus.py
β βββ services.py
β βββ federation.py
βββ report.py
protocol/ # M32 β separate top-level dir at repo root
βββ README.md
βββ spec/ # the protocol spec, decoupled from the impl
β βββ 00-overview.md # mirror of CAPABILITY_CONTRACT but
β βββ 01-identity.md # implementation-agnostic
β βββ ...
βββ governance/
βββ CHANGELOG.md
βββ CONTRIBUTING.md
βββ ROADMAP.md
```
---
## 4. Conventions delta from Phase 2
### 4.1 New `experimental` namespace
A Phase-3 capability MAY be advertised as `experimental.<name>@<ver>`. Mesh nodes default to **not registering** experimental capabilities; the operator must opt in via:
```toml
[policy.research]
enable = true
enabled_capabilities = ["experimental.distributed_llm.chat@1.0", "experimental.fedlearn.round.*"]
```
Once a capability is sufficiently proven, it is promoted out of the `experimental.` prefix in a contract bump.
### 4.2 New type aliases
```python
# additions to hearthnet/types.py
ShardID = str # "<model_id>:<layer_range>"
ExpertID = str # opaque, refers to a routable subsystem
ClaimID = str # ULID
RoundID = str # fedlearn round identifier (ULID)
LoraBeaconID = str # 8-byte hex, hardware-issued
EvidenceLevel = Literal["unverified","cited","cross_referenced","attested","disputed"]
ExpertKind = Literal["model","human","service","external"]
```
### 4.3 New constants
```python
# additions to hearthnet/constants.py β Phase 3
# Distributed inference (M26)
DISTRIBUTED_MAX_SHARDS_PER_REQUEST = 16
DISTRIBUTED_SHARD_HEALTH_TIMEOUT_S = 30
DISTRIBUTED_FALLBACK_TO_LOCAL_AFTER_FAILURES = 2
# MoE routing (M27)
MOE_ROUTER_TOP_K = 3
MOE_ROUTER_TRAIN_MIN_EXAMPLES = 200
MOE_ROUTER_RETRAIN_EVERY_HOURS = 24
# Federated learning (M28)
FEDLEARN_MAX_ROUND_MINUTES = 120
FEDLEARN_MIN_PARTICIPANTS = 3
FEDLEARN_MAX_LORA_RANK = 64
FEDLEARN_GRAD_CLIP = 1.0
FEDLEARN_DP_NOISE_SCALE_DEFAULT = 0.0 # off by default; off-by-default differential privacy
# Evidence (M30)
EVIDENCE_CLAIM_TTL_DAYS_DEFAULT = 365
EVIDENCE_MAX_PROVENANCE_DEPTH = 16
# Civil defence (M31)
CIVDEF_AUDIT_RETENTION_YEARS = 10
CIVDEF_HEARTBEAT_SECONDS = 60
# Tensor transport (X08)
TENSOR_CHUNK_BYTES = 1_048_576 # 1 MB
TENSOR_FLOW_CONTROL_WINDOW = 16 # chunks
TENSOR_COMPRESSION_THRESHOLD_BYTES = 65_536
# LoRa beacons (M29)
LORA_BEACON_PERIOD_SECONDS_DEFAULT = 600 # 10 minutes
LORA_BEACON_MAX_PAYLOAD_BYTES = 32
```
---
## 5. Build order (Phase 3)
Phase 3 is not a release; it is a set of long-running tracks. Suggested ordering by independence + value:
| Track | Modules | Outcome |
|-------|----------------------------------|-------------------------------------------------------------------------------|
| A | X09 Conformance + M32 Standard | Other people can build HearthNet-compliant nodes |
| B | M30 Evidence / EBKH | Marketplace claims and emergency posts carry provenance |
| C | M27 MoE Routing (machines only) | Better answers for free; routes RAG queries to best-suited backend |
| D | M27 + M28 (human routing) | Neighbour gets pinged when their expertise matches |
| E | M28 FedLearn | Communities co-train a small LoRA without sharing source data |
| F | X08 + M26 Distributed Inference | Two anchors jointly serve a 7B model; large models become feasible LAN-wide |
| G | M29 LoRa Beacons | Resilient "I am alive" pings during regional internet outages |
| H | M31 Civil Defence Pilot | A real Niederrhein THW Ortsverband uses HearthNet for an exercise |
Tracks can run in parallel. None of them block the existing Phase-2 system.
---
## 6. Spec versioning
- Capability Contract bumps to **v3.0** but the bump is *additive*. v2 nodes coexist with v3 nodes; experimental capabilities simply aren't seen by v2 nodes.
- The first concrete deliverable of Track A (M32) is to **decouple** the protocol spec from the implementation. After that, the contract has its own version track separate from the Python implementation's version.
---
## 7. Out-of-band documents (Phase 3)
- **RESEARCH_AGENDA.md** β the deeper "why" for each module; intended audience: PhD students and grant reviewers
- **GOVERNANCE.md** β how spec changes are proposed, reviewed, and accepted; ties into M32
- **ETHICS_REVIEW.md** β the framework for evaluating MoE-driven routing-to-humans (M27) and fedlearn-on-personal-data (M28)
- **CIVDEF_AGREEMENT_TEMPLATE.md** β the MoU template for a civil-defence pilot
---
## 8. What is NOT in Phase 3
Even with all of Phase 3 done, the following remain explicit non-goals:
- A central directory of communities. There is no "HearthNet.com" listing all communities. Discovery is via word of mouth + DHT + federation. Pushed indefinitely.
- An app store for capabilities. Capabilities are code in the source tree, reviewed by maintainers. Not pluggable at runtime by untrusted code.
- A consensus protocol (Paxos, Raft). Communities do not vote on shared state beyond event-log gossip. Federation does not imply consensus.
- A cryptocurrency / token economy. Not even for fedlearn incentives. Reputational signals only.
- AGI. Even the distributed inference module targets at-most-mid-sized models (7B-class). The thesis is "small models close to people are more useful than large models far away", and Phase 3 doesn't change that.
|