Skip to content

predict: require an explicit activation in the model header instead of assuming ReLU #47

Description

@vyncint

Todaypredict rebuilds an oxmera::nn::Sequential from 0.weight, 1.weight, … tensor names and assumes ReLU between layers (crates/oxidelake-compute/src/predict.rs, ModelSpec has one variant; ADR-0015 records the assumption; README §"In-database inference" says "with ReLU between them"). The SQL surface predict('scorer.safetensors', emb) gives the user no way to state or learn the activation. The code's own comment says a model whose activations differ "will silently produce wrong numbers".

Why it is worth fixing — a feature whose documented failure mode is silent wrong output is not production-ready however honestly the ADR labels it.

Fix — read the activation from the safetensors __metadata__ header ({"oxidelake.activation": "relu" | "gelu" | "sigmoid" | "none"}), refuse files without the key with an error that names the key and how to add it (oxmera's nn::serialize::save can write it), and optionally accept a third literal argument predict(path, features, 'relu') that must agree with the header. Extend the predict lane tests with a GELU model and a header-less file.

Done when — a header-less model is refused with a message naming the fix; the two-activation test passes in the predict lane.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions