If you are a visa national and your current Student (previously Tier 4) visa expires before your graduation date, you will need to leave the UK and apply for a Standard Visitor visa to come back to attend your graduation ceremony.
If you are a non-visa national (someone who does not need a visa to come to the UK for a short visit) then you can request entry as a Visitor when you arrive at the airport, but you should carry with you evidence of your graduation, evidence you have sufficient funds for your visit, and evidence you intend to leave again within 6 month
You can read more helpful posts on our blog or follow @dafanstudylink_ on X to stay connected.