feat(weights): WeightUpdater trait + stub + feature-gated Candle LoRA (#139) - #159
Merged
Merged
Conversation
…ndle LoRA (#139) Unblock the harness-vs-weight SIA loop by making real weight updates representable while keeping the default/llm builds and CI dependency-free. - WeightUpdater trait now has two backends: - StubWeightUpdater (default build): a type alias for the existing dependency-free CPU reference LoRA. Keeps the weight_update.json shape stable (updater = "lora-reference-cpu"), so tests/web_api.rs is unaffected. - CandleLoRAWeightUpdater (behind non-default `weight-updates` feature): a documented, TODO-marked native-Rust LoRA skeleton on candle-core / candle-nn. candle-* are declared optional and only pulled by the feature, so default + llm builds and CI never fetch/compile them. - closed_loop.rs uses StubWeightUpdater (one-line backend swap point). - Offline unit tests: stub == CPU reference + learns, WeightUpdater trait-object dispatch, and a feature-gated Candle skeleton contract test. Gate: fmt, clippy (default + llm), cargo test (default + llm), and the cross-language parity check all pass; offline default/llm builds verified. https://claude.ai/code/session_01WX3ZN9azxr1fyWuZAaRJ7Y
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.
Addresses #139 (and unblocks #91): formalizes the weight-update path with the standard feature-flag pattern so the harness-vs-weight loop works in the default build while a real Candle LoRA path is cleanly feature-gated (candle isn't in the offline cargo cache, so CI never builds it).
Default build (always compiled):
WeightUpdatertrait with two implementors;StubWeightUpdateraliases the existing dependency-free CPU-reference LoRA (name() == "lora-reference-cpu"), so theweight_update.jsonartifact shape is unchanged andtests/web_api.rsstill passes. Scheduler harness-vs-weight decision + closed loop run with zero heavy deps.src/closed_loop.rsconstructsStubWeightUpdater(one-line backend swap point).Feature-gated
weight-updates(NOT built in CI):CandleLoRAWeightUpdateroncandle-core/candle-nn: a compiling, documented skeleton implementing the same trait;update()is panic-free and honestly reports "training not yet implemented" rather than fabricating a loss curve.TODO(#139)markers list the real path (device selection, frozen-base forward + LoRA vars, tokenization, reward-weighted AdamW, safetensors).Cargo.toml: candle depsoptional = true+ non-defaultweight-updatesfeature. Verifiedcargo build --offlineand--offline --features llmboth succeed (candle only fetched when the feature is explicitly enabled).Gate green: fmt/clippy/test (default +
--features llm) + parity OK.https://claude.ai/code/session_01WX3ZN9azxr1fyWuZAaRJ7Y
Generated by Claude Code