It’s extremely nuanced. ‘Light years ahead’ is correct since you are thinking about a race where one competitor is a long distance ahead of others. On the other hand, ‘light years away’ doesn’t make sense, since we think of achievements in terms of time needed, rather than distance.
https://www.merriam-webster.com/dictionary/light-years ahead
It’s extremely nuanced. ‘Light years ahead’ is correct since you are thinking about a race where one competitor is a long distance ahead of others. On the other hand, ‘light years away’ doesn’t make sense, since we think of achievements in terms of time needed, rather than distance.
You’ve never heard the term miles ahead?
Tommy is miles ahead of Timmy in math class.
Clearly not referring to distance but it absolutely makes sense.