It depends on the specific contract I assume.
In my department, people who quit repay only the part of the stipend they haven't worked for. So, say that you received 3000 pounds for 3 months of work, but you quit after one month, you need to give back 2000. Hope that makes sense.