We can consider a high-level program to be a detailed specification, especially when compared to pseudocode. Wouldn't it be possible for an AI in the near future to generate low-level code in order to speed up parts of the high-level program (hot path) ?
Even if the AI makes mistakes we can envision an automated system that continuously compares the behavior of the two versions of the code. Such a system would give feedback to the AI.
(Sorry for my bad English)
The old A.I. may be better for this, see
https://en.wikipedia.org/wiki/Superoptimization
or tools like
https://www.microsoft.com/en-us/research/project/z3-3/
I’ve seen cases where somebody used Z3 to pick a few assembly instructions to implement the body of a loop. Note the last two systems write a correct program every time, the LLM just makes a best effort. Some hybrid of an LLM that “understands” natural language and that other technology that can understand some code might be the winner.
Compilers have been doing that for decades. AI would just add level of uncertainty. What a compiler does can be understood and traced back. No so AI.