SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.06043 · 2024

Modeling User Retention through Generative Flow Networks

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2406.06043.json · badge: /api/ran/2406.06043.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Applied-Machine-Learning-Lab/GFN4Retention canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
dot_scorer Ran
ran; our contract draft was wrong, not the code
Applied-Machine-Learning-Lab/GFN4Retention/code/model/score_func.py
code served (permissive licence) · get_code("45b46ab38b9745cc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Parameters for dot_scorer
batch_size = 2
item_dim = 4
num_items = 3

# action_emb: (B, i_dim)
action_emb = torch.randn(batch_size, item_dim)

# item_emb: (B, L, i_dim) or (1, L, i_dim)
# Using (B, L, i_dim) shape
item_emb = torch.randn(batch_size, num_items, item_dim)

# item_dim: scalar integer
item_dim_param = item_dim

ARGS = {
    "action_emb": action_emb,
    "item_emb": item_emb,
    "item_dim": item_dim_param,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_immediate_reward Ran
ran, honoured the contract we drafted
Applied-Machine-Learning-Lab/GFN4Retention/code/model/reward.py
code served (permissive licence) · get_code("46cb49a73008632e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct user_feedback dictionary
B = 2  # batch size
slate_size = 3  # number of items in slate
n_feedback = 4  # number of feedback dimensions

immediate_response = torch.randn(B, slate_size, n_feedback)
immediate_response_weight = torch.randn(n_feedback)

user_feedback = {
    'immediate_response': immediate_response,
    'immediate_response_weight': immediate_response_weight,
}

ARGS = {
    'user_feedback': user_feedback,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_immediate_reward_sum Ran
ran, honoured the contract we drafted
Applied-Machine-Learning-Lab/GFN4Retention/code/model/reward.py
code served (permissive licence) · get_code("024f29f8a954659e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct user_feedback dict with required keys
batch_size = 2
slate_size = 3
n_feedback = 4

immediate_response = torch.randn(batch_size, slate_size, n_feedback)
immediate_response_weight = torch.randn(n_feedback)

user_feedback = {
    'immediate_response': immediate_response,
    'immediate_response_weight': immediate_response_weight,
}

ARGS = {
    'user_feedback': user_feedback,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_retention_reward Ran
ran, honoured the contract we drafted
Applied-Machine-Learning-Lab/GFN4Retention/code/model/reward.py
code served (permissive licence) · get_code("45312907afe58a3b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct user_feedback dict with retention key
# The function accesses user_feedback['retention'] and expects shape (B,)
# where B is batch size. Using batch size 2.
user_feedback = {
    'retention': torch.tensor([0.5, 0.3], dtype=torch.float32)
}

# reward_base parameter has default value 0.7, but we can override it
reward_base = 0.7

ARGS = {
    'user_feedback': user_feedback,
    'reward_base': reward_base
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
linear_scorer Ran
ran; our contract draft was wrong, not the code
Applied-Machine-Learning-Lab/GFN4Retention/code/model/score_func.py
code served (permissive licence) · get_code("4cc3922a7108033d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Parameters:
# - action_emb: (B, (i_dim+1)) - batch of action embeddings
# - item_emb: (B, L, i_dim) or (1, L, i_dim) - batch of item embeddings
# - item_dim: int - dimension of items

B = 2  # batch size
L = 5  # number of items (sequence length)
item_dim = 4  # item embedding dimension

# action_emb should be (B, item_dim+1)
# It contains weights of shape (item_dim,) and a bias (1,)
action_emb = torch.randn(B, item_dim + 1)

# item_emb should be (B, L, item_dim) or (1, L, item_dim)
item_emb = torch.randn(B, L, item_dim)

ARGS = {
    "action_emb": action_emb,
    "item_emb": item_emb,
    "item_dim": item_dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 5) — shape (2, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
two_layer_mlp_scorer Ran
ran; our contract draft was wrong, not the code
Applied-Machine-Learning-Lab/GFN4Retention/code/model/score_func.py
code served (permissive licence) · get_code("8c19396be7b460b1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Analyze the function signature and body:
# - action_emb: (B, (i_dim+1)*f_dim+f_dim+1) - packed embedding containing weights and biases
# - item_emb: (B, L, i_dim) or (1, L, i_dim) - item embeddings
# - item_dim: int - dimension of items (i_dim)
# - hidden_dim: int - hidden dimension (f_dim)

# The function uses:
# - action_emb slicing and view operations
# - item_emb in matmul with reshaped tensors
# - F.leaky_relu, torch.sum, torch.matmul

# Let's work backwards from the expected shapes:
# action_emb needs shape: (B, item_dim * hidden_dim + hidden_dim + hidden_dim + 1)
#                      = (B, (item_dim + 2) * hidden_dim + 1)

item_dim = 4
hidden_dim = 3
batch_size = 2
num_items = 5  # L dimension

# action_emb shape: (B, (item_dim + 2) * hidden_dim + 1)
action_emb_size = (item_dim + 2) * hidden_dim + 1
action_emb = torch.randn(batch_size, action_emb_size)

# item_emb shape: (B, L, item_dim)
item_emb = torch.randn(batch_size, num_items, item_dim)

ARGS = {
    "action_emb": action_emb,
    "item_emb": item_emb,
    "item_dim": item_dim,
    "hidden_dim": hidden_dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 5) — shape (2, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 0 later) and 1 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
dot_scorer 3 other papers
3 dated earlier
2306.02239 (2023-06)
Generative Flow Network for Listwise Recommendation
2309.12645 (2023-09)
KuaiSim: A Comprehensive Simulator for Recommender Systems
2401.16108 (2024-01)
Future Impact Decomposition in Request-level Recommendations
linear_scorer 3 other papers
3 dated earlier
2306.02239 (2023-06)
Generative Flow Network for Listwise Recommendation
2309.12645 (2023-09)
KuaiSim: A Comprehensive Simulator for Recommender Systems
2401.16108 (2024-01)
Future Impact Decomposition in Request-level Recommendations
two_layer_mlp_scorer 3 other papers
3 dated earlier
2306.02239 (2023-06)
Generative Flow Network for Listwise Recommendation
2309.12645 (2023-09)
KuaiSim: A Comprehensive Simulator for Recommender Systems
2401.16108 (2024-01)
Future Impact Decomposition in Request-level Recommendations
get_immediate_reward 1 other paper
1 dated earlier
2309.12645 (2023-09)
KuaiSim: A Comprehensive Simulator for Recommender Systems
get_immediate_reward_sum 1 other paper
1 dated earlier
2309.12645 (2023-09)
KuaiSim: A Comprehensive Simulator for Recommender Systems

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Recommender systems aim to fulfill the user's daily demands. While most existing research focuses on maximizing the user's engagement with the system, it has recently been pointed out that how frequently the users come back for the service also reflects the quality and stability of recommendations. However, optimizing this user retention behavior is non-trivial and poses several challenges including the intractable leave-and-return user activities, the sparse and delayed signal, and the uncertain relations between users' retention and their immediate feedback towards each item in the recommendation list. In this work, we regard the retention signal as an overall estimation of the user's end-of-session satisfaction and propose to estimate this signal through a probabilistic flow. This flow-based modeling technique can back-propagate the retention reward towards each recommended item in the user session, and we show that the flow combined with traditional learning-to-rank objectives eventually optimizes a non-discounted cumulative reward for both immediate user feedback and user retention. We verify the effectiveness of our method through both offline empirical studies on two public datasets and online A/B tests in an industrial platform.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2406.06043")
get_code_for_paper("2406.06043")
have("2406.06043")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2406.06043.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2406.06043.svg)](https://syntology.ai/paper/2406.06043)

Connect an agent — have() is free.