Text this: Rate distortion optimization for adaptive gradient quantization in federated learning