In words
What it is, why it matters, and what it is like.
Why am I learning this?
This concept solves the practical problem of deciding how big a step to take when you are trying to improve a situation mathematically. Imagine you are adjusting the volume on a stereo system to get the clearest sound. You know which direction turns the knob toward better sound, but if you turn it too far, you overshoot and the sound gets worse again. Line search is the method for choosing exactly how much to turn that knob. Without it, algorithms either crawl forward at a snail’s pace or jump wildly out of control. By understanding this step, you gain immediate control over whether a calculation settles into a good answer or crashes. It is the critical bridge between knowing which way to go and actually getting there efficiently.
The idea, in plain terms
Imagine standing on a foggy hillside where you need to reach the lowest point in the valley. You can feel the slope under your feet, which tells you the direction of steepest downhill. This steepness is the gradient. But the slope’s direction alone does not tell you how far to walk. If you take a tiny step, you will be walking all day with little progress. If you take a huge step, you might stride past the valley floor and end up on the opposite hillside, higher than where you started. This is what happens when the loss (a number measuring how wrong your current answer is) increases instead of decreases. Line search answers the question: 'How far along this downhill path should I go?' One extreme is to calculate the exact spot that is lowest in this direction—this is called exact line search. The more practical approach is backtracking line search. Here, you take a tentative step, check if the loss has decreased sufficiently using a rule called the Armijo condition, and if it hasn’t dropped enough, you shrink your step and try again. You keep shrinking the step until the drop in loss meets the requirement. This 'try, check, shrink' cycle ensures you make steady progress without wasting time or overshooting.
An analogy
Think of adjusting a thermostat to find the perfect room temperature. You know whether the room is too hot or too cold, so you know which way to turn the dial. However, turning it fully to one side might make the room much worse before it gets better. You turn the dial a small amount, then wait to see if the temperature is improving. If it is close enough to your target, you stop and leave it there. If not, you turn it a bit more in the same direction or shrink the adjustment and check again. This mirrors backtracking line search: you propose an adjustment size, measure the result against a sufficient improvement threshold, and reduce the size if needed. The analogy breaks down because a room has only one temperature setting, whereas optimizing a complex model involves millions of variables simultaneously, making the 'dial' impossible to scan completely; thus, you must rely on these local checks rather than a full search.
Definition
Line search is a method for determining the appropriate step size in an optimization algorithm by evaluating progress along a chosen direction and adjusting the distance until a sufficient decrease in error is achieved.
Where this sits
This concept works hand-in-hand with Gradient Descent, which is the technique of moving in the direction opposite to the gradient (the steepest slope) to minimize error. While Gradient Descent identifies the path, line search determines how many units of distance to cover on that path. It also relates directly to Hyperparameter Tuning, as the maximum initial step size used in this process is a key setting you often adjust manually to ensure stability.