Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Recommenders team Recommenders A2SVD Model

From Leeroopedia
Revision as of 16:28, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Recommenders_team_Recommenders_A2SVD_Model.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Recommendation Systems, Deep Learning, Sequential Recommendation
Last Updated 2026-02-10 00:00 GMT

Overview

Implements the A2SVD (Attentive Asynchronous Singular Value Decomposition) model, which extends ASVD with an attention mechanism for sequential recommendation.

Description

The A2SVDModel class extends SequentialBaseModel and implements the _build_seq_graph method to construct the sequential recommendation graph. The model concatenates item_history_embedding and cate_history_embedding into a single history input tensor. It then applies a soft alignment attention mechanism (via the base class's _attention method with a configurable attention_size) to learn the importance weights of different historical interactions. The attention-weighted outputs are summed across the sequence dimension using tf.reduce_sum to produce a fixed-size user representation called the ASVD output. The final model_output is the concatenation of this user representation with the target_item_embedding, which is then passed through the fully connected network for prediction.

The model is based on two papers: the original ASVD by Y. Koren (KDD 2008) which proposed factorization with implicit feedback, and A2SVD by Z. Yu et al. (IJCAI 2019) which added the attention mechanism for adaptive user modeling.

Usage

Use this model as a baseline attention-based sequential recommender when you want a simple but effective approach to capture user preferences from interaction history. It is suitable as a starting point before moving to more complex models like SLI_REC.

Code Reference

Source Location

Signature

class A2SVDModel(SequentialBaseModel):
    def _build_seq_graph(self)

Import

from recommenders.models.deeprec.models.sequential.asvd import A2SVDModel

I/O Contract

Inputs

Name Type Required Description
self.item_history_embedding tf.Tensor Yes Embedding tensor of the user's item interaction history
self.cate_history_embedding tf.Tensor Yes Embedding tensor of the corresponding category history
self.target_item_embedding tf.Tensor Yes Embedding tensor of the target item being scored
hparams.attention_size int Yes Dimensionality of the attention layer

Outputs

Name Type Description
return tf.Tensor Concatenation of the attention-weighted user representation and target item embedding, passed to the FCN for final scoring

Usage Examples

Basic Usage

from recommenders.models.deeprec.models.sequential.asvd import A2SVDModel
from recommenders.models.deeprec.deeprec_utils import prepare_hparams

# Prepare hyperparameters from YAML config
hparams = prepare_hparams("recommenders/models/deeprec/config/asvd.yaml")

# Create and train the A2SVD model
model = A2SVDModel(hparams, iterator_creator)
model.fit(train_file, valid_file)

# Evaluate the model
eval_results = model.run_eval(test_file)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment