## Definition
A metaphor in engineering that describes a system with unknown internal workings.
*Noun.*
> Because `sort()`'s implementation is hidden, it's a black box to me. I just have to trust that it works!
## Characteristics
- A metaphor for a system;
- an example of [[abstraction]];
- conveys that the system's internal workings are hidden, unknown, or deliberately ignored;
- conveys that the only things that matter are the system's inputs and outputs; and
- a matter of perspective—a black box for one person may be a [[white box]] for another.
## Examples
### Large language models (LLMs)
LLMs are black box systems as we do not know how their internal logic works. This is a result of the way in which LLMs are "grown, not crafted"[^1].
### Human brains
We observe stimulus and response but we don't fully understand the mechanisms in between.
### Library subprograms
At the point of use, library subprograms are black boxes as their internal workings are unknown. When you use `print()`, you don't care about exactly how it makes text appear on the screen—just that it does.
## Non-examples
### Open source code
[[open source|Open source]] code is, by definition, not a black box. Instead, it is a white box as the internal workings are visible and can be inspected—even if you personally choose not to look, the logic is available.
### A simple, documented function
A function like `add()` isn't a black box—the mechanism connecting input to output is fully known and trivial, so there's no hidden internal workings.
```python
def add(a, b):
"""
Parameters:
a: int
b: int
Produces:
s: the sum of a and b
"""
return a + b
```
## Notes
[^1]: Eliezer Yudkowsky and Nate Soares, If Anyone Builds It, Everyone Dies (Vintage, 2025), loc. 615.