Is it really bad , or just a few twitches ? Often minor headshake happens when the front end is skimming the pavement under hard acceleration.
Sometimes you just need to relax your grip on the bars a little and hold on with your knees / legs gripping the tank. This often cures minor twitches and shakes. RELAX that death grip on the bars.
Suspension setup can play a part also, bike needs to be balanced front to rear.
Tires, condition and pressure can also be part of the puzzle.
Steeringhead bearings out of adjustment ? Never a bad idea to check/adjust them if your having an issue.
I added a GPR steering damper to cure a few twitches on my bike but they were mostly occurring on bumpy roads pushing the pace a bit in the corners.
From your description I'm guessing your getting a few twitches under hard acceleration in a straight line ?? if thats the case your probably just holding the bars to tight when the front end is skimming the pavement.
Loosen up your grip on the bars and hold the tank with your knees and see what happens
If you still have issues check suspension setup, tires, and steeringhead bearings .