We're busy negotiating a contract, and the client has come back with a request for an advance payment bank guarantee. My understanding of this is that if we default in the contract in some way then they can request that the advance payment they have made is refunded.

Who provides this guarantee and what is the mechanism? I assume that the bank commits to refund the monies based on some agreement, and that the bank handles the refund. But who exactly has the power over when the bank refunds that money? Can the client cry "default!" and the bank will just hand over the money? What options will we have to defend our position?

I would insist that the guarantee includes a reduction of any payments for direct costs which have been made.