Optimizing attention mechanisms in LLMs