liveBook · Manning

Leaky abstraction

As explained in Machine Learning System Design

A leaky abstraction is an abstraction that exposes underlying implementation details that its interface is intended to hide.

An abstraction becomes leaky when an interface exposes implementation details it should hide. In an ML API, exposing numerous handlers, parameters, and their dependencies makes the interface difficult to learn and use. Prefer a small, predictable interface that hides complexity behind a few meaningful methods. section 13.1

Use these checks when designing an ML API:

  • Keep methods and parameters few enough that users do not need deep knowledge of internals. section 13.1
  • Make behavior predictable by deciding which defaults belong inside the interface and which details users must control. section 13.1
  • Expose controls such as time, seed, and model version only when the interface needs users to manage them. section 13.1
Figure 13.1 Overconfiguration vs. underconfiguration
figure

Use the comparison of overconfiguration and underconfiguration to balance a simple interface against insufficient control. section 13.1

How Machine Learning System Design covers it

How deep it goes
Defines leakage and contrasts parameter-heavy interfaces with redesigned prediction functions, but stops short of general API instruction.
Examples
Uses prediction functions whose interfaces expose or hide time, random seed, and model version.
What it assumes
Assumes familiarity with general API design and focuses instead on pitfalls specific to ML systems.
What you can do after
Apply it by designing ML APIs with fewer parameters, explicit defaults, and controlled access to implementation details.
How it connects
Connects API design with abstraction, machine learning systems, configuration, and model versioning.

Also explained in

Compare how 3 books explain leaky abstraction →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning System Design. The section links point to the parts of the book it draws on.