3 ms·
General purpose compressors and information distance measures have become super interesting to me while I've been investigating alternative language models. I'
by bob1029 3y ago
General purpose compressors and information distance measures have become super interesting to me while I've been investigating alternative language models.
I've been playing around with an attention mechanism that combines the idea of using normalized compression distance (gzip) with discrete convolution between candidate sequences (sliding window of N bytes over each). Another round of normalization over the convolution outputs - accommodating varying lengths - allows for us to compare candidate sequences for relevant information on equal grounds.
The NCD formula I am using right now:
NCD(x,y) = (C(xy) - MIN(C(x),C(y))) / MAX(C(x),C(y))
No weird parameters or any other things to tune. The only parameters are the source documents and the input context/query.
- tripzilch 3y agoSo, if I understand your sliding window explanation right, would the distance between two strings X and Y then be a feature vector of all the NCDs of its windows? Kind of reminds me of auto correlation :) Also, just a note about your NCD formula, if C(xy) is the compressed size of the concatenation of x and y, then I would recommend also trying (C(xy)+C(yx))/2 for that term, because a lot of compressors don't compress xy the same as yx, and you probably want your distance to be symmetrical.