Of course
great, I will try to help you as much as I can.
It is highly important to use the cdir_military_generator_template_ratios_table as a full table. Other than that I have the following questions
Are cavalry unit qualities exceptional high ? Can you post the whole template ? Can you name the faction ? Which cdir_military_generator_configkey is used by the faction ?
1. Usually the AI will recruit the unit type with the next highest ratio available to it. e.g. spearmen are the only recruitable unit and all slots for spearmen are already used for the template ,the AI will still recruit spearmen as no other option matching the template is available.
2. You have to take the starting units into account those units usually donīt fit with some of the army templates e.g. making a cavalry only army with infantry starting units. Further more the AI can only recruit the units available, but the AI will never stop recruiting even in a region where it is unable to fulfill the template ratio. To answer the question: no. Make sure that your newly created templates are set up correctly. It is highly important to use the full cdir_military_generator_template_ratios_table and to make bigger changes to the vanilla table. You can add new templates with table fragments.
3. Of course it is close to impossible to create the exact army compositions as long as the AI has to construct buildings to unlock the units it needs to conform with my templates, if you add all units to the city buildings the AI armies will be mostly perfect. The DeI ones (20 ratio templates max and up to 4 different per faction) are pretty close to what I expect them to be, because we have far more units than vanilla (AoR to fill up the ranks even if the AI has no barrack in the region)