Ive come up with a couple possibilities that I find compelling. The first possibility is that the gods kind of suspend the soul of the person who is being tortured. In this case, the person no longer experiences the torturing. The gods, assuming they have great power over physics, could affect the body of the individual that is being tortured in such a way that it would appear to others that the individual that is tortured is experiencing it, when in actuality, the body would be like a lifeless machine, and the persons soul would not actually be experiencing it. I find this explanation compelling because torture is now something that is no longer truly being experienced. Now, it may be that an individual can gain value out of the experience, but I think that there is a point at which torture no longer adds any value and is simply suffering. Perhaps god would allow a being to experience torture, as long as it is good to do so, such as if that being could gain greater insight and understanding into evil through having this experience.
The other explanation that I also find compelling is that this world may be a kind of holodeck, or illusion. Beings may be sort of plugged into a machine, kind of like in the matrix. The gods may find this to be a valuable tool for helping beings gain wisdom and knowledge. In such a world torture may simply be an illusion, not actually being experienced by any living life-form. Instead, the reason of making torture a part of this illusion would as a challenge, in which the beings would have to try to find reasonable explanations to account for torture. It could be that our entire lives are set up in a way as to make our experience potentially very valuable, with all kinds of opportunities to grow and develop, and all kinds of challenges to overcome in hopes of learning and coming out of this illusion far better off than we were going in.