DocumentationArchitecture
SaveWeights
A zoomed-in view of one operation in Piro’s stateful inference loop.
Architecture detail
SaveWeights
Writes consolidated durable snapshots without rewriting unchanged durable components; external state storage is outside this model method.
SaveWeights(weights: changed = DiffAgainstLoadedManifest(weights) if changed is empty: return NoOp("nothing changed") revision = ReadCurrentRevision() + 1 for each group in changed: if group.owner == "plasticity.fastOverlay": component = Encode(group, format = BF16, scales = BF16) else if group.owner == "durable.base": component = Quantize(group, format = INT4, scales = BF16) else: component = Encode(group, format = BF16) R2Put("models/{modelId}/weights/revisions/{revision}/" + component.name, component.bytes) manifest = BuildManifest(revision, changed, parentRevision) R2Put("models/{modelId}/weights/revisions/{revision}/manifest.json", manifest) R2Put("models/{modelId}/weights/current/manifest.json", manifest) return revisionWhat it does
Diffs the active runtime object against the loaded manifest, encodes changed fast overlays as BF16, encodes dynamic state as BF16, re-quantizes durable base changes as INT4 only during consolidation, and publishes a versioned R2 manifest. Multipart upload is available for large or resumable component transfers.
Why it exists
Plasticity should not rewrite the ~230M-parameter base object on every interaction; R2's storage capacity is not the constraint here, while write volume and operation cost are.