Surging is a classic sign of running lean. Several things have been listed that can cause (weak fuel pump, vacuum leak on hose, clogged fuel filter). Fuel filter is an easy inexpensive thing to do. Depending on how many hour are on the generator, changing out all of the rubber hoses, especially if they look dry/cracked, might be a reasonable thing to do.
This is a good video on
Onan 5500 Generator fuel pump trouble shooting.
This video claims a simple fix for similar problems.
Onan RV Generator hidden defect, runs fine/stops