Skip to content

[SKEEP-008]: Precision and encoding conversion #1433

Open

Description

@michalharakal

Proposal document: docs/modules/skeep/pages/008-precision-and-encoding-conversion.adoc (#1434)
Status: Draft
Branch: feature/skeep-008-precision-and-encoding-conversion

Trigger

Public Kotlin API (NeuralNetworkDsl members, TensorStorage) · DSL syntax/semantics (what a layer's dtype means, where a cast happens) · compatibility/migration policy (removing members that always threw, rules for precision loss).

Summary

Two public entry points promise to change a tensor's numeric form and do not work:

  • Mixed precision in the DSL. dense<TLayer>(…) ×2 and stage<TStage>(…) are TODO() in both NeuralNetworkDslImpl and StageImpl. That's the six stubs allowlisted in config/stub-allowlist.txt. They can't be implemented as declared, because a type parameter on an interface method can't be reified, so the implementation never gets the layer's KClass.
  • Encoding change after load. TensorStorage.repackTo throws for every encoding change.

The proposal:

  • takes the dtype as a value (dense(64, dtype = FP16), stage("head", dtype = BF16)) behind one PrecisionBoundary module, using the existing TensorOps.convert, which is traced and lowers to stablehlo.convert;
  • keeps repackTo lossless and adds an explicit, lossy requantizeTo on top of the existing Requantizers registry, so it accepts the same encodings as loader quantize-at-load;
  • retires the unused MixedPrecisionModule / InternalMixedPrecisionModule / MixedPrecisionTensorOps scaffold.

Related DARC features

Sub-issues

Filed once the proposal is Accepted, one per rollout phase:

  • B1 lossless repackTo + requantizeTo
  • A1 DSL PrecisionBoundary, inference only
  • A2 export test (stablehlo.convert at boundaries)
  • A3 convert becomes @Diff
  • A4 removal of the deprecated overloads and scaffold

Status upkeep

  • Proposal registered in docs/modules/skeep/nav.adoc and the "Current Proposals" table
  • Maintainer moved status to Accepted
  • Implementation PR(s) linked here and flipped the proposal's Status: to Implemented

Activity

  1. added
    trackingParent/tracking issue with sub-issues
    skeepSKEEP proposal tracking issue (durable design record)
    on Oct 21, 2026
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

    skeepSKEEP proposal tracking issue (durable design record)trackingParent/tracking issue with sub-issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions