Herbie 1.6 Release Notes

The Herbie developers are excited to announce Herbie 1.6! This release focuses on further integration of egg, improved reliability, and a better web interface. Our favorite features are below.

The Herbie team, working over Zoom to bring you Herbie 1.6

What is Herbie? Herbie automatically improves the accuracy of floating point expressions. This avoids the bugs, errors, and surprises that so often occur with floating point arithmetic.

Join us! Join the Herbie developers on the FPBench Slack, at the monthly FPBench community meetings, and at FPTalks 2022.

Comparison of Herbie's total output error (bits) across 100 seeds with the old recursive rewriter (top) versus the egg-based implementation (bottom). The egg-based implementation has lower variability.

Recursive Rewriting with egg

Two releases ago, Herbie 1.4 featured a new simplifier that used the egg library for a substantial increase in speed. This release further incorporates the egg library into Herbie by replacing the recursive rewriter with an egg-based implementation. Herbie's output is now more stable across seeds compared to the previous implementation, maintains a similar level of performance, and increases accuracy gains overall. This change also makes it easier to add new rewrite rules, since the egg-based rewriter's behavior is more predictable than the old recursive rewriter was.
Preconditions in the new web interface. For each input, users are asked to provide a range of values for Herbie to focus on optimizing over. Input ranges vary depending on the user's application and should always be supplied to maximize accuracy.

Interactive Herbie

Despite the fact that most users interact with Herbie via the demo page, the web interface has historically had a minimal design, with important features like preconditions hidden behind advanced configuration dialogs. As part of an ongoing push to make Herbie more user-friendly, we have added support for preconditions to the main interface, and have improved the display of warnings and errors. We expect the demo page to change further in the coming year to provide users with more support in analyzing Herbie's output and testing their own ideas for rewritings.

Comparison of the midpoint (left) vs. shortest number (right) methods for selecting branch conditions.

Shorter Branch Conditions

Herbie now synthesizes branch conditions with shorter split values. Before, Herbie's binary search algorithm would narrow down the set of possible split values to a small interval from which Herbie took the midpoint. Often the midpoint had a long string representation which made it seem like it was chosen with high precision. Now Herbie will choose a value on that same interval with a short string representation. This change makes output programs more readable and highlights the low precision in the result of binary search.

System diagram for Herbie 1.6, with key changes in red dotted boxes. From top to bottom: double-precision (binary64) and single-precision (binary32) types are loaded through plugins instead of being embedded in Herbie's core; a new patching subsystem bundles together the various rewriting methods behind a simple interface; recursive rewrite uses egg. Compare Herbie 1.5 and 1.6 system diagrams here and here.

Patching and Plugins

Herbie has undergone a significant architectural change since the previous release. Although this change may not be visible to users, we hope that it makes future Herbie development more streamlined and provides a clearer answer to the question: what is Herbie? In particular, two major improvements include adding the "patch table" and moving number system specifics out of Herbie's core architecture.

The patch table manages most rewriting capabilities, provides a minimal interface to generate variants from a set of expressions, and caches variants in case of duplicate input expressions. Creating this subsystem to handle variant generation more cleanly separates the "generate" and "test" parts within Herbie.

Herbie's double-precision and single-precision representations are now implemented as plugins that automatically ship with Herbie. Representation-specific operators and definitions are no longer present in Herbie's core architecure. This change makes Herbie representation-agnostic and loads double- and single-precision representations through the plugin interface. Not only is this design cleaner, but these plugins now serve as examples for plugin developers. In the future, we hope to move additional definitions out of core Herbie and into plugins such as error metrics and cost models (Pherbie).


Other improvements

Deprecations and removals


Try it out!

We want Herbie to be more useful to scientists, engineers, and programmers around the world. We've got a lot of features we're excited to work on in the coming months. Please report bugs, join the mailing list, or contribute.


If you find Herbie useful, let us know!