Deficiency and the geometric invariants of a group (with an appendix by Pascal Schweitzer)