Could be an air leak on the intake side, after the air flow meter, or into the fuel system.
If the engine runs on when switched off, that suggests high combustion temperatures and that can be caused by lean combustion (ie air leaking in and leaning out the mixture).
Chattering noise on acceleration could be pinking caused by the lean mixture.
Surging during deceleration could also be down to an air leak.
Try getting a cup full of fuel and a paintbrush, and painting fuel onto every fuel line connection you can find, with the engine idling. If the idling speed suddenly increases you've found a leak on the spot you've just 'painted' with fuel.