Skip to content

Alpha updates can truncate persisted steering vectors when models are unloaded #6

Description

@blacks1ne

Summary

Changing steering-vector alpha while its model is unloaded can overwrite a persisted vector as a one-element vector.

Evidence

MemoryStore::user_vector_load(name, hidden_size) reads the saved blobs but ignores the stored hidden_size column and pads/truncates them to the caller-provided size.

  • user_vector_set_alpha uses size 1 when no LLM is loaded, then saves the returned state.
  • user_vector_set_alpha_named first loads at size 1, observes a reported hidden_size of 1, loads again at that size, then saves.

Moving an alpha slider can therefore destroy a learned LLM, 768-dimensional SD 1.5, or 2048-dimensional SDXL vector.

Proposed resolution

  • Add a load-existing API that reads and validates the persisted dimension.
  • Represent the caller's expected dimension as optional validation, not a replacement dimension.
  • Refuse model-dimension mismatches unless an explicit migration/reset is requested.

Acceptance criteria

  • Alpha/status operations with an unloaded engine preserve every vector element.
  • Tests cover persisted 768-, 2048-, and arbitrary LLM-hidden-size vectors.
  • A cross-model dimension mismatch returns a clear error or follows a documented migration path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions