Remember, what goes in regularly, will come out regularly. Your dog will probably need to go out soon after eating, after napping, and after exercising. If you can anticipate when he needs to go and hustle him to the appropriate spot at the first sign, you'll avoid accidents. If you stay with him, you'll also know for a fact that both duties were accomplished before he comes back in. If you leave him out alone, you won't know if he completed his assigned tasks or was distracted by a butterfly.
Many young puppies are distraught about being separated from their owners.
They may spend the entire time while outside just sitting on the porch. It's unlikely that your pup will want to ask to go outside if it is a negative experience to be separated from the security of its human family. He was out for two hours and came in immediately made a mess. He may have spent most of the past two hours napping, awoke to the sound of the door and came running. If he has an accident, swat yourself with the rolled up newspaper, not the dog.