# salmon1802/unirank architecture

> Architecture diagram of the GitHub repository salmon1802/unirank, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/salmon1802/unirank
- Repository: https://github.com/salmon1802/unirank

## Overview

UniRank is a PyTorch benchmark and toolkit for unified sequential recommendation ranking. Its principal workflow is to preprocess industrial event data into model-ready datasets, configure features and models, train/evaluate rankers, and compare multi-feedback metrics. The graph preserves the five-dataset preprocessing capability, the architecture zoo, and the reusable training and evaluation layers. The README documents the benchmark stages; source-level edges are limited to relationships visible in excerpts or the SOURCE INDEX.

Main entry points: [`model_zoo`](https://github.com/salmon1802/unirank/tree/main/model_zoo) (Architecture zoo), [`run_expid.py`](https://github.com/salmon1802/unirank/blob/main/run_expid.py) (Experiment runner), [`unirank/pytorch/models/rank_model.py`](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/models/rank_model.py) (Ranker lifecycle), [`data`](https://github.com/salmon1802/unirank/tree/main/data) (Dataset preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_preprocess["Dataset preprocessing"]
  node_stats["Dataset statistics"]
  node_build_dataset["Dataset builder<br/>[build_dataset.py]"]
  node_feature_processing["Feature processing"]
  node_tokenizer["Data tokenizer<br/>[tokenizer.py]"]
  node_feature_map["Feature map<br/>[features.py]"]
end

subgraph group_model["Ranking models"]
  node_zoo["Architecture zoo"]
end

subgraph group_runtime["Training runtime"]
  node_experiment["Experiment runner<br/>[run_expid.py]"]
  node_autotuner["Parameter tuning<br/>[autotuner.py]"]
  node_loader["Blocked data loader"]
  node_rank_model["Ranker lifecycle<br/>[rank_model.py]"]
  node_multitask["Multi-task model<br/>[multitask_model.py]"]
  node_metrics["Ranking metrics<br/>[metrics.py]"]
  node_torch_utils["Torch runtime utilities<br/>[torch_utils.py]"]
end

subgraph group_layers["Model components"]
  node_embedding["Feature embeddings"]
  node_pretrained_embedding["Pretrained embeddings"]
  node_tokenization_layers["Model tokenizers"]
  node_attention["Attention layers"]
  node_interactions["Token interactions"]
  node_pooling["Pooling layers<br/>[pooling.py]"]
end

node_researcher(("Benchmark user"))
node_industrial_data[("Industrial datasets")]

node_researcher -->|"configures runs"| node_experiment
node_industrial_data -->|"provides events"| node_preprocess
node_preprocess -.->|"prepares inputs"| node_build_dataset
node_preprocess -->|"summarizes outputs"| node_stats
node_experiment -->|"builds dataset"| node_build_dataset
node_experiment -->|"loads features"| node_feature_map
node_experiment -->|"uses loader"| node_loader
node_experiment -->|"selects model"| node_zoo
node_experiment -.->|"trains ranker"| node_rank_model
node_autotuner -.->|"tunes parameters"| node_experiment
node_build_dataset -->|"processes features"| node_feature_processing
node_feature_processing -->|"uses feature definitions"| node_feature_map
node_feature_processing -->|"uses tokenizer"| node_tokenizer
node_loader -->|"uses utilities"| node_torch_utils
node_rank_model -->|"evaluates with"| node_metrics
node_rank_model -->|"uses utilities"| node_torch_utils
node_zoo -.->|"extends ranker base"| node_rank_model
node_zoo -->|"uses embeddings"| node_embedding
node_embedding -->|"supports pretrained"| node_pretrained_embedding
node_zoo -->|"uses tokenizers"| node_tokenization_layers
node_zoo -.->|"uses attention"| node_attention
node_zoo -.->|"uses interactions"| node_interactions
node_zoo -.->|"uses pooling"| node_pooling
node_multitask -->|"extends base model"| node_rank_model

click node_preprocess "https://github.com/salmon1802/unirank/tree/main/data"
click node_stats "https://github.com/salmon1802/unirank/blob/main/data/dataset_stats_utils.py"
click node_build_dataset "https://github.com/salmon1802/unirank/blob/main/unirank/preprocess/build_dataset.py"
click node_feature_processing "https://github.com/salmon1802/unirank/blob/main/unirank/preprocess/feature_processor.py"
click node_tokenizer "https://github.com/salmon1802/unirank/blob/main/unirank/preprocess/tokenizer.py"
click node_feature_map "https://github.com/salmon1802/unirank/blob/main/unirank/features.py"
click node_experiment "https://github.com/salmon1802/unirank/blob/main/run_expid.py"
click node_autotuner "https://github.com/salmon1802/unirank/blob/main/autotuner.py"
click node_loader "https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/dataloaders/unirank_dataloader.py"
click node_rank_model "https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/models/rank_model.py"
click node_multitask "https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/models/multitask_model.py"
click node_metrics "https://github.com/salmon1802/unirank/blob/main/unirank/metrics.py"
click node_torch_utils "https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/torch_utils.py"
click node_zoo "https://github.com/salmon1802/unirank/tree/main/model_zoo"
click node_embedding "https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/layers/embeddings/feature_embedding.py"
click node_pretrained_embedding "https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/layers/embeddings/pretrained_embedding.py"
click node_tokenization_layers "https://github.com/salmon1802/unirank/tree/main/unirank/pytorch/layers/tokenization"
click node_attention "https://github.com/salmon1802/unirank/tree/main/unirank/pytorch/layers/attentions"
click node_interactions "https://github.com/salmon1802/unirank/tree/main/unirank/pytorch/layers/interactions"
click node_pooling "https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/layers/pooling.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_preprocess,node_stats,node_build_dataset,node_feature_processing,node_tokenizer,node_feature_map,node_researcher toneBlue
class node_zoo,node_industrial_data toneAmber
class node_experiment,node_autotuner,node_loader,node_rank_model,node_multitask,node_metrics,node_torch_utils toneMint
class node_embedding,node_pretrained_embedding,node_tokenization_layers,node_attention,node_interactions,node_pooling toneRose
```

## Components

### Data preparation

- [Dataset preprocessing](https://github.com/salmon1802/unirank/tree/main/data): `data`
- [Dataset statistics](https://github.com/salmon1802/unirank/blob/main/data/dataset_stats_utils.py): `data/dataset_stats_utils.py`
- [Dataset builder](https://github.com/salmon1802/unirank/blob/main/unirank/preprocess/build_dataset.py): `unirank/preprocess/build_dataset.py`
- [Feature processing](https://github.com/salmon1802/unirank/blob/main/unirank/preprocess/feature_processor.py): `unirank/preprocess/feature_processor.py`
- [Data tokenizer](https://github.com/salmon1802/unirank/blob/main/unirank/preprocess/tokenizer.py): `unirank/preprocess/tokenizer.py`
- [Feature map](https://github.com/salmon1802/unirank/blob/main/unirank/features.py): `unirank/features.py`

### Ranking models

- [Architecture zoo](https://github.com/salmon1802/unirank/tree/main/model_zoo): `model_zoo`

### Training runtime

- [Experiment runner](https://github.com/salmon1802/unirank/blob/main/run_expid.py): `run_expid.py`
- [Parameter tuning](https://github.com/salmon1802/unirank/blob/main/autotuner.py): `autotuner.py`
- [Blocked data loader](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/dataloaders/unirank_dataloader.py): `unirank/pytorch/dataloaders/unirank_dataloader.py`
- [Ranker lifecycle](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/models/rank_model.py): `unirank/pytorch/models/rank_model.py`
- [Multi-task model](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/models/multitask_model.py): `unirank/pytorch/models/multitask_model.py`
- [Ranking metrics](https://github.com/salmon1802/unirank/blob/main/unirank/metrics.py): `unirank/metrics.py`
- [Torch runtime utilities](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/torch_utils.py): `unirank/pytorch/torch_utils.py`

### Model components

- [Feature embeddings](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/layers/embeddings/feature_embedding.py): `unirank/pytorch/layers/embeddings/feature_embedding.py`
- [Pretrained embeddings](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/layers/embeddings/pretrained_embedding.py): `unirank/pytorch/layers/embeddings/pretrained_embedding.py`
- [Model tokenizers](https://github.com/salmon1802/unirank/tree/main/unirank/pytorch/layers/tokenization): `unirank/pytorch/layers/tokenization`
- [Attention layers](https://github.com/salmon1802/unirank/tree/main/unirank/pytorch/layers/attentions): `unirank/pytorch/layers/attentions`
- [Token interactions](https://github.com/salmon1802/unirank/tree/main/unirank/pytorch/layers/interactions): `unirank/pytorch/layers/interactions`
- [Pooling layers](https://github.com/salmon1802/unirank/blob/main/unirank/pytorch/layers/pooling.py): `unirank/pytorch/layers/pooling.py`

### Other components

- **Benchmark user**
- **Industrial datasets**

## Connections

- Benchmark user → Experiment runner: configures runs (evidence: `README.md`)
- Industrial datasets → Dataset preprocessing: provides events (evidence: `README.md`)
- Dataset preprocessing → Dataset builder: prepares inputs
- Dataset preprocessing → Dataset statistics: summarizes outputs (evidence: `README.md`)
- Experiment runner → Dataset builder: builds dataset (evidence: `run_expid.py`)
- Experiment runner → Feature map: loads features (evidence: `run_expid.py`)
- Experiment runner → Blocked data loader: uses loader (evidence: `run_expid.py`)
- Experiment runner → Architecture zoo: selects model (evidence: `run_expid.py`)
- Experiment runner → Ranker lifecycle: trains ranker
- Parameter tuning → Experiment runner: tunes parameters
- Dataset builder → Feature processing: processes features (evidence: `unirank/preprocess/feature_processor.py`)
- Feature processing → Feature map: uses feature definitions (evidence: `unirank/preprocess/feature_processor.py`)
- Feature processing → Data tokenizer: uses tokenizer (evidence: `unirank/preprocess/feature_processor.py`)
- Blocked data loader → Torch runtime utilities: uses utilities (evidence: `unirank/pytorch/dataloaders/unirank_dataloader.py`)
- Ranker lifecycle → Ranking metrics: evaluates with (evidence: `unirank/pytorch/models/rank_model.py`)
- Ranker lifecycle → Torch runtime utilities: uses utilities (evidence: `unirank/pytorch/models/rank_model.py`)
- Architecture zoo → Ranker lifecycle: extends ranker base
- Architecture zoo → Feature embeddings: uses embeddings (evidence: `model_zoo/OneTrans.py`)
- Feature embeddings → Pretrained embeddings: supports pretrained (evidence: `unirank/pytorch/layers/embeddings/feature_embedding.py`)
- Architecture zoo → Model tokenizers: uses tokenizers (evidence: `model_zoo/OneTrans.py`)
- Architecture zoo → Attention layers: uses attention
- Architecture zoo → Token interactions: uses interactions
- Architecture zoo → Pooling layers: uses pooling
- Multi-task model → Ranker lifecycle: extends base model (evidence: `unirank/pytorch/models/__init__.py`)
