### Problem 1: The lookup table may be very large.
The forward algorithm requires a distributed storage service for W.
The backward algorithm prefers that the storage system can apply the
In condition like search engien and recommendation system, the number of feature ID may be very large, see 1000000000, then for a lookup table of size 8, the total size of the table is:
optimization algorithm on W. The following two sections describe two
solutions -- the former doesn't require that the storage service can
```
do optimization, the latter does.
100000000000 * 8 * 4.0 = 2980.23 GB
```
### Storage Service Doesn't Optimize
### Solution: Distributed storage
In this design, we use highly-optimized distributed storage, e.g.,
memcached, as the storage service, and we run the optimization
1. Paddle use SelectedRows as the storage format for the lookup table, the lookup table parameter will be splited to multi machine according to the hash of the feature ID, and data will also be splited and send to the same machine to prefetch the parameter.
algorithm on parameter servers of PaddlePaddle. The following figure
illustrates the training process.
1. For common parameters, trainer will get the whole parameter for training, but for the big lookup table, trainer can not store the whole parameter, but the input data feature is very sparse, so every time we only need a few parameter for training, so we use `prefetch_op` to only prefetch the parameter needed to trainer.
<!--
### Problem 2. The Id in the lookup table is not sure before training.
Note: please update the following URL when update this digraph.
<img src='https://g.gravizo.com/svg?
The feature Id is calculated by hash function, because the feature data source is so large, we can not get all the id before training. So we can not initialize the table before training.
digraph G {
rankdir="LR";
subgraph cluster1 {
### Solution: Id auto growth
P1 [label="pserver 1"];
P2 [label="pserver 2"];
At the beginning of training, paddle only malloc the memory for the lookup table at pserver side, the id and the data will not be initialized. During training, when a pserver recived a Id, if the is is already in the lookup table, it will return the exist parameter, if the id is not exist, paddle will add it into the lookup table and initialize the value for it.
T1 [label="trainer 1"];
T2 [label="trainer 2"];
T3 [label="trainer 3"];
## Architecture
}
The whole architecture of the distribute lookup table is as below:
KV [label="memcached"];
T1 -> P1;
### Training steps:
T1 -> P2;
1. Read a batch of data, the data is feature ids.
T2 -> P1;
1. The input ids will be splited by `split_ids_op` with the same hash function of the lookup table.
T2 -> P2;
1. The `prefetch_op` use the splited result to prefetch parameters back from lookup table.
T3 -> P1;
1. Run forward backward to get the the gradient of the lookup table.
T3 -> P2;
1.`split_ids_op` split the gradient and then use `send_op` to parameter server.
P1 -> KV [color=gray, weight=0.1];
1. parameter server update the table with the received gradient.