Searching the Photo Library

Learning to CompressMedium+20 XP+20

Searching the Photo Library

A shop wants a "find similar products" search over its library of NNN product photos. Each photo is 32×3232 \times 3232×32 pixels in colour (3 channels), so it is 307230723072 numbers.

Raw search. Each query photo is compared directly with every library photo, using one subtract-and-square per number.

Code search. An autoencoder has been trained. Its encoder squeezes a photo to a code of 323232 numbers through two fully connected layers, 3072→256→323072 \to 256 \to 323072→256→32. The whole library was encoded once, overnight, and that cost is not counted here. At search time the query photo is run through the encoder, and its code is compared with every library code, using one subtract-and-square per number.

Count cost in operations. A fully connected layer from nnn inputs to mmm outputs costs n×mn \times mn×m operations (ignore biases and activations), and one subtract-and-square costs one operation.

The speedup is the raw search's cost per query divided by the code search's cost per query.

What is the smallest library size NNN for which the speedup is at least 808080?

Give the exact whole number.

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.