UniTok icon indicating copy to clipboard operation
UniTok copied to clipboard

Multi-Codebook Quantization

Open JingfengYao opened this issue 1 year ago • 6 comments

Hi, congrats on the great work! It is really impressive to achieve both 0.38 rFID and 78.6% acc on ImageNet.

I am very interested in the design of Multi-Codebook Quantization (MCQ), which is mentioned in the paper. The motivation behind this approach is to avoid the potential issue of low codebook utilization that may arise with a large codebook. I’m curious to understand why this method works well. Additionally, I haven't found any quantitative metrics regarding codebook utilization in the paper. How much improvement in codebook utilization can MCQ achieve compared to a naive large codebook approach?

I really appreciate any help you can provide.

JingfengYao avatar Mar 03 '25 07:03 JingfengYao

Hi @JingfengYao, thanks for your interest in our work!

From VQGAN-LC, we can see that the codebook utilization rate of vanilla VQ tokenizers drops drastically when the codebook size goes over 16k. The case can become worse if we choose to do vector quantization at a higher latent space (e.g., 64-d in UniTok). Even though some tricks such as entropy loss could improve the utilization rate, vanilla tokenizers still suffer from diminished performance gains in scaling up the cookbook. MCQ avoids these problems by splitting a large codebook into independent and small sub-codebooks. And the combinatorial set of possible arrangements of sub-codes gives a much larger vocabulary size than the total number of codebook entries. In our experiments, the average utilization rate across sub-codebooks is above 99% without entropy loss.

machuofan avatar Mar 03 '25 10:03 machuofan

Amazing, thanks for your quick reply. By the way, I like your Menglan panda hhh.

JingfengYao avatar Mar 03 '25 10:03 JingfengYao

In the readme, the total token number may be 16x16x8, rather than 256?

faymek avatar Mar 14 '25 09:03 faymek

In the readme, the total token number may be 16x16x8, rather than 256?

UniTok encodes a token with 8 codes. Therefore, the shape of code indices is 16x16x8, but the number of token is 256, similar to RQ-VAE.

machuofan avatar Mar 14 '25 10:03 machuofan

congrats on the great work! if token length is 256, then vocubulary size is 2^56? I am confused with this.

sunset-clouds avatar Aug 30 '25 01:08 sunset-clouds

Amazing work! But I was wondering what is the difference between the Multi-codebook quantization proposed in this paper and product quantization? PQ seems to be proposed much earlier and is using a similiar method

zgcmx avatar Nov 17 '25 11:11 zgcmx