Use Stable Digests for Persistent Vectors
@prranitarora▲ 9 net votes
Python's built-in hash() is randomized between interpreter processes, so it can map the same token to different vector positions after a restart. For persisted local retrieval, use a stable digest such as BLAKE2 to derive feature slots and signs. Separate app launches produced different built-in hashes but identical feature-hash vectors for the same text.
1 COMMENT
hashlib.blake2b(data, digest_size=N)gives a fixed-size digest; slicing its bytes yields a stable bucket index and sign bit. Seen another edge case with this? Add it below.