# Don't Over-Optimize Things

or *Optimizing Optimization*
============================

The [definition](https://dictionary.cambridge.org/dictionary/english/optimize) of *optimize* is:

> to make something as good as possible

It's hard to argue with that. It's no coincidence that a lot of us have something of an optimization mindset.

But **sometimes trying to optimize can lead to worse outcomes** (because we don't fully understand what to aim for). It's worth understanding how this happens. We can try to **avoid it** by a **combination** of **thinking more about what to aim for**, and (sometimes) simply **optimizing less hard**.

Reflection on purpose vs optimizing for that purpose
----------------------------------------------------

What does the activity of making something as good as possible look like in practice? I think often there are **two stages**:

1.  **Reflection on the purpose** — thinking about what the point of the thing at hand is, and identifying what counts as "good" in context
2.  **Optimizing for that purpose** — identifying the option(s) which do best at the identified purpose

Both of these stages are important parts of optimization in the general sense. But I think it's **optimization-for-a-given-purpose** that ***feels like optimization***. When I say "over-optimization" I mean doing too much optimization for a given purpose.

What goes wrong when you over-optimize
--------------------------------------

Consider this exaggerated example:

> Alice is a busy executive. She needs to get from one important meeting to another in a nearby city; she's definitely going to be late to the second meeting. She asks her assistant Bob to sort things out. "What should I be optimizing for?", Bob asks. "Just get me there as fast as possible", Alice replies, imagining that Bob will work out whether a taxi or train is faster.
> 
> Bob is *on* this. Eager to prove himself an excellent assistant, he first looks into a taxi (about 90 minutes) and a train (about 60 minutes plus 10 minutes travel at each end — but there's a 20 minute wait for the right train). So the taxi looks better.
> 
> But wait. Surely he can do better than 90 minutes? OK, so the journey is too short for a private jet to make sense, but what about a helicopter? Yep, 15 minutes to get to a helipad, plus 45 minutes flight time, and it can land on the hotel roof! Even adding in 5 minutes for embarking/disembarking, this is 25 minutes faster.
> 
> Or ... was he assuming that the drivers were sticking to the speed limit? Yeah, if he make the right phone calls he can find someone who can drive door to door in 60 minutes. 
> 
> Can he get the helicopter to be faster than that? Yeah, the driver can speed to the helipad, and bring it down to 57 minutes. Or what if he doesn't have it take off from a helipad? He just needs to find the closest possible bit of land and pay the owners to allow it to land there (or pay security people to temporarily clear the land even if they don't have permission to land). Surely that will come in under 55 minutes. Actually, if he's not concerned about proper airfields, he can revisit the option of a private jet ... just clear the street outside and use that as a runway, then have a skydiving instructor jump with Alice to land on the roof of the hotel ...

What's going wrong here? It isn't just that Bob is wasting time doing too much optimization, but that **his solutions are getting** ***worse*** **as he does more optimization**. This is because he has an imperfect understanding of the purpose. [Goodhart's law](https://www.lesswrong.com/posts/EbFABnst8LsidYs5Y/goodhart-taxonomy) is biting, hard.

It's also the case that Bob has a bunch of other implicit knowledge baked into how he starts to search for options. He first thinks of taking a taxi or the train. These are unusually good options overall among possible ways to get from one city to the other; they're salient to him because they're common, and they're common because they're often good choices. Too much optimization is liable to throw out the value of this implicit knowledge.

So **there are two ways Bob could do a better job**:

1.  **He could reflect more on the purpose of what he's doing** (perhaps consulting Alice to understand that budget starts to matter when it's getting into the thousands of dollars, and that she really doesn't want to do things that bring legal or physical risk)
2.  **He could do something other than pure optimization**; like "find the first pretty good option and stop searching"[^g540i0gx7tn], or "find a set of pretty good options and then pick the one that he gut-level feels best about"[^duwkq719g6o]
    *   It's not obvious which of these will produce better outcomes; it depends how much of his implicit knowledge is known to his gut vs encoded in his search process

I'm generally a big fan of #1. Of course it's possible to go overboard, but I think it's often worth spending 3-30% of the time you'll spend on an activity reflecting on the purpose.[^bb2z615cj6i] And it doesn't have much downside beyond the time cost.

Of course you'd like to sequence things such that you do the reflection on the purpose first ("[premature optimization is the root of all evil](https://stackify.com/premature-optimization-evil/)"), but even then we're usually acting based on an imperfect understanding of the purpose, which means that more optimization for the purpose doesn't necessarily lead to better things. So **some combination of #1 and #2 will often be best**.

When is lots of optimization for a purpose good?
------------------------------------------------

Optimization for a purpose is particularly good when:

*   **You have a very clear understanding of the purpose**, and won't get much if anything out of further reflection
    *   e.g. if you're in the final of a chess competition competing for a big monetary prize, it's relatively clear that the objective should be "win the game", and you know all of the rules of the game
    *   In general if you've thought a lot about your purpose and how Goodharting could lead to bad things and you don't feel too worried, it's a sign that a lot of optimization is a good idea!
*   You don't know how much different options vary in how well they perform at the purpose as you currently understand it
    *   **Not-optimizing plus scope insensitivity can be a bad recipe!** Sometimes some options are hundreds of times better than others on crucial dimensions
*   You're using it as a process to generate possibilities, not committing to going with the top options even if they seem dumb

See also [Perils of optimizing in social contexts](https://www.lesswrong.com/posts/zhBPhkca7oviZgnBq/perils-of-optimizing-in-social-contexts) for an important special case where it's worth being wary about optimizing.

*(*[*cross-posted*](https://forum.effectivealtruism.org/posts/cDv9mP5Yoz4k4fSbW/don-t-over-optimize-things) *from the EA Forum)*

[^g540i0gx7tn]: I owe this general point, which was the inspiration for the post, to Jan Kulveit, who expressed it concisely as "argmax -> softmax". 

[^duwkq719g6o]: This takes advantage of the fact that his gut is often implicitly tracking things, without needing to do the full work of reflecting on the purpose to make them explicit. 

[^bb2z615cj6i]: As a toy example, suppose that every doubling of the time you spend reflecting on the purpose helps you do things 10% better; then you should invest about 12% of your time reflecting on purpose [source: scribbled calculation]. Activities will vary a lot on how much you actually get benefits from reflecting on the purpose, but I don't think it's that unusual to see significant returns, particularly if the situation is complicated (& e.g. involving other people very often makes things complicated).