Hi Russell,

Thanks for collecting and structuring all this information. And yes, I am
having a wonderful day :D

One small correction on physical storage: with Parquet byte-stream split
encoding, the difference can be somewhat larger in favor of float16. In my
benchmark, float16 was approximately 10% smaller [1]. The result is
dataset- and configuration-dependent, and is still far from the
uncompressed 2x difference, but I would not conclude that the storage gain
is always negligible.

Given the vector type is primarily motivated by fixed-length vectors in
AI/ML workloads, I think we should evaluate the options from that
perspective.
When I look at type support needed for AI workloads, my first reference
point is Lance which supports both float16 and int8 [2]. My other reference
point is the pgvector which also supports half-precision vectors through
halfvec [3]. From the Microsoft side, Azure SQL Database, Azure SQL Managed
Instance, SQL database in Microsoft Fabric, and SQL Server 2025 all support
float16 as an explicit base type [4].

We are actively working on adding Iceberg to our stack. The engines in that
stack support float16, and many of our AI vectors currently use float16 or
int8, so I have a slight bias here.

Wearing only my Apache hat:
*  - No float16 or int8 in v4*
      - Engines with native support for narrow vectors would not be able to
use Iceberg as the authoritative representation without additional
conversion or maintaining a separate Iceberg copy. That pushes users toward
data duplication.

*  - Float16 as an allowed storage type for Float*
      - This provides a physical optimization, but the Iceberg schema would
not communicate the narrower representation. Engines would need
non-standard conventions such as catalog labels, machine readable table
properties or field comments. With additional table-level aggregation,
min/max statistics can tell us whether current values fit within the int8
range. For float16, they cannot tell us whether values are exactly
representable.

*  - Separate Vector Element Types*
      - This covers the main AI use cases because these workloads generally
operate on vectors rather than on individual elements. It also leaves room
for additional vector representations later. My only concern is that the
logical element-type model should remain independent of Parquet, even if
the initial implementation uses Parquet annotations. This is my preferred
V4 option.

*  - Full Types for Float16 and Int8*
      - There is a chicken-and-egg problem in waiting for broad engine
support before adding the types to the table format. Nevertheless, I agree
that requiring general-purpose support for both types in V4 may be
premature.

For these reasons, *I prefer adding separate float16 and int8 vector
element types in V4*, while postponing the decision about making them
general-purpose Iceberg primitive types.

Thanks,
Peter

[1] BSS encoding results:
https://lists.apache.org/thread.html/4bwf1khhjnt4t2vgon5qxrvz8bbcg559
[2] Lance data types: https://lance.org/guide/data_types/
[3] pgvector half-precision vectors:
https://github.com/pgvector/pgvector#halfvec-type
[4] Half-precision float support in the SQL vector data type:
https://learn.microsoft.com/en-us/sql/t-sql/data-types/vector-data-type-half-precision-float



Russell Spitzer <[email protected]> ezt írta (időpont: 2026. nov.
18., Sze, 4:56):

> *Background*
>
> The v4 vector type, vector(E, D), stores fixed-length numeric arrays such
> as embeddings.
>  E is the element type and D is the dimension. A list can hold the same
> values today, but
> it gives no guarantees about them. A vector guarantees that every non-null
> value has
> exactly D elements, and that every element is non-null and finite. Writers
> enforce these
> rules, so readers and engines can rely on them.
>
> The proposed element types are int, long, float, and double. These are
> existing Iceberg
> primitives so the change is very straightforward. However, we've had
> requests for new
> types currently not represented in Iceberg, specifically float16 and int8.
> We've had a lot of
> discussion about the "how" we could add such types but not enough
> discussion of "why" and "why now."
>
>
> *My main focus now is finishing V4. If we can't reach consensus after this
> much discussion, I think the only real option is to push this to V5.*
>
> I think there are basically 3 different answers to the "Why" for the new
> types
>
>   - Physical Storage
>       - Gain: Fewer bytes on disk and over the network
>       - Needs: An encoding that does not store 16 bits of padding per value
>   - Performance
>       - Gain: Less memory, faster scans, faster distance computation
>       - Needs: The width in the schema, and an engine with native float16
> memory and compute
>   - Validation
>       - Gain: A guarantee that every value fits in the type
>       - Needs: The width in the schema, and writers that enforce it
>
>
> *Physical storage*
> The storage question is this: if the data is already float16, how much
> space do we lose when we store it as float?
>
> I measured this on five public embedding sets: OpenAI 1536d and 1024d,
> Cohere Wikipedia 768d and 1024d,
> and GloVe 200d (chart and data
> <https://gist.github.com/RussellSpitzer/d571e3bd5db91b964f021cfcf94f2112>;
> I got the datasets from Raincloud <https://github.com/spiraldb/raincloud>).
> All values were float16 values. I stored each set as float and as FLOAT16.
>
> Storing float16-valued vectors as float32 doubles their size uncompressed
> (32 vs 16 bits per value),
> but with dictionary encoding and zstd the float32 column comes to about
> 15.0 bits per value against 14.7–14.8 for FLOAT16, roughly 2% larger.
>
> With dictionary encoding, float loses almost nothing. The float16 data I
> tested has only 25,000 to 35,000 distinct values,
> so each value becomes a 15-bit dictionary ID. Even in the worst case,
> there are only about 64,000 distinct float16 values,
> which would need just 16-bit dictionary IDs.
>
> Peter Vary's synthetic benchmark agrees (results
> <https://lists.apache.org/thread/p41hstcw9r702zo9k94qzn67foxbbnzk>). His
> values were also float16, and dictionary encoding
>  gave about 15.1 bits per value for both float and FLOAT16.
>
> Allowing FLOAT16 as storage for vector(float, D) saves about 2% over a
> dictionary-encoded float column. So there is really nothing to gain here.
> INT8 is stored as Int32 physical type in Parquet, so there is no encoding
> difference between Int8 and In32 data.
>
> *Performance*
>
> If the schema declares float16, a compatible engine can theoretically hold
> each element in
> 2 bytes instead of 4, although this too depends on the engine's memory
> representation. We can imagine
>  engines that use different in-memory representations, or representations
> with some kind of internal encoding.
>
> The engine must still know the width/shape before it reads data.
> It sizes buffers and chooses compute kernels when it plans the query. So
> the width must be available at planning time.
>
> An engine that decodes float16 to float32 gets none of this gain. An
> engine that uses an alternative memory
> layout may not benefit either. The gain is also specific to chip
> architectures that support SIMD on half-width types.
> From my research none of Iceberg's currently supported engines could take
> advantage of this now but if someone
> has other targets please let me know.
>
> In our discussions, we also heard that some cutting-edge work needs the
> vector type presented to the engine
> as a byte array (there are many possible non-list like layouts), in order
> to use custom distance metric implementations and similar techniques.
> This is basically out of scope for our discussion since that's basically
> just Binary and not a well defined type in our system.
>
> *Validation*
>
> A float16 element type also restricts the values a vector can hold. Every
> element must be exactly
> representable as IEEE 754 binary16. That limits magnitude to 65,504 and
> precision to about three decimal digits.
>  Writers would enforce this, as they enforce the dimension and finite
> values today.
>
> A reader can narrow every value to float16 with no loss. A writer that
> produces out-of-range values fails at write time,
> not at read time. The vector type adds the same kind of guarantee for
> length and finite values.
>
>
> *Our Choices*
>
> Regarding the 'Why,' it definitely seems like both Performance and
> Validation are honest concerns. The question of
> "Why Now" seems to be on a bit weaker ground. The Performance argument
> will rely on future work in downstream engines
> and as I noted may not match the performance requirements of other layouts
> or other usecases in the future. Validation
> though seems to be a honest requirement for the moment.
>
> Secret Human Note: For all the human readers who got this far, I hope you
> are having a wonderful day.
>
>
> *Given this I think we have the following options:*
> *  - No float16 or int8 in v4*
>       - We currently lack sufficient information on engines which actually
> want to take advantage of this data type. We may be putting the cart before
> the horse here without relevant demand. Revisit in v5, when more engines
> may have native float16 support. If we don't have consensus on any of the
> other options we pick this by default.
>
> *  - Float16 as an allowed storage type for Float*
>       - Allows for slightly more compact physical storage. Engines that
> can take advantage of physical type awareness at read time can benefit. (I
> don't know of any such engines so I would recommend we don't choose this.)
>
> *  - Separate Vector Element Types*
>       - We treat vectors as essentially a set of specifically typed
> collections. Their typing comes from an enum of well-defined element types
> which exist independently from the Iceberg Type System. This avoids us
> having to do any full type work now (and potentially ever if we never have
> demand for full-fledged Int8 and float16 types). I prefer this because we
> already have the annotations in Parquet and I think it matches the use case
> of "function on a collection of values" better than demanding implementers
> support "function on a single element". Engines that want to utilize the
> narrower types can, and the logical fallback is just the Iceberg parent
> type for the value.
>
> *  - Full Types for Float16 and Int8*
>       - The type system expands, burdening all engines with the need to
> add first-class support for the new types. We haven't seen a lot of demand
> for full types here so I'm hesitant to go down this road when having a
> separate vector element type covers basically everything folks have been
> asking for with float16 and int8.
>
>
> Everyone who is interested please chime in so we can either nail this down
> or punt to V5.
>
> Thanks for your time,
> Russ
>
>
> Links
>
>   - Issue: https://github.com/apache/iceberg/issues/18297
>   - Vector spec PR: https://github.com/apache/iceberg/pull/18416
>   - int8 and float16 primitive draft:
> https://github.com/apache/iceberg/pull/18485
>   - Java VectorType PR: https://github.com/apache/iceberg/pull/18676
>   - Peter Vary's benchmarks:
> https://lists.apache.org/thread/p41hstcw9r702zo9k94qzn67foxbbnzk
>   - Storage measurements on public embedding sets:
> https://gist.github.com/RussellSpitzer/d571e3bd5db91b964f021cfcf94f2112
>   - Proposal and sync notes:
> https://docs.google.com/document/d/1zA8PskNDFKXXJpzWQr25CFoX_aIZHBNHbkxk0t3PteE
>   - Parquet vector proposal:
> https://github.com/apache/parquet-format/pull/624
>

Reply via email to