That’s still quite long, it was about 10 seconds on my machine. Knowing nothing at all about your environment, my stab in the dark would be that that BLAS is not properly configured. You could try to run python -m pytensor.misc.check_blas in the terminal to do a speed check. The important line to check for is blas__ldflags. If it’s empty, it means you’re using numpy for linear algebra, which will cause significant slowdown.