In our experience a homestay is the better option to settle into local Chinese life and improve your Mandarin quickly. However, at the same time it costs more and even though you will of course be completely free in organising your life, you are still part of a family. A shared apartment offers complete freedom, however in our experience the main advantage is the cost savings. It is completely up to you of course, but if you can afford it we recommend you to go with the homestay option. If you are on a budget then a shared apartment is a great choice to still experience complete immersion without spending too much money.