Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table design doc #9210

Closed

Conversation

jacquesqiao
Copy link
Member

@jacquesqiao jacquesqiao commented Mar 19, 2018

fix: #9183
related issue: #9068

@typhoonzero
Copy link
Contributor

typhoonzero commented Mar 20, 2018

Sorry, I'm afraid we don't need this type of variable for the following reason.

  1. One tensor distributed on multiple servers could do the same thing. Because the size of the table can be determined before training, distribute this tensor by dim0 and lookup the id by calculating the index boundaries of the servers.
  2. If it's for an outside server, we'll only need to merge the keys to a SelectedRows variable.

@jacquesqiao
Copy link
Member Author

jacquesqiao commented Mar 20, 2018

The main problem is that in large scale embedding, the feature_id(int64_t) is discrete in a very big range, it's hard to represent it by Tensor or SelectedRows, for both of them use a dense tensor that the shape of memory should be decided before running.

So we need a new Variable that works like a key-value store or a map. It can:

  1. get value by key.
  2. store data that key is not continuous.

@typhoonzero
Copy link
Contributor

@jacquesqiao I see, I figure it out now, thank you very much I'll look into the design.

@typhoonzero
Copy link
Contributor

I've talked to @jacquesqiao today that we can use SelectedRows as the sparse weight table directly and decide which server should an id be put on by id % server_count.

@jacquesqiao
Copy link
Member Author

jacquesqiao commented Mar 20, 2018

yes, SelectedRows can support the need for the distributed lookup table. It's structure is

struct SelectedRows {
  Vector<int64_t> rows_;
  std::unique_ptr<Tensor> value_{nullptr};
  int64_t height_;
}

rows_ can be used to store the ids with the same shard_id
value_ store a dense matrix, user can get the value of a id using id's offset in the rows_.

distributed lookup table automation moved this from In progress to Done Mar 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Add Table Var Type Design
2 participants