that’s a bit too generic…

do you really want to measure separation using distances in discrete space, like hamming distance? or you seek a solution for continuous numbers?
assuming continuous, will “autonomous” transformation suffice, or should it support gradient flow before/after? i.e. should separation measure form an auxiliary loss term for another task?