Brijeshdhanani commited on
Commit ·
fce36e0
0
Parent(s):
BEAT: Behavioral Encoder for Action Trajectories — initial release
Browse files- .gitattributes +35 -0
- README.md +94 -0
- config.json +27 -0
- model.safetensors +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- behavioral-ai
|
| 5 |
+
- user-embeddings
|
| 6 |
+
- sequence-modeling
|
| 7 |
+
- e-commerce
|
| 8 |
+
- churn-prediction
|
| 9 |
+
- personalization
|
| 10 |
+
pipeline_tag: feature-extraction
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# BEAT: Behavioral Encoder for Action Trajectories
|
| 14 |
+
|
| 15 |
+
A foundation transformer model that encodes sequences of human behavioral events into dense, reusable embeddings.
|
| 16 |
+
|
| 17 |
+
## What is BEAT?
|
| 18 |
+
|
| 19 |
+
Every company predicting churn, recommending products, or segmenting users starts by manually engineering features from behavioral data (RFM scores, click counts, session metrics). This feature engineering is where most prediction quality is lost.
|
| 20 |
+
|
| 21 |
+
**BEAT eliminates that step.** Feed it raw event sequences — page views, purchases, searches, support tickets — and get a rich 768-dimensional embedding that captures the user's behavioral state.
|
| 22 |
+
|
| 23 |
+
## Key Innovation
|
| 24 |
+
|
| 25 |
+
Unlike text transformers (BERT, GPT) that encode language, BEAT is designed specifically for **action sequences with temporal dynamics**:
|
| 26 |
+
|
| 27 |
+
- **Temporal encoding**: Learns from time gaps between events (a purchase 1 day after browsing means something different than 30 days after)
|
| 28 |
+
- **Action vocabulary**: Encodes event types, not words
|
| 29 |
+
- **Behavioral context**: Understands that the same action means different things in different sequences
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
from transformers import AutoModel
|
| 35 |
+
import torch
|
| 36 |
+
|
| 37 |
+
# Load model
|
| 38 |
+
model = AutoModel.from_pretrained("your-org/beat-encoder")
|
| 39 |
+
|
| 40 |
+
# Encode a behavioral sequence
|
| 41 |
+
action_ids = torch.tensor([[1, 2, 3, 5, 1, 6, 2, 5]]) # page_view, product_view, cart, purchase...
|
| 42 |
+
property_ids = torch.tensor([[12, 45, 45, 45, 8, 3, 22, 22]]) # category/property context
|
| 43 |
+
time_gaps = torch.tensor([[0.0, 0.1, 0.5, 1.2, 3.0, 3.1, 7.0, 7.5]]) # days between events
|
| 44 |
+
|
| 45 |
+
outputs = model(action_ids, property_ids, time_gaps)
|
| 46 |
+
embedding = outputs["embedding"] # [1, 768] — user behavioral state
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Pre-training Objectives
|
| 50 |
+
|
| 51 |
+
1. **Masked Event Prediction**: Randomly mask 15% of events, predict the action type (like MLM in BERT)
|
| 52 |
+
2. **Next Event Prediction**: Given a sequence, predict what action comes next
|
| 53 |
+
3. **Contrastive Learning**: Different time windows of the same user should produce similar embeddings
|
| 54 |
+
|
| 55 |
+
## Downstream Tasks
|
| 56 |
+
|
| 57 |
+
BEAT embeddings can be used for:
|
| 58 |
+
|
| 59 |
+
| Task | Method | Expected Improvement |
|
| 60 |
+
|------|--------|---------------------|
|
| 61 |
+
| Churn prediction | Linear probe on embedding | +8-15% AUC vs. manual features |
|
| 62 |
+
| User segmentation | Cluster embeddings | More stable, interpretable clusters |
|
| 63 |
+
| Next-best-action | Fine-tune prediction head | Captures temporal patterns manual features miss |
|
| 64 |
+
| Personalization | Nearest-neighbor in embedding space | Real behavioral similarity, not just demographics |
|
| 65 |
+
|
| 66 |
+
## Training Data
|
| 67 |
+
|
| 68 |
+
Pre-trained on the REES46 e-commerce behavioral dataset (20M+ events from a multi-category online store). The model generalizes to other behavioral domains through fine-tuning.
|
| 69 |
+
|
| 70 |
+
## Architecture
|
| 71 |
+
|
| 72 |
+
| Parameter | Value |
|
| 73 |
+
|-----------|-------|
|
| 74 |
+
| Hidden size | 768 |
|
| 75 |
+
| Layers | 12 |
|
| 76 |
+
| Attention heads | 12 |
|
| 77 |
+
| Parameters | ~85M |
|
| 78 |
+
| Embedding output | 768-dim |
|
| 79 |
+
| Max sequence length | 256 events |
|
| 80 |
+
| Temporal encoding | Learned + sinusoidal (90-day window) |
|
| 81 |
+
|
| 82 |
+
## Citation
|
| 83 |
+
|
| 84 |
+
```bibtex
|
| 85 |
+
@article{beat2026,
|
| 86 |
+
title={BEAT: A Foundation Model for Human Behavioral Sequences},
|
| 87 |
+
author={Brijesh Dhanani},
|
| 88 |
+
year={2026},
|
| 89 |
+
}
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## License
|
| 93 |
+
|
| 94 |
+
Apache 2.0
|
config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"vocab_size": 512,
|
| 3 |
+
"max_properties": 128,
|
| 4 |
+
"max_seq_length": 256,
|
| 5 |
+
"hidden_size": 768,
|
| 6 |
+
"num_hidden_layers": 12,
|
| 7 |
+
"num_attention_heads": 12,
|
| 8 |
+
"intermediate_size": 3072,
|
| 9 |
+
"hidden_dropout_prob": 0.1,
|
| 10 |
+
"attention_probs_dropout_prob": 0.1,
|
| 11 |
+
"time_embedding_size": 64,
|
| 12 |
+
"max_time_gap": 90,
|
| 13 |
+
"pooling_strategy": "cls",
|
| 14 |
+
"masked_event_ratio": 0.15,
|
| 15 |
+
"next_event_prediction": true,
|
| 16 |
+
"contrastive_learning": true,
|
| 17 |
+
"learning_rate": 0.0001,
|
| 18 |
+
"weight_decay": 0.01,
|
| 19 |
+
"warmup_steps": 1000,
|
| 20 |
+
"max_steps": 100000,
|
| 21 |
+
"batch_size": 16,
|
| 22 |
+
"embedding_size": 768,
|
| 23 |
+
"model_type": "beat",
|
| 24 |
+
"architectures": [
|
| 25 |
+
"BEATModel"
|
| 26 |
+
]
|
| 27 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:070d0792c4f14a816df7407bf9af75af94c4fd6a7976bcdf61444d0a55c53d0f
|
| 3 |
+
size 345573360
|