If you don’t mind me asking: which popular LLM(s) have you been using for this and how are you providing the code base into the context window?
https://aider.chat/docs/repomap.html
Aider hosts a leaderboard that rates LLMs on performance, including a section on refactoring.