1. They can understand new commands after only a few times.
(Does 'only' modify 'after a few times'? noun phrase...)
2. They understand new commands only after about 100 times.
(Does 'only' modify 'after abut 100 times'? adverbial phrasse...)
1 answer
Yes, in both sentences, you have "only" in the right place for the very reasons you have written. Nice!