Dynamically allocating compute in transformer-based language models