You are not giving enough details in your question, and the details are important.
Here is what I guess (that you did not tell) about your current situation. I could be completely wrong, it is just a guess (and it is inspired by my own situation, I am a research engineer on software tools for software developers).
You are some kind of software developer in Germany (I am guessing that because it is a job market in tension, and because in other questions you said you are in Germany).
You are still new in software development. Remember that it takes ten years to become an expert software developer (however, in some companies, a guy with 3 years of software development experience is called a "senior"; IMHO that does not change the fact that he is still a newbie). And training (often self-training, but not only) and improving skills is an essential part of the software developer's job.
You are offered to follow some training of one to three weeks in some new software technologies, and/or in software project management. e.g. training in some new programming language like Go.
The cost of that training (for the company to pay it) is about (or less than) a month of your salary (e.g. 3000€). In fact, the cost is higher (during the training period, you won't do any work). But that cost is not big for company, even if it is big for you. The duration of that training is a week or two (or 3 weeks of training, costing 5000€)
The training costs are about 80% of my monthly gross salary for a week of training.
(fits nicely in my prediction, so not a big deal for your company's perspective)
In that case, do the training and don't tell about your willing to change job (until you found a new job, signed a new contract, and are resigning).
Details could matter, e.g. perhaps the German law forbids to quit after such a training for a specified amount of time (learn more about that)
"I realize the costs are significant, and would like to train on my own and be present for the other tasks. The source of the training material is a book mentioned on the flyer, so I would only miss the certificate."
Wrong reasoning. If you train on your own at work hours (intensively, full-time for several weeks!), you won't do your daily job, and your immediate boss cannot assess if you are actually learning stuff useful for your company. BTW, you are also creating a precedent in your team (and other people could ask to do likewise).
Of course, if you accept some training, you also accept to have your job evolving to profit from the skills acquired in that training.....
Your boss is...
also concerned about getting the return on investment.
That is his problem, not yours. (If you follow the training, your concern is to learn stuff and improve your skills, notably stuff useful for your company). Your boss is not your friend. Your company is not your mother. They could fire you when needed.
BTW, of course if the training is not interesting for you and push you in a career direction you don't want (e.g. if the training is about project management and you want to stay in the technical world) you should tell and explain why it does not fit very well your expectations.
Also, from your company's perspective, not training you could require them to fire you and hire someone else with required qualifications. That costs a lot (typically several dozens of thousands of euros) and takes some time (months of bad productivity).
Learn more -by googling german law or lander or industry regulations, by re-reading your work contract, by asking your union, ... but preferably not HR (they are not your friends!)- about your contractual obligations after your training (how much are you required to stay at your company, or to reimburse when leaving it). It is what matters.
My plan is to retrain in my free time until the end of the year for a role I would enjoy
Excellent idea. BTW, if working in the software business, contributing to some free software project (e.g. on github) on your spare time is an excellent thing to do (that you can show on your CV) and will improve your developer skills.
What would happen afterwards:
you'll start searching for new jobs in a few months. You'll find one say in September 2018 (five months from now). Your official resigning period could be of two or 3 or 4 months (I don't really know, details could be specific to your job or country). During that period, you'll work for your current employer and use your newly acquired skills.
So for your company's perspective, they paid you a training, and it was useful to them for several months. That is enough.
Notice that in most European countries, companies are required to spend a few percent of their work costs in training. Details vary from country to country, from one industrial branch to another, from company to company. So the company might not make you a special favor to follow that training.
Your situation might be completely different. Some rare jobs require very specific and quite long training (e.g. driving helicopters for someone who have no pilot license at all; or soldering nuclear reactors) and certification. In those rare cases you could have to sign some specific contract (defining how long you'll work at your company, or what part of the training would you have to pay back when leaving). But you did not mention that!