Skip to content

fix(codec): decode Arrow float16 values for NumPy and Torch #332

Closed

Description

@bbopen

Arrow float16 payloads currently return storage bits as numeric values.

Reproduced on 6b84614: fixtures.library_torture.numpy_float16() returns [15872, 49280] through NodeBridge, although Python returns [1.5, -2.25]. The Torch fixture returns the same wrong data.

See the decoder and existing NumPy and Torch rows.

Acceptance criteria:

  • Decode half-float storage by dtype before reshape and numeric validation.
  • NumPy and Torch return the original finite numeric values through Arrow.
  • Cover signed zero, subnormals, normal values, finite extrema, scalars, and multidimensional arrays.
  • Non-finite values follow the documented rejection policy after conversion.
  • The shared ndarray path handles nested Torch payloads and container composition.
  • Preserve JSON fallback, Arrow int64, and existing bfloat16 upcast behavior.
  • Both affected menagerie rows become EXPECTED_OK.
  • Real NodeBridge tests and relevant performance gates pass with pinned scientific dependencies.

Preserve the envelope format, shape, and provenance. Avoid a general codec rewrite.

Architectural approach:

Implement float16 semantics through the shared ndarray conversion in #343 so Torch reuses the same rule. Use the independent numeric cases in #344. Coordinate through #345.

Activity

  1. added this to the Next milestone on Sep 11, 2026
  2. self-assigned this
    on Sep 11, 2026
  3. added
    bugSomething isn't working
    area:codecArea: codecs and serialization
    on Sep 11, 2026
  4. bbopen commented on Sep 20, 2026

    @bbopen
    OwnerAuthor

    Arrow float16 payloads now decode as numeric half-precision values before reshape. Coverage includes NumPy and actual analyzed Torch wrappers, signed zero, subnormals, finite extrema, multidimensional and nested results, and non-finite rejection. The independent oracle compares every finite binary16 word with Python struct.unpack. JSON, int64, and bfloat16 controls remain separate.

    Evidence: src/utils/codec.ts, test/architecture_numeric_oracle.test.ts, test/value_contracts.test.ts, and test/menagerie/torch_callable.test.ts.

    Verified release evidence:

    The architecture decision records the accepted scope and prototype limits.

    Closing with the implemented and verified 0.11 release outcome.

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

Metadata

Metadata

Assignees

Labels

area:codecArea: codecs and serializationbugSomething isn't workingpriority:p1Priority P1 (high)

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions