StreamProfileBench
Streaming user-interest profiling benchmark for Chinese social media platforms. Each task asks an LLM to (a) maintain a rolling persona summary from a stream of a user's posts, and (b) predict which tags from a curated candidate pool the user will engage with in the next time window.
The benchmark evaluates two coupled abilities:
- Plasticity — picking up newly emerging interests (
Recall_Novelty). - Stability — retaining persisting interests (
Recall_Stability).
It also probes robustness against four classes of distractors (peer-cluster, viral, decayed, random), and forward transfer from accumulated personas.
Repository layout
streamprofile_bench_release/
├── bench_inference.py # main runner: inference + scoring (and --reeval)
├── bench_task.py # prompt formatter (PLATFORM_CONTEXT + format_prompt)
├── stats.py # aggregate eval reports across models into Excel
├── sample_subset.py # sample N% of users per platform for cheap dry-runs
├── data/
│ ├── weibo_inference_tasks.jsonl
│ ├── xiaohongshu_inference_tasks.jsonl
│ ├── toutiao_inference_tasks.jsonl
│ ├── zhihu_inference_tasks.jsonl
│ └── douban_inference_tasks.jsonl
├── requirements.txt
├── LICENSE # Apache-2.0
└── README.md
Install
pip install -r requirements.txt
Python 3.9+.
Quick start
export LLM_API_KEY="sk-..."
export LLM_API_BASE="https://api.openai.com/v1" # any OpenAI-compatible endpoint
# Single platform
python bench_inference.py --model gpt-4o-mini --platform weibo
# All five platforms
python bench_inference.py --model gpt-4o-mini
Outputs go to results/<model>/:
inference_results_<platform>.jsonl— per-user, per-step predictions, ground truth, persona summaries, and metrics.eval_report_<platform>.txt— text report (M_bar,F1^NS,FWT, cold-start vs persona-augmented, learning curve).
Re-evaluate without re-running the model
If you change metric definitions or want to recompute scores from saved predictions, no API calls needed:
python bench_inference.py --model gpt-4o-mini --reeval
python bench_inference.py --model gpt-4o-mini --platform weibo --reeval
This rewrites the metrics field in each inference_results_<platform>.jsonl
and produces a fresh eval_report_<platform>.txt.
Cheap dry-run on a 20% subset
python sample_subset.py --ratio 0.2
# produces data/<platform>_inference_tasks_sub20.jsonl
To use the subset, point bench_inference.py at the sub-files (e.g. by
renaming, symlinking, or temporarily editing DATA_DIR).
Aggregate results across models into Excel tables
python stats.py
# writes metric_excels/{Precision,Recall,F1^NS,...}.xlsx
Each Excel file has one row per model, one column per platform (plus an
Avg. column).
Configuration
| Variable | Purpose | Default |
|---|---|---|
LLM_API_KEY |
API key for your LLM provider | (required) |
LLM_API_BASE |
OpenAI-compatible base URL | (required) |
LLM_INSECURE_TLS |
Set 1 to skip TLS verification (e.g. for self-signed dev) |
0 |
BENCH_MAX_WORKERS |
Parallel inference threads | 16 |
--model |
Model name passed to the API | (required) |
--api_url/--api_key |
Override the env vars | unset |
--platform |
One of weibo / xiaohongshu / toutiao / zhihu / douban |
all |
--reeval |
Skip inference; re-score saved predictions | off |
Data format
One JSON object per line in each data/<platform>_inference_tasks.jsonl:
{
"user_id": "we_16d82b9a92",
"platform": "weibo",
"username": "U_010ada10",
"bio": "...",
"total_steps": 4,
"prediction_tasks": [
{
"step_id": 1,
"total_steps": 4,
"date_input": "2025-06-12",
"date_target": "2025-06-17",
"posts_text": "[1] Content: ...\nTags: ...\n[2] ...",
"candidate_pool": ["tag1", "tag2", ...],
"ground_truth": {
"all_tags": ["..."],
"new_tags": ["..."],
"keep_tags": ["..."]
},
"meta": {
"T_keep": ["..."],
"T_new": ["..."],
"D_decay": ["..."],
"D_cluster":["..."],
"D_viral": ["..."],
"D_random": ["..."]
}
}
]
}
Per platform / step the candidate pool is pre-built as
pool_size = clip(|GT|·4, [10, 50]) with the remaining slots filled with
distractors of four types:
- D_decay — tags the user engaged with in the current batch but does not carry forward (interests on the way out).
- D_cluster — tags from the same semantic cluster as the GT (peer-cluster distractors).
- D_viral — tags trending platform-wide on the target date (popular but irrelevant).
- D_random — tags sampled uniformly from the platform's tag vocabulary.
Ground truth is T_new ∪ T_keep, where T_keep = current ∩ future and
T_new = future \ current.
Metrics
| Metric | Definition |
|---|---|
| Precision | ` |
| Recall | ` |
| Recall_Novelty | Recall restricted to T_new (plasticity) |
| Recall_Stability | Recall restricted to T_keep (stability) |
| F1^NS | Harmonic mean of Recall_Novelty and Recall_Stability, per user, then macro-averaged |
| Error_Peer | False-positive rate on D_cluster (lower is better) |
| Error_Viral | False-positive rate on D_viral |
| Error_Decay | False-positive rate on D_decay |
| Error_Random | False-positive rate on D_random |
| FWT | Forward transfer: mean(M_{t≥2}) − M_{t=1}, per metric |
Aggregation in the report:
M_bar— within-user mean across steps, then macro mean across users.- Cold-start vs persona-augmented — same aggregation on
step_id == 1vsstep_id ≥ 2, plus the delta. Quantifies the value of carrying personas. - Learning curve — per
step_idposition, mean across users.
Anonymization notes
This release uses anonymized identifiers:
user_idis a hash prefixed with the platform code (we_weibo,xi_xiaohongshu,to_toutiao,zh_zhihu,do_douban).usernamevalues are replaced with placeholders of the formU_xxxxxxx.- Free-text fields (
bio,posts_text) retain user-generated content as collected; we do not redact post bodies.
If you find any residual PII please open an issue.
Citation
@misc{streamprofilebench2026,
title = {StreamProfileBench: Streaming User-Interest Profiling on Chinese Social Media},
author = {...},
year = {2026},
howpublished = {GitHub},
url = {...}
}
License
Apache License 2.0. See LICENSE.