Enable the first optimization, reduced precision or more specifically bfloat16. There are several benefits of using reduced precision:  
* Using a reduced numerical precision (such as float16 or bfloat16) for inference doesn’t affect the generation quality but significantly improves latency.
* The benefits of using bfloat16 compared to float16 are hardware dependent, but modern GPUs tend to favor bfloat16.
* bfloat16 is much more resilient when used with quantization compared to float16, but more recent versions of the quantization library ([torchao](https://github.com/pytorch-labs/ao)) we used don't have numerical issues with float16.  
```python
from diffusers import StableDiffusionXLPipeline
import torch

pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.bfloat16
).to("cuda")

# Run the attention ops without SDPA.
pipe.unet.set_default_attn_processor()
pipe.vae.set_default_attn_processor()

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt, num_inference_steps=30).images[0]
```  
bfloat16 reduces the latency from 7.36 seconds to 4.63 seconds.  
<div class="flex justify-center">
<img src="https://huggingface.co/datasets/sayakpaul/sample-datasets/resolve/main/progressive-acceleration-sdxl/SDXL%2C_Batch_Size%3A_1%2C_Steps%3A_30_1.png" width=500>
</div>  
<Tip>  
In our later experiments with float16, recent versions of torchao do not incur numerical problems from float16.  
</Tip>  
Take a look at the [Speed up inference](../optimization/fp16) guide to learn more about running inference with reduced precision.
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md