If you are in possession of a student visa you can only stay in the UK if your visa has not expired by the date of your graduation ceremony. If your visa expires before your graduation ceremony takes place, you will have to return home and apply for a visitor visa to return to the UK using form VAF1A.
If you have invited guests to the ceremony and they require a visa to enter the UK they will need to apply for a visitor visa. You and your guest should read the current UKVI Student Visa guidance on making a visa application.