PyTorch’s einsum - in contrast to numpy’s - isn’t optimized for speed but breaks down the einsum into things that are ultimately (batched) matrix multiplications. The idea I had in mind when implementing it was that is was a mere convenience thing. This turned out to be wrong, but no-one stepped up to provide a genuinely faster reimplementation yet although some cases were identified where the batched matrix multiplication could be replaced by eg a plain matmul. (I did experiment with a different reduction kernel, but it seemed to be faster on some, slower on other inputs, not least because it is actually hard to match matrix multiplication routines shipped in the vendor libraries.)
So your observation is quite plausible.
Best regards
Thomas