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

What is gr_output_length specifically used for? #148

Open
yudonglee opened this issue Nov 27, 2024 · 1 comment
Open

What is gr_output_length specifically used for? #148

yudonglee opened this issue Nov 27, 2024 · 1 comment

Comments

@yudonglee
Copy link

Hi, I am very confused about the specific role of gr_output_length.

The length of hstu's input seq is (max_sequence_length + gr_output_length + 1),
For the 'gr_output_length' part, the corresponding historical_id is 0, as shown in the code below:

def movielens_seq_features_from_row(
    row: Dict[str, torch.Tensor],
    device: int,
    max_output_length: int,
) -> Tuple[SequentialFeatures, torch.Tensor, torch.Tensor]:
... ...
        B = historical_lengths.size(0)
        historical_ids = torch.cat(
            [
                historical_ids,
                torch.zeros(
                    (B, max_output_length), dtype=historical_ids.dtype, device=device
                ),
            ],
            dim=1,
        )
... ...

Since the corresponding historical_ids is 0, this part seems to have no effect on the final calculation result. So what is its purpose?
I wonder if it is related to your paper, where gr_output_length corresponds to the number of vectors in the user's multi-vector representation?

https://arxiv.org/pdf/2306.04039

@jiaqizhai
Copy link
Contributor

Hi, the 0 padding in the id sequence is due to our specific implementation of relative position bias. We use timestamp[j+1] - timestamp[i] to derive the delta time span from i to j (note here we autoregressively predict the j+1-th element) in our public experiments for sequential recommender (retrieval) settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants