That's not usually the advice financial counselors give. Dave Ramsey, for instance, would probably say keep $1k in the bank and pay pay off $9k of the debt and [snowball] the remaining payments.
Also, assuming you can get a 12% ROI over the years, and accounting for inflation, you'd be left with 12%-5%-4%=3%
Is that hypothetical 3% gain worth keeping the debt, which has risks of its own? e.g. you are incapacitated due to an accident, or you incur a huge medical bill that you need to split into payments, but you can't pay much because, oh "i just have this loan at 5% that's not worth paying off.
Actually, if something bad happens you've got $10k in the bank. So when you are incapacitated, you've got several months' of living expenses -- or you can pay off the medical bill outright.
The common "pay it all off; no debt ever" advice that I've seen given out for free on the internet is geared toward people with tons of debt. This advice is not great for persons with small amounts of debt, good cash flow, and a healthy emergency fund. When you reach this point, you have the option to use debt as a tool, and you have the ability to negotiate with lenders to get better terms. (Implied here is that you can negotiate better terms because you have the ability to simply pay cash and walk away from the debt-negotiation table.)
10k isn't ENOUGH in the bank IMO for most people living in SF. It's probably closer to 20k, but 10k was just a random number I pulled out to demonstrate flexibility of cash on hand. Then again, CA has really tenant friendly eviction laws, so maybe not...
It doesn't have to be ACTUAL cash, just near cash holdings not strongly effected by volatile securities (such as the stock market)
Some people over-emphasize this. Generally speaking, 10k in debt, 10k in the bank, at a non-usurious interest rate is far more stable than 0 in debt and $3.50 in the bank.
I'd contend that debts south of 5% fixed interest rate should be HIGHLY considered as "not worth paying down" until your retirement account is fully loaded with enough cash to retire TODAY as this is a very strangely low rate, and one that will be over the life of most loans in that tier, at or less than inflation (looking at historical levels of inflation)
You're not going to be able to borrow at 4% when inflation is at 5%, but you sure can keep on to that 4% debt from now for 10 years, and instead bank extra payments or invest them