Dear @Wjb8i,
Welcome to the Wefugees Community and thank you for your question.
If you are coming to Germany with a vocational training visa ("Ausbildung"), you subsequently receive the residence permit according to section 16a of the German Residence Act. In case you are quitting your vocational training program (which was the foundation to obtain the visa), you are at risk to lose your residence permit. However, as Handbook Germany explains:
That means if you drop out on your own accord - for no solid reason - you will lose your residence permit. If you are dismissed, e.g., because your company generally has to lay off employees, you will have up to six months to seek a new vocational training programme.
I hope this helps and please don't hesitate to get back to us with any further questions.
All the best,
Meike