Paperless-ngx: extremely slow classifier training with NixOS version

paperless-ngx can use machine learning to automatically assign tags, correspondents etc. to documents based on how you assigned those tags to previous documents. The problem is that the training of the classifier is extremely slow with the NixOS version of paperless-ngx. On my server it takes hours (for a job that is by default scheduled to run every hour). It is stuck endlessly on “Training correspondent classifier…”.

I switched over from the NixOS service module (services.paperless) to using the official Docker image with Podman (via virtualisation.oci-containers). I use the exact same version of paperless-ngx with the exact same configuration. With the official Docker image the training takes only a few minutes (for around 600 documents).

I would rather not use Docker containers but I cannot figure out why the version in nixpkgs is so slow. Has anybody else experienced this?