Configuring machine learning experiments with Fiddle
March 16, 2025 — April 16, 2025
Suspiciously similar content
Fiddle is the successor to gin, AFAICT, at Google for configuring ML experiments. It uses a code-based config system, where we define Python functions that change the configuration. It’s a slightly different approach. I’m not sure how to use it for things like hyperparam search, but it looks fine.
It generates a CLI via Google’s absl system. The keyword is Flag Support.
Docs are sparse; see:
- Fiddle documentation — Fiddle documentation
- Fiddle Tutorial
- Auto-Config Tutorial
- Fiddle Flag Support — Fiddle documentation
Fiddle Config Best Practices were not obvious to me at first, but this is what I have learned:
- Location: Store Fiddle configs (
.py
files) inside the source tree, typically in a dedicated directory (e.g.,configs/
), separate from core library code (e.g.,src/
). - Dependency: Core business logic (ML code) should NOT import or depend on
fiddle
. It should accept standard Python arguments/objects. - Integration: Use a main script/entry point to:
- Import the desired configuration from the
configs/
module. - Use
fiddle.build()
to materialize the configuration into Python objects. - Pass these objects to your business logic functions/classes.
- Import the desired configuration from the
This should keep configuration separate from implementation for modularity, testability, and reusability. Business logic remains agnostic to the configuration system.
I wonder if this pairs well with other Google infrastructure such as their metadata store?