Repository navigation
Remove collaboration section from README - #232
Merged
Merged
Conversation
Removed the 'Built in Collaboration With' section detailing contributors and infrastructure.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the "Built in Collaboration With" section from the README, which previously acknowledged human leadership, AI development partners, and infrastructure components used in the project.
- Removes acknowledgments section listing contributors and tools
- Simplifies README structure by eliminating a non-essential section
- Maintains proper markdown formatting with correct section separators
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…uner skeleton — the unification Stacks on top of `feat/fine-tuning-subsystem` (which lands the trait + types + registry + OpenAI adapter). This commit wires the dispatch seam: a `genome/*` ServiceModule on top of a typed coordinator that abstracts provider selection across local / grid / cloud. Joel's framing: "Finally bringing it all together into a performant concurrent rtos abstracting provider whether local, grid or cloud." The convergence: - Inference: `AIProviderAdapter` trait, 9 cloud providers + local llamacpp + cross-grid airc-remote (#108) all behind one Arc<dyn> - Fine-tuning: `FineTuningAdapter` trait, 1 cloud impl (OpenAI) + local-candle skeleton + future cross-grid airc-remote, all behind one Arc<dyn> - Both seam into the same RTOS substrate: `ServiceModule` + `tick` + `install_executor` + `PressureBroker` + `TokioConcurrencyPolicy` - Persona never names a provider; substrate picks per request ## What lands ### `core/continuum-core/src/genome/fine_tuning/coordinator.rs` `FineTuningCoordinator` — stateless selector consulting an `Arc<FineTuningRegistry>`. Algorithm: 1. **Filter** by hard capability match: base_model prefix (empty Vec = wildcard for local Candle), `supports_lora` if request has LoRA hyperparams, `supports_validation` if dataset's validation_split > 0. 2. **Honor preferred_provider** when supplied AND capable. When the preference is registered but NOT capable for this request, return typed `PreferredUnavailable` with the diagnostic — no silent fallback to a different provider ([[no-fallbacks-ever]]). 3. **Otherwise rank by locality**: adapters with `produces_local_artifact=true` beat cloud. Tier 0 = local; tier 1 = cloud. 4. **Alphabetical tie-break** within tier. Stable, no hidden ordering. 9 unit tests cover each rule independently. The locality rule is load-bearing for the matrix-dojo doctrine — pinning it now keeps training data on-substrate when local capacity exists. ### `core/continuum-core/src/genome/fine_tuning/local_candle_adapter.rs` `LocalCandleFineTuner` — substrate-native LoRA trainer skeleton. Honest "not yet" semantics per [[no-fallbacks-ever]] + the cautionary tale of the dead `channel.rs` trigger we deleted in PR #1572: - Exists as a real registered adapter (the architectural slot is visible to the coordinator + telemetry + operator) - `create_job` returns `FineTuningError::LocalTrainerFailed` with pointers to follow-up tasks #231/#232/#233 — explicit "math not implemented" instead of fabricated success - `poll` / `cancel` correctly reject unknown handles with `UnknownHandle` instead of fabricating a `TrainingStatus` - Capabilities advertise the eventual real shape (`produces_local_artifact=true` so locality preference fires; wildcard base prefixes; LoRA + validation supported), so swapping the math in later requires no call-site changes When tasks #231-#233 land the optimizer loop, this struct fills in place. The trait + the dispatch + the boot wiring all stay. ### `core/continuum-core/src/modules/genome.rs` `GenomeModule` ServiceModule. Three commands: - `genome/job-create` — coordinator picks provider, adapter creates job. Returns `{success, result: {handle, selectedProvider}}` so callers see which provider got picked (important for telemetry + operator validation of the locality preference). - `genome/job-status` — adapter looked up by `handle.provider_id`, polls, returns typed `TrainingStatus`. - `genome/job-cancel` — same lookup, cancels. Per [[commands-are-dumb-daemons-are-smart]] the module is narrow. All errors return as `{success: false, error, errorKind}` so TS-side callers can branch on the typed `errorKind` slug (`InvalidRequest` / `MissingCredentials` / `ProviderRejected` / `Transient` / `MalformedResponse` / `LocalTrainerFailed` / `UnknownHandle`) without parsing free-form text. ### `start_server` boot wiring (`ipc/mod.rs`) Builds a `FineTuningRegistry`, conditionally registers `OpenAIFineTuningAdapter` when `OPENAI_API_KEY` is set, always registers `LocalCandleFineTuner`, then registers the `GenomeModule` backed by the populated registry. Mistral / Anthropic / Fireworks / DeepSeek / Together adapters plug in here as their impls land — same pattern, gated on the matching `*_API_KEY` secret. ### `core/continuum-core/Cargo.toml` Adds `multipart` to `reqwest` features (carried over from the stacked-below PR; OpenAI's `/v1/files` upload needs it). ## Verified cargo check -p continuum-core --lib --features metal,accelerate -> clean cargo test -p continuum-core --lib --features metal,accelerate genome::fine_tuning:: -> 34/34 modules::genome:: -> 5/5 39 new tests across the stack. Covers: trait object-safety + dyn dispatch; registry lookup + re-registration; coordinator selection rules (8 distinct invariants); OpenAI HTTP status mapping + provider slug taxonomy; ServiceModule wire shape + envelope contract + preferred-provider honoring. ## Doctrinal alignment - `[[commands-are-dumb-daemons-are-smart]]` — `GenomeModule` is narrow (validate → look up adapter → dispatch). All smart logic (capability filter, locality preference, future cost/pressure signals) lives in `FineTuningCoordinator` + the adapter impls. - `[[no-fallbacks-ever]]` — `LocalCandleFineTuner` skeleton returns typed `LocalTrainerFailed` instead of silently picking cloud or fabricating success. `PreferredUnavailable` is the typed answer to "honor my preference or tell me why you can't." - `[[matrix-dojo-layer-loading-as-substrate-primitive]]` — the coordinator's locality rank ensures training data stays on-substrate when local capacity exists. - `[[inference-is-an-adapter-always-in-the-loop]]` extended: fine- tuning is also an adapter, always in the loop. The coordinator is the substrate's typed answer to "which adapter?" - `[[rust-is-the-core-node-is-the-shell]]` — `genome/job-create` now exists as a Rust ServiceModule. The TS-side equivalent in `src/commands/genome/job-create/` is no longer authoritative; follow-up PR can delete it once Node clients route through the Rust path. ## Follow-ups (already filed) - #231: `LocalCandleFineTuner` LoRA module + autograd (math 1/3) - #232: data loader + AdamW + training loop (math 2/3) - #233: job lifecycle actor + safetensors output (math 3/3) - 5 more cloud adapters (Mistral / Anthropic / Fireworks / DeepSeek / Together) — each ~250 LOC mirroring the OpenAI pattern, slots into the existing boot wiring with a one-line registration Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…dule + OpenAI + local skeleton (task #230) (#1574) * feat(genome): fine-tuning subsystem — trait + types + registry + OpenAI adapter (task #230, Stage 1) Lays the substrate-side architectural seam for the continuous-learning loop: noteworthy engrams → teacher-synthesized curriculum → fine-tuning subsystem → LoRA artifact → forge/alloy provenance → genome paging → mesh sharing. Joel's framing on this stage: "make a glorious fine tuning subsystem per our awesome continuous learning. Modular code." This commit lands the modular pieces; the local Candle trainer + remaining cloud adapters + the academy/teacher pipeline are follow-up PRs that plug into the seams this commit defines. ## What lands ### `core/continuum-core/src/genome/fine_tuning/` A new submodule under the existing `genome/` cache + paging infrastructure. Four files: - **`mod.rs`** — doctrine doc explaining where this module sits in the continuous-learning loop. Stage 3 of 6: takes a curated dataset + hyperparams + provider preference, runs a job, returns a `TrainingArtifact` that forge / alloy / paging consume. - **`types.rs`** — typed wire surfaces. Every field that crosses an adapter boundary is typed at compile time; no `serde_json::Value` pass-through except for opt-in dataset-example metadata: - `TrainingJobRequest` (persona_id, base_model, trait_kind, dataset, optional hyperparams) - `TrainingDataset` + `TrainingExample` + `TrainingSource` enum (`teacher_synthesized` / `operator_curated` / `raw` / `mesh_inherited`) — source provenance is load-bearing for the substrate's reputation signal - `LoRAHyperparams` + `ScheduleParams` - `JobHandle` (provider_id + provider_job_id + local UUID) - `TrainingStatus` tagged enum (Queued / Running / Completed / Failed / Cancelled) — terminal `Completed` carries the `TrainingArtifact` - `TrainingArtifact` + `JobMetrics` All structs ts-rs export to `protocol/typescript/genome/fine_tuning/` so TS-side consumers get matching types automatically. - **`adapter.rs`** — the `FineTuningAdapter` trait + typed `FineTuningError` taxonomy (`InvalidRequest` / `MissingCredentials` / `ProviderRejected` / `Transient` / `MalformedResponse` / `LocalTrainerFailed` / `UnknownHandle`). Same async-trait + `Arc<dyn ...>` shape that `AIProviderAdapter` in `ai/adapter.rs` uses for inference — the substrate's two model-touchpoint seams now mirror each other. Trait is object-safe; covered by a stub-adapter dyn-dispatch test. - **`registry.rs`** — `FineTuningRegistry` keyed by `provider_id`. Same pattern as the inference `AdapterRegistry`. Re-registering the same provider returns the prior entry so callers can shut it down cleanly (proven by `re_register_returns_prior` test, written to catch the "silently lying about lookup success" pattern Stage B was about removing). ### `core/continuum-core/src/genome/fine_tuning/openai_adapter.rs` First concrete adapter — proves the trait fits a real provider's shape. Implements: - `create_job` — uploads dataset as JSONL via `/v1/files` (purpose=fine-tune), then POSTs `/v1/fine_tuning/jobs`. Schedule hyperparams pass through to OpenAI's `hyperparameters` field when the caller supplied them; otherwise OpenAI picks defaults. - `poll` — GETs `/v1/fine_tuning/jobs/{id}`, maps OpenAI's status string set (`validating_files` / `queued` / `running` / `succeeded` / `failed` / `cancelled`) to typed `TrainingStatus` variants. Terminal `succeeded` builds the `TrainingArtifact` from `fine_tuned_model` + `trained_tokens`. OpenAI doesn't ship weights back; `local_path` stays `None`. - `cancel` — POSTs the cancel endpoint. Provider/error mapping is conservative: 4xx → `ProviderRejected` (don't retry without fixing the request), 5xx → `Transient` (backoff + retry is appropriate), JSON shape mismatch → `MalformedResponse`. 429 is currently mapped to `ProviderRejected` because the OpenAI docs class it as a quota / config issue, not a transient outage — pinned by test so a future flip to `Transient` is a conscious choice. ### Cargo dependency Adds `multipart` to the existing `reqwest` feature list for the `/v1/files` upload step. No new top-level dep. ## Verified cargo check -p continuum-core --lib --features metal,accelerate -> clean cargo test -p continuum-core --lib --features metal,accelerate genome::fine_tuning:: -> 22/22 The 22 tests cover: - `types`: 11 (ts-rs binding generation pinned per struct + the three hand-written invariant tests — TrainingSource snake_case, TrainingStatus tagged shape + camelCase fields, LoRA hyperparam camelCase serialization) - `adapter`: 2 (trait object-safety + end-to-end stub roundtrip through create/poll/cancel) - `registry`: 2 (lookup by provider_id + re-register returns prior) - `openai_adapter`: 4 (status mapping covers all documented states + HTTP error taxonomy + provider_id mismatch returns UnknownHandle + capabilities pin) ## What's next (Stage 2+ of #230) Each is a small, focused PR that drops into the seam this commit defines: - Mistral adapter (OpenAI-API-compatible mostly; quirk handling for Mistral's job lifecycle differences) - Anthropic adapter - Fireworks / DeepSeek / Together adapters - `LocalCandleFineTuner` — the substrate-native sibling. Uses the existing `inference/lora.rs` weight-merge math, adds the optimizer loop. This is where the matrix-dojo + teacher-synthesis doctrines actually compound — in-process training closes the loop between persona experience and persona capability without any cloud-provider hop. - Rust `genome/job-create` ServiceModule — narrow command on top of this trait; replaces the dead trigger we deleted in PR #1572. ## Doctrinal alignment - `[[teacher-synthesizes-in-academy-like-dreaming]]` — the `TrainingSource::TeacherSynthesized` variant exists specifically to mark academy-synthesized datasets distinct from raw operator corpora; substrate-side reputation can branch on this. - `[[noteworthy-flag-feeds-memory-AND-curriculum]]` — the doctrine doc in `mod.rs` names this as the upstream of the curriculum drain; this PR doesn't wire that drain yet but the `TrainingJobRequest` is shaped to accept it. - `[[matrix-dojo-layer-loading-as-substrate-primitive]]` — the `TrainingArtifact` flows directly into the existing `persona/genome_paging.rs` LRU-managed working set; no new layer in between. - `[[mesh-of-lessons-cross-persona-curricula]]` — `TrainingSource::MeshInherited` is the typed marker that the substrate can use to attribute cross-persona curriculum sharing. - `[[rust-is-the-core-node-is-the-shell]]` — the 6 TS LoRA-trainer adapters in `src/daemons/ai-provider-daemon/adapters/*/server/*FineTuningAdapter.ts` become individually deletable as each Rust adapter lands. - `[[no-fallbacks-ever]]` — every adapter method returns a typed `FineTuningError` variant. No silent skip; no `Ok(())` on a job that didn't actually start (the cautionary tale being the dead channel.rs trigger from PR #1572). - `[[every-error-is-an-opportunity-to-battle-harden]]` — the error taxonomy distinguishes retriable (`Transient`) from terminal (`ProviderRejected` / `MalformedResponse` / `LocalTrainerFailed`) so the substrate-side dispatcher branches correctly on first failure, not after a thousand burned retries. Co-Authored-By: Claude Opus 4.7 <[email protected]> * feat(genome): FineTuningCoordinator + GenomeModule + LocalCandleFineTuner skeleton — the unification Stacks on top of `feat/fine-tuning-subsystem` (which lands the trait + types + registry + OpenAI adapter). This commit wires the dispatch seam: a `genome/*` ServiceModule on top of a typed coordinator that abstracts provider selection across local / grid / cloud. Joel's framing: "Finally bringing it all together into a performant concurrent rtos abstracting provider whether local, grid or cloud." The convergence: - Inference: `AIProviderAdapter` trait, 9 cloud providers + local llamacpp + cross-grid airc-remote (#108) all behind one Arc<dyn> - Fine-tuning: `FineTuningAdapter` trait, 1 cloud impl (OpenAI) + local-candle skeleton + future cross-grid airc-remote, all behind one Arc<dyn> - Both seam into the same RTOS substrate: `ServiceModule` + `tick` + `install_executor` + `PressureBroker` + `TokioConcurrencyPolicy` - Persona never names a provider; substrate picks per request ## What lands ### `core/continuum-core/src/genome/fine_tuning/coordinator.rs` `FineTuningCoordinator` — stateless selector consulting an `Arc<FineTuningRegistry>`. Algorithm: 1. **Filter** by hard capability match: base_model prefix (empty Vec = wildcard for local Candle), `supports_lora` if request has LoRA hyperparams, `supports_validation` if dataset's validation_split > 0. 2. **Honor preferred_provider** when supplied AND capable. When the preference is registered but NOT capable for this request, return typed `PreferredUnavailable` with the diagnostic — no silent fallback to a different provider ([[no-fallbacks-ever]]). 3. **Otherwise rank by locality**: adapters with `produces_local_artifact=true` beat cloud. Tier 0 = local; tier 1 = cloud. 4. **Alphabetical tie-break** within tier. Stable, no hidden ordering. 9 unit tests cover each rule independently. The locality rule is load-bearing for the matrix-dojo doctrine — pinning it now keeps training data on-substrate when local capacity exists. ### `core/continuum-core/src/genome/fine_tuning/local_candle_adapter.rs` `LocalCandleFineTuner` — substrate-native LoRA trainer skeleton. Honest "not yet" semantics per [[no-fallbacks-ever]] + the cautionary tale of the dead `channel.rs` trigger we deleted in PR #1572: - Exists as a real registered adapter (the architectural slot is visible to the coordinator + telemetry + operator) - `create_job` returns `FineTuningError::LocalTrainerFailed` with pointers to follow-up tasks #231/#232/#233 — explicit "math not implemented" instead of fabricated success - `poll` / `cancel` correctly reject unknown handles with `UnknownHandle` instead of fabricating a `TrainingStatus` - Capabilities advertise the eventual real shape (`produces_local_artifact=true` so locality preference fires; wildcard base prefixes; LoRA + validation supported), so swapping the math in later requires no call-site changes When tasks #231-#233 land the optimizer loop, this struct fills in place. The trait + the dispatch + the boot wiring all stay. ### `core/continuum-core/src/modules/genome.rs` `GenomeModule` ServiceModule. Three commands: - `genome/job-create` — coordinator picks provider, adapter creates job. Returns `{success, result: {handle, selectedProvider}}` so callers see which provider got picked (important for telemetry + operator validation of the locality preference). - `genome/job-status` — adapter looked up by `handle.provider_id`, polls, returns typed `TrainingStatus`. - `genome/job-cancel` — same lookup, cancels. Per [[commands-are-dumb-daemons-are-smart]] the module is narrow. All errors return as `{success: false, error, errorKind}` so TS-side callers can branch on the typed `errorKind` slug (`InvalidRequest` / `MissingCredentials` / `ProviderRejected` / `Transient` / `MalformedResponse` / `LocalTrainerFailed` / `UnknownHandle`) without parsing free-form text. ### `start_server` boot wiring (`ipc/mod.rs`) Builds a `FineTuningRegistry`, conditionally registers `OpenAIFineTuningAdapter` when `OPENAI_API_KEY` is set, always registers `LocalCandleFineTuner`, then registers the `GenomeModule` backed by the populated registry. Mistral / Anthropic / Fireworks / DeepSeek / Together adapters plug in here as their impls land — same pattern, gated on the matching `*_API_KEY` secret. ### `core/continuum-core/Cargo.toml` Adds `multipart` to `reqwest` features (carried over from the stacked-below PR; OpenAI's `/v1/files` upload needs it). ## Verified cargo check -p continuum-core --lib --features metal,accelerate -> clean cargo test -p continuum-core --lib --features metal,accelerate genome::fine_tuning:: -> 34/34 modules::genome:: -> 5/5 39 new tests across the stack. Covers: trait object-safety + dyn dispatch; registry lookup + re-registration; coordinator selection rules (8 distinct invariants); OpenAI HTTP status mapping + provider slug taxonomy; ServiceModule wire shape + envelope contract + preferred-provider honoring. ## Doctrinal alignment - `[[commands-are-dumb-daemons-are-smart]]` — `GenomeModule` is narrow (validate → look up adapter → dispatch). All smart logic (capability filter, locality preference, future cost/pressure signals) lives in `FineTuningCoordinator` + the adapter impls. - `[[no-fallbacks-ever]]` — `LocalCandleFineTuner` skeleton returns typed `LocalTrainerFailed` instead of silently picking cloud or fabricating success. `PreferredUnavailable` is the typed answer to "honor my preference or tell me why you can't." - `[[matrix-dojo-layer-loading-as-substrate-primitive]]` — the coordinator's locality rank ensures training data stays on-substrate when local capacity exists. - `[[inference-is-an-adapter-always-in-the-loop]]` extended: fine- tuning is also an adapter, always in the loop. The coordinator is the substrate's typed answer to "which adapter?" - `[[rust-is-the-core-node-is-the-shell]]` — `genome/job-create` now exists as a Rust ServiceModule. The TS-side equivalent in `src/commands/genome/job-create/` is no longer authoritative; follow-up PR can delete it once Node clients route through the Rust path. ## Follow-ups (already filed) - #231: `LocalCandleFineTuner` LoRA module + autograd (math 1/3) - #232: data loader + AdamW + training loop (math 2/3) - #233: job lifecycle actor + safetensors output (math 3/3) - 5 more cloud adapters (Mistral / Anthropic / Fireworks / DeepSeek / Together) — each ~250 LOC mirroring the OpenAI pattern, slots into the existing boot wiring with a one-line registration Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…spec init + autograd (task #231) (#1575) First of three follow-ups (#231 + #232 + #233) that fill in the math layer of the LocalCandleFineTuner skeleton landed in PR #1574. This commit builds the trainable LoRA module — the substrate-native sibling to inference/lora.rs (which handles the load + merge path post-training). ## What lands core/continuum-core/src/genome/fine_tuning/lora_module.rs (~470 LOC) LoRAModule: one trainable LoRA layer wrapping a frozen base linear weight. Holds the base as a plain Tensor (no autograd) plus two trainable candle_core::Var matrices A and B. Math (matches inference/lora.rs::merge_lora_weight exactly): y = x · W^T + (alpha/rank) · (x · A^T) · B^T W: base weight [out_features, in_features] (frozen) A: down-project [rank, in_features] (trainable) B: up-project [out_features, rank] (trainable) Init policy per the LoRA paper (Hu et al. 2021): - A ~ Kaiming uniform, bound = √(1/in_features) - B = zeros This makes the initial delta exactly zero so the model behaves identically to the frozen base at step 0. Training perturbs A and B away from this fixed point. Any other init (B random, A zero) would either cause divergence from the base at init or eliminate gradient signal — the test suite pins both invariants. Typed LoRAError taxonomy: - InvalidRank(0) — would produce zero-sized A/B (no learning capacity) - InvalidAlpha(0) — would zero the scale factor (delta never affects forward) - BaseWeightShape{actual} — non-2-D base weight gets a typed error before the first forward, not an opaque Candle matmul error later ## Why a struct + forward, not impl candle_nn::Module candle_nn::Module forward signature does not carry training-vs-eval state. The optimizer + training loop (#232) needs a forward_train distinction (dropout active during training). Cleaner to compose this as a plain struct with an explicit forward now; #232 adds the training/eval variants if dropout becomes needed. ## Verified cargo check -p continuum-core --lib --features metal,accelerate -> clean cargo test -p continuum-core --lib --features metal,accelerate genome::fine_tuning::lora_module -> 8/8 The 8 tests pin every load-bearing invariant: - rank_zero_rejected: typed InvalidRank - alpha_zero_rejected: typed InvalidAlpha - non_2d_base_weight_rejected: typed BaseWeightShape - b_is_zero_initialized_so_initial_delta_is_zero: forward at init == base forward - a_init_is_non_trivial: A has non-zero values so gradient signal flows through B - forward_preserves_leading_dims_and_maps_in_to_out: shape contract on [batch, seq, in_features] -> [batch, seq, out_features] - scale_factor_matches_inference_side_convention: scale == alpha/rank, same as inference/lora.rs - forward_with_perturbed_ab_diverges_from_base_by_scaled_delta: end-to-end math integration with known A,B values producing exact expected output The shape contract test is load-bearing for the matrix-dojo doctrine: A future refactor that swaps in/out axes would silently produce wrong-shaped activations that crash downstream layers in the training loop (#232) and corrupt the safetensors output (#233). Pinning shape at the module boundary catches this at the unit-test level, not at integration-test time. The init-zero-delta test is load-bearing for convergence: the LoRA paper specifically calls out that B=0 init is what makes training stable. A future refactor that initializes B with noise would silently regress training quality. The math integration test forces A and B to known non-zero values and computes the expected output by hand — proves the implementation matches the paper formula exactly. This is the contract with inference/lora.rs::merge_lora_weight; if either side drifts, layers trained here would behave differently at inference time. ## Doctrinal alignment - [[matrix-dojo-layer-loading-as-substrate-primitive]]: the tensors produced here use the SAME layout as inference/lora.rs consumes (A: [rank, in_features], B: [out_features, rank], scale: alpha/rank). After #233 wires safetensors output, layers trained by this module load unchanged into the existing inference + paging path. - [[no-fallbacks-ever]]: rank=0, alpha=0, non-2-D base weight all return typed errors at construction. No opaque tensor errors surfacing at the first forward pass. - [[every-error-is-an-opportunity-to-battle-harden]]: the init-zero-delta test catches a class of regression (silent changes to B init policy) that would otherwise only show up as poor convergence in production training runs. ## What is next (#232 + #233) - #232: data loader (TrainingExample -> tokenized batches) + AdamW optimizer + epoch-major training loop with gradient accumulation and validation pass. Consumes LoRAModule from this PR. - #233: job lifecycle actor (in-process DashMap + watch channel) + safetensors writeout to TrainingArtifact.local_path. Closes the LocalCandleFineTuner so create_job actually starts a training run instead of returning LocalTrainerFailed. Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
… (task #232) (#1576) Math layer 2/3 of LocalCandleFineTuner. Sits on top of #231's LoRAModule and gives the substrate the trainable pipeline that #233's lifecycle actor wires into the FineTuningAdapter contract. Adds: - Tokenizer trait — substrate-side abstraction; real HF wiring lands in #233 next to the model loader. Trait isolates the data loader so it tests against a deterministic fake. - TrainingError taxonomy — EmptyDataset / InvalidBatchSize / InvalidSequenceLength / TokenizerFailed / Candle. Mirrors the FineTuningError::LocalTrainerFailed shape so #233 propagates each variant intact (per [[no-fallbacks-ever]]). - TokenizedExample + TokenizedBatch — typed tokenization output; batches carry inputs + targets + attention_mask in fixed [batch_size, sequence_length] shape. - DataLoader — pre-tokenizes the full dataset, pads / truncates to sequence_length + 1, builds [batch_size, seq_len] tensors, drops partial last batch. The dead channel.rs trigger #1572 deleted used to fire with insufficient validation; the loader's constructor is the contract that catches "no examples" / "0 batch_size" / "0 seq_length" at the boundary instead of as opaque tensor errors. - LoRATrainer — wraps the LoRAModule + candle_nn::AdamW + cross_entropy. Only A and B are passed to the optimizer (base weight stays frozen — its gradient is never computed, saving memory + compute). - TrainingMetrics — steps_completed / epochs_completed / last_train_loss / last_epoch_avg_loss. Cheap to clone; #233's lifecycle actor reads this periodically to publish TrainingStatus::Running via a watch channel. Stand-in vs production wiring (deferred to #233): - Inputs cast U32 to F32 instead of going through an embedding table - Targets use first-column-per-sample for cross-entropy instead of flattened [batch * seq] over a [batch * seq, vocab] logits tensor - The optimizer + cross-entropy + backward shape stays identical; the swap is local to forward shaping + target shaping, so the layer loops back through inference/lora.rs without glue. Tests (8 in genome::fine_tuning::training_loop): - empty_dataset_rejected — typed EmptyDataset at boundary - zero_batch_size_rejected — typed InvalidBatchSize - zero_seq_length_rejected — typed InvalidSequenceLength - batches_have_shape_batch_size_x_seq_len — tensor shape contract - attention_mask_is_1_for_real_0_for_pad — polarity invariant - partial_last_batch_is_dropped — batch-size invariant for loss aggregation - adamw_step_moves_lora_parameters — the load-bearing test; verifies gradient signal flows through A. A future refactor that mis-collects Vars (e.g. passes base_weight to AdamW) would silently freeze the LoRA — this catches it immediately. - metrics_count_steps_and_epochs — counter advancement contract Doctrinal alignment: - [[no-fallbacks-ever]] — every loader / trainer entry returns a typed error; no silent rejection - [[matrix-dojo-layer-loading-as-substrate-primitive]] — output Vars stay in the same layout as the inference-side LoRAWeights, so trained layers loop back through inference/lora.rs unmodified Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jul 27, 2026
…l) — B-gate evidence + 4 adoptions (#232) (#2044) Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Aug 15, 2026
…he elastic window (#232) Adds SERVING_KV_CACHE_TYPE (config, default f16/off): when set to q8_0 (or q4_0) the llama-server lane runs --cache-type-k/v <type>, cutting resident KV ~in half at near-lossless quality. That frees memory the elastic window (#234) can spend on a bigger context or more warm lanes — faster for multiple personas AND more room for hard coding, the same "faster + best code" pair. OFF by default and safe-by-construction: absent / f16 → byte-identical f16 launch (no behavior change), so this can't destabilize a backend whose build lacks Metal KV-quant kernels — enabling it is an explicit operator opt-in, never a blind assumption ([[verify-real-device-numbers-not-a-clamp-premise]]). Follow-up (noted in code): to have the PLAN grow the window on the freed memory rather than leave it as extra headroom, footprint_for must scale kv_per_token by the quant factor. This slice is the safe enablement; that fit-math coupling is the next step, and wants a live burst on a KV-quant-capable backend to validate quality + the speedup. continuum-core lib compiles clean. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Aug 15, 2026
…d KV memory (#232) Completes the KV-quant feature. The launcher flag (prior commit) makes a lane run q8_0 KV; this makes the PLAN know it: footprint_for scales kv_per_token by the quant divisor, so the served window is sized against the KV the lane WILL actually hold, and the elastic window (#234) grows into the freed memory instead of leaving it idle. - kv_divisor_for (pure, env-free, unit-tested): f16/unset/unknown → 1 (no change), q8_0 → 2, q4_0/q4_1 → 3. CONSERVATIVE by design — under the ideal ~3.5x for q4 — so the plan can never over-grow the window past the real KV and OOM (over-reserve = smaller window = safe). - Applied only in the config-aware footprint_for; footprint_from_parts stays pure so its tests are env-independent. Same SERVING_KV_CACHE_TYPE key as the launcher — one config, two consumers (flag + fit rate), documented to stay in sync. Default (f16 / unset) → divisor 1 → byte-identical: this can't change serving on a box that doesn't opt in. Test pins the mapping + the safe-default. Wants a live burst on a KV-quant-capable backend to confirm quality + the actual window growth. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Aug 15, 2026
…memory (#232) The fused attention kernel is faster on BOTH prefill and decode and lowers peak memory — directly attacking the prefill-bound turn latency (#139) and freeing room the elastic window (#234) can spend. SERVING_FLASH_ATTN=1|on|true adds --flash-attn to the lane; absent → llama.cpp default (no flag), byte-identical. OFF by default: Metal/backend flash-attn support + quality vary by build, so it's an operator opt-in, never a blind assumption ([[verify-real-device-numbers-not-a-clamp-premise]]). Composes with the KV-quant flag: enable both for the field-proven GLM-style speedup, then validate on a live burst. continuum-core lib compiles clean. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Aug 15, 2026
… rescued onto canary (#2244) * feat(serving): opt-in KV cache quantization — q8_0 halves KV, feeds the elastic window (#232) Adds SERVING_KV_CACHE_TYPE (config, default f16/off): when set to q8_0 (or q4_0) the llama-server lane runs --cache-type-k/v <type>, cutting resident KV ~in half at near-lossless quality. That frees memory the elastic window (#234) can spend on a bigger context or more warm lanes — faster for multiple personas AND more room for hard coding, the same "faster + best code" pair. OFF by default and safe-by-construction: absent / f16 → byte-identical f16 launch (no behavior change), so this can't destabilize a backend whose build lacks Metal KV-quant kernels — enabling it is an explicit operator opt-in, never a blind assumption ([[verify-real-device-numbers-not-a-clamp-premise]]). Follow-up (noted in code): to have the PLAN grow the window on the freed memory rather than leave it as extra headroom, footprint_for must scale kv_per_token by the quant factor. This slice is the safe enablement; that fit-math coupling is the next step, and wants a live burst on a KV-quant-capable backend to validate quality + the speedup. continuum-core lib compiles clean. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(serving): KV-quant fit coupling — the window GROWS into the freed KV memory (#232) Completes the KV-quant feature. The launcher flag (prior commit) makes a lane run q8_0 KV; this makes the PLAN know it: footprint_for scales kv_per_token by the quant divisor, so the served window is sized against the KV the lane WILL actually hold, and the elastic window (#234) grows into the freed memory instead of leaving it idle. - kv_divisor_for (pure, env-free, unit-tested): f16/unset/unknown → 1 (no change), q8_0 → 2, q4_0/q4_1 → 3. CONSERVATIVE by design — under the ideal ~3.5x for q4 — so the plan can never over-grow the window past the real KV and OOM (over-reserve = smaller window = safe). - Applied only in the config-aware footprint_for; footprint_from_parts stays pure so its tests are env-independent. Same SERVING_KV_CACHE_TYPE key as the launcher — one config, two consumers (flag + fit rate), documented to stay in sync. Default (f16 / unset) → divisor 1 → byte-identical: this can't change serving on a box that doesn't opt in. Test pins the mapping + the safe-default. Wants a live burst on a KV-quant-capable backend to confirm quality + the actual window growth. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(serving): opt-in flash attention — faster prefill+decode, lower memory (#232) The fused attention kernel is faster on BOTH prefill and decode and lowers peak memory — directly attacking the prefill-bound turn latency (#139) and freeing room the elastic window (#234) can spend. SERVING_FLASH_ATTN=1|on|true adds --flash-attn to the lane; absent → llama.cpp default (no flag), byte-identical. OFF by default: Metal/backend flash-attn support + quality vary by build, so it's an operator opt-in, never a blind assumption ([[verify-real-device-numbers-not-a-clamp-premise]]). Composes with the KV-quant flag: enable both for the field-proven GLM-style speedup, then validate on a live burst. continuum-core lib compiles clean. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Aug 22, 2026
…he incumbent at identical conditions (Joel: "Swap it for sure") (#2361) Same-day tier battery, this M5, solo lane, identical flags (fa on, q8 KV, ub 2048): prefill 4k 896 t/s vs Qwen3.8-27B 133 (6.7x) prefill @16k 532 t/s vs 106 (5.0x) decode 68 t/s vs 13.6 (5.0x) tools 8/8 native calls, valid args, median 1.2s/turn vision mmproj red-square PASS template caps native tools + parallel calls + preserved reasoning MoE 35B / 3B ACTIVE (256 experts): the serving economics are the product. MIT. NO MTP head — deliberate non-issue: MTP is a crutch for slow dense decode and A3B's raw rate exceeds the incumbent's MTP-assisted one; sibling resolvers add no --spec-type when no mtp-* exists (battery-verified: the flag crashes it). capability_rank derives from weights-GB (+tool bonus), so the planner adopts it via the strictly-more-capable upgrade path at the next plan; citizens bind to the served base automatically ("one base model, N persona lanes"). Genome and engrams are model-independent — every citizen keeps her whole mind. The incumbent keeps its row: One-Spark says it wins Safety/Robustness/Planning, the sliding-mind pairing when model-tier leasing lands. Receipts: ~/.continuum/bench-receipts/tier-battery-{ornith,qwen}.md Known pre-existing (NOT this change; reproduced on clean canary): serving_footprint_fn_resolves_live_catalog_weights fails under metal features — resolve side applies #232 KV-quant scaling, the test expectation does not. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 21, 2026
…lanned from (card d0ba2342) `plan_serving_at_rest` and `plan_serving_stable` differ by exactly ONE engine footprint: at_rest trusts that the ledger has already credited serving's own bytes back, stable credits them here. The selector is a board attribution — so which arm ran is observable, and nothing said so, which meant it was being inferred. Measured on the M5, 2026-09-21: the engine held a SETTLED 3 lanes at 78,592 (geometry settled at 07:16 / 07:19 / 07:22 and again after a reboot) while the plan said 1 (`bound_by=host-fit`, `demand_lanes=2`), one lane of KV costing 2.4 GiB against 13.9 GiB available. The grid offers the PLAN's lane count, so 6 minds sat dormant on engines that had the lanes for them. Two confident explanations were proposed and BOTH were refuted by reading the guards that prevent them — the plan charging f16 while the engine serves q8_0 (`apply_kv_quantization`, #232; live `kv_per_token` 32,768 = header 65,536 / 2), and the weights being charged against a budget that already excluded the running engine (the credit-back-exactly-once ledger, whose own comment cites the 5090 relaunching three times mid-solve on 2026-09-17). Each was killed by the guard the other party assumed was missing. After that, the honest next step was not a third hypothesis but a measurement. This is measurement only — no behaviour change, no lane touched. It names the arm, the `ledger_credited` selector and the attributed bytes behind it, the budget that arm planned from, and the lanes/window it produced. When the plan and the running engine disagree about how many lanes fit, this is the first line to read. Said once per CHANGE of those inputs via `say_on_change`, never per 5-second tick — the same law the prompt-cache divergence receipt in this file follows, and for the same reason: a three-hour condition must not become 2,160 identical rows. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Sep 21, 2026
…cision wants (#4298) * fix(serving): say when the engine holds less prompt cache than the decision wants — 480 MiB against 41k-token prompts, reuse 0%, invisible until someone read argv by hand `--cache-ram` is passed ONCE at spawn and is immutable for the engine's life. The derived target is re-computed every tick. So a transient trough at the instant of launch becomes PERMANENT until something unrelated relaunches the lane. Measured on the M5, 2026-09-21, at q8_0's 32,768 bytes/token: 480 MiB = 15,360 tokens what pid 33898 HOLDS (spawned 05:13:22Z) 2,517 MiB = 80,544 tokens what the substrate now derives as affordable 5,926 MiB = 189,632 tokens what the PREVIOUS engine got (03:51:16Z) Deliberation prompts that hour measured 22,612-41,547 tokens, so the running cache held 37-68% of ONE prefix. Six of the last eight prefills reported `cached=0`. A peer's hour line: `prefix reuse 0% (4k cached / 574k prefilled)`, directed wait p50 211s / p90 347s. Every turn pays full prefill, which is the gate on a team that can review in minutes. At 05:13:22Z the derivation sat in a trough (3 lanes x 78k = 235k total ctx, so the KV estimate ate the budget) and the engine has held that number for three hours while the target recovered fivefold. A shrink-only ratchet across a spawn, the same family as a record saved on spawn instead of on settle. This ships the MEASUREMENT, not the relaunch. The relaunch is card ab27b914 — a fifth sibling beside the window / lane / sight / KV grow-backs in `ensure_serving`. A probe changes no live lane; a lane relaunch is the most dangerous change this daemon makes, and it wants a machine that can build and test it. Measurement first, on purpose. - `serving.prompt_cache.divergence` fires when the running grant is below the target, carrying both numbers, the shortfall and the ratio. `serving.prompt_cache.launch` already records `applied_mib="unobserved"` honestly — the engine API does not expose what it applied, and inventing a readback would be worse. But BOTH numbers in this divergence are ours: the grant we passed and the target we now want. Nothing compared them, so the gap was invisible until I read the engine's argv by hand. - `lane_args::one_conversation_bytes` extracted from the inline floor in `host_prompt_cache_mib`, because a second consumer needs the same answer: the sizing decision asks at SPAWN, and "is the grant this engine is still holding big enough?" has to be asked of a RUNNING engine too. Two places deciding "is this cache big enough" with two derivations is how 480 MiB became invisible. The test pins the predicate with the real measured prompts: one conversation is the LARGEST (1,298 MiB), never the sum; 480 MiB is below it, so reuse is not poor but impossible; the affordability clamp still wins at spawn and CAN land under one conversation, which is exactly when a relaunch must arm once the ceiling lifts. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the divergence receipt speaks on CHANGE and names WHICH fact — Cormac's two findings on #4298 1. IT FIRED EVERY TICK. The probe sits on the 5-second ready path, and the M5 gap lasted three hours — ~2,160 identical lines carrying the same two numbers. A rising count that is not rising evidence, drowning the ledger the card asks a reader to open. It now speaks when the divergence APPEARS, when either number MOVES, and once when it CLOSES (`serving.prompt_cache.divergence_closed`, carrying what it was), mirroring the sizing receipt's own `LAST_SPOKEN` cell — including keying by MODEL, so a model switch that happens to produce the same pair still owes a receipt. 2. ONE VALUE, TWO MEANINGS — in the PR that exists to expose that shape. The predicate was `wanted > held`, which is ANY shortfall, 1 MiB included, while the message claimed "a grant below ONE conversation makes prefix reuse structurally impossible". Different facts, and `shortfall_mib` could not tell a reader which they were looking at. Worse, the commit extracted `one_conversation_bytes` "because a second consumer needs the same answer" and then that consumer never called it. `PromptCacheDecision` now carries `one_conversation_mib`, computed from the extracted function, and `derived_prompt_cache_mib` returns a `PromptCacheGrant` so the one caller that builds a `ServingTarget` gets both numbers from the same decision. The probe carries `one_conversation_mib` and `below_one_conversation`, and the sizing receipt carries it too. The relaunch (card ab27b914) inherits the exact predicate the test pins instead of growing a third derivation. `say_on_change` is extracted so the edge behaviour is pinned by a test rather than only by the live ledger: quiet stays quiet, appearing speaks, 2,160 identical ticks speak once, a moved target speaks again with the old numbers, a model switch on identical numbers speaks, closing speaks once and then silence. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * feat(serving): say WHICH planning arm produced the plan and what it planned from (card d0ba2342) `plan_serving_at_rest` and `plan_serving_stable` differ by exactly ONE engine footprint: at_rest trusts that the ledger has already credited serving's own bytes back, stable credits them here. The selector is a board attribution — so which arm ran is observable, and nothing said so, which meant it was being inferred. Measured on the M5, 2026-09-21: the engine held a SETTLED 3 lanes at 78,592 (geometry settled at 07:16 / 07:19 / 07:22 and again after a reboot) while the plan said 1 (`bound_by=host-fit`, `demand_lanes=2`), one lane of KV costing 2.4 GiB against 13.9 GiB available. The grid offers the PLAN's lane count, so 6 minds sat dormant on engines that had the lanes for them. Two confident explanations were proposed and BOTH were refuted by reading the guards that prevent them — the plan charging f16 while the engine serves q8_0 (`apply_kv_quantization`, #232; live `kv_per_token` 32,768 = header 65,536 / 2), and the weights being charged against a budget that already excluded the running engine (the credit-back-exactly-once ledger, whose own comment cites the 5090 relaunching three times mid-solve on 2026-09-17). Each was killed by the guard the other party assumed was missing. After that, the honest next step was not a third hypothesis but a measurement. This is measurement only — no behaviour change, no lane touched. It names the arm, the `ledger_credited` selector and the attributed bytes behind it, the budget that arm planned from, and the lanes/window it produced. When the plan and the running engine disagree about how many lanes fit, this is the first line to read. Said once per CHANGE of those inputs via `say_on_change`, never per 5-second tick — the same law the prompt-cache divergence receipt in this file follows, and for the same reason: a three-hour condition must not become 2,160 identical rows. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): key the plan-branch receipt on the DECISION, not on a budget that moves every tick Cormac on #4298: `serving.plan.branch` used `say_on_change` — the once-per-state cell the other half of this PR introduces — and then keyed it on `budget.usable_bytes`. That value moves every tick as the governed board re-reads available memory, so the key changed on every pass and the receipt fired every 5 seconds. A "once per change" probe that fires per tick is precisely the shape this PR exists to delete, reintroduced by the commit that was supposed to follow the rule. The key is the DECISION: which arm produced the plan (`ledger_credited`) and what it produced (lanes, window). The budget is CONTEXT for reading that decision and rides as fields — `usable_bytes`, `credited_bytes`, `perf_cores` are all still in the row. A budget that drifts while the arm and the plan hold steady is not a new fact about the planner, and the whole point of the receipt is to say when the PLANNER changed its mind. Caught in review before it ever ran. The first draft would have produced one identical row every 5 seconds for as long as a geometry held — on the M5 that is ~720 rows an hour saying the same thing, drowning the ledger the card asks a reader to open. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed the 'Built in Collaboration With' section detailing contributors and infrastructure.
Summary
Brief description of changes and why they're needed
Change Type & Scale
Scale:
Testing & Verification
npm run lintpassesnpm testpassespython python-client/ai-portal.py --cmd testsAI Development Notes
Status & Readiness
Known Issues: (if any)
Files Changed
List key files and why they changed
Related Issues
Fixes #(issue) or Relates to #(issue)
For AI Agents: Use
python python-client/ai-portal.py --dashboardto verify system health after merging