If I  script  different instances of the same class at different times, does it use the cache or treat every instance separately?

Instances are not cached, but their types in the JIT system are. Every time you script an nn.Module, a type is created for in the JIT type system. This is reused if multiple instances of the same module are scripted in the same program, or even the same instance is scripted twice. The ScriptModule returned by torch.jit.script is always fresh and never from a cache, but it might refer to a type object that is cached.