A diffusion model to shrink proteins while maintaining their function