I think this is very rider dependent…some can surge and recover multiple times and drop their opponents. Think Pog as a good example of this.
Others need to maintain a consistent effort (classic diesel engines) and need to maintain consistent effort to get to the top quickly without blowing up.
Classic example of that where they interviewed Geraint after a mountain stage. Tad and Jonas had been surging duelling up a mountain stage finish. Geraint said he just couldn’t do those surges and thus just had to stay very steady. He caught them after some surges before they surged off not to be caught again.
Attacks are much different than power fluctuations due to terrain and/or backing off the throttle as the incline eases. Attacks and accelerations are the effective in creating breaks to win a race but will not result the fastest time (even split or negative split is best for that).
In regards to the OP question… It is natural to ease off as the incline decreases. A 10k at 7-20% is a long effort. Even if you were running a 10k you are going to have moments of slight pace variations. As for what is ideal? Probably depends on how long you back off for. A few seconds, no biggie. Minutes… not so much.
I think in theory, variable power is faster but in practice steady is probably faster. It just costs too much to go over your max steady state power for the duration.
I think that if you’re only goal is to get up the climb the fastest, then you would reverse split, saving more energy for the last parts of the climb, and - you’d also go easier on the flatter ramps, and push it harder to get over the steeper bits faster. Pretty much what @Jolyzara said.
I think I was watching a video with the guy that made Best Bike Split on it, and his program can model it, but he basically gave what I though was a non-answer and said that it’s best to test out what works best for you when trying to model a pace up a climb.
Ona purely theoretical analysis, I think it is pretty clear that you want to go harder on the steeper sections (speed / power differences will make the most difference there) and ease slightly on the flatter parts (time differences will be less).
But again, it depends on if that suits your particular makeup…for some it may hold true, while for others they would likely blow-up and lose even more time.