P paper2skillsPlaybook
AI 路线图 →

LLM Session Personalization Cache — LLM 驱动的会话意图缓存与千人千面推荐

Skill-LLM-Session-Personalization-Cache · 05-推荐系统

causalexperimentforecastingrecommendationpricing推荐与搜索定价与利润WF-F 动态定价WF-G Listing内容优化WF-I 智能体工程WF-J DTC 独立站增长
年化 ROI¥40-120 万
实现难度⭐⭐⭐☆☆
业务视角
适用角色运营负责人 / 选品负责人 · 产品经理 · 广告优化师
适用平台Amazon · DTC 独立站 · 邮件/SMS 个性化
什么情况下用老客来了只买一件就走,相关产品没被推出去;Bundle 商品连带销售做不起来;站内推荐位点击率低
成功是什么样的老客连带购买率提升 20-35%,客单价提升,品类交叉销售做起来
业务痛点
老客复购率上不去相关产品没有被看到Bundle 凑单没人用新品没有曝光机会

1. 解决的问题

母婴独立站首页对所有用户展示相同商品,哺乳妈妈和奶爸看到的首屏完全一样导致CTR仅2.3%——LLM会话意图三层缓存(长期偏好+近期行为+即时session)驱动千人千面排序,首页CTR提升到4-5%,年化GMV增益40-120万元

2. 核心算法逻辑

传统会话推荐的痛点:用户当前 session 行为极少(平均37次点击),协同过滤没有足够信号推断意图。SPRINT 的解法:用 LLM 离线预生成用户意图画像(Intent Profile),缓存为向量,在线推理时直接检索而非实时调用 LLM。

3. 业务应用场景

业务问题:独立站首页对所有用户展示相同的商品排列——妈妈群体(关注吸奶器/哺乳配件)和奶爸群体(关注安全座椅/学步车)看到完全相同的首屏。首页 CTR 只有 2.3%,远低于行业 4-6% 的基准。

数据要求: - 用户历史浏览/加购/购买记录(近 90 天) - 商品属性向量(品类/价格带/年龄段适用/品牌) - 当前 session 实时行为流(需要前端埋点)

预期产出: - 每位用户的三层意图缓存:长期偏好 + 近期需求 + 实时意图 - 千人千面首页:基于意图缓存重排商品顺序 - 实时 CTR 预估:每次展示预估用户点击概率

4. 输入数据要求

请查看原始代码模板获取输入规格。

5. 输出结果

请查看原始代码模板获取输出规格。

6. 业务价值 / ROI

  • ROI 预估
  • 独立站首页千人千面:CTR 从 2.3% 提升到 4-5%,月增流量价值 ¥10-30 万
  • 搜索结果个性化重排:CVR 提升 30-50%,月增净收入 ¥10-30 万
  • 配件/复购推荐精准化:复购率提升 10-15%,LTV 提升
  • 年化综合 ROI:¥40-120 万
  • 实施难度:⭐⭐⭐☆☆(需要用户行为埋点基础设施 + Redis 缓存层;LLM 画像生成离线批处理,约 3-4 周工程量)

7. 代码模板

代码块数量:2 · 路径:paper2skills-code/05-推荐系统/llm_session_personalization_cache

"""
LLM Session Personalization Cache
SPRINT 框架的轻量级实现:三层意图缓存 + 千人千面商品排序
"""
import numpy as np
import json
from datetime import datetime, timedelta
from collections import defaultdict


def generate_sample_users_and_items():
    """生成模拟用户行为和商品数据"""
    np.random.seed(42)

    items = {
        'I001': {'name': 'Quiet Double Breast Pump', 'category': 'breast_pump',
                 'price': 149.99, 'age_stage': 'newborn', 'brand': 'BrandA', 'attrs': [1,0,1,0,1]},
        'I002': {'name': 'Portable Wearable Breast Pump', 'category': 'breast_pump',
                 'price': 99.99, 'age_stage': 'newborn', 'brand': 'BrandB', 'attrs': [1,1,0,0,1]},
        'I003': {'name': 'Baby Car Seat 0-4 Years', 'category': 'car_seat',
                 'price': 299.99, 'age_stage': 'infant', 'brand': 'BrandC', 'attrs': [0,0,1,1,0]},
        'I004': {'name': 'Infant Learning Walker', 'category': 'walker',
                 'price': 79.99, 'age_stage': 'toddler', 'brand': 'BrandD', 'attrs': [0,1,0,1,0]},
        'I005': {'name': 'Breast Pump Replacement Parts', 'category': 'accessories',
                 'price': 24.99, 'age_stage': 'newborn', 'brand': 'BrandA', 'attrs': [0,0,0,0,1]},
        'I006': {'name': 'Baby Bottle Sterilizer', 'category': 'sterilizer',
                 'price': 59.99, 'age_stage': 'newborn', 'brand': 'BrandE', 'attrs': [0,0,1,0,0]},
    }

    users = {
        'U001': {  # 新妈妈,关注哺乳
            'history': ['I001', 'I005', 'I002', 'I006', 'I001'],
            'session': ['I002', 'I005'],
            'profile': 'nursing_mom',
        },
        'U002': {  # 奶爸,关注安全
            'history': ['I003', 'I004', 'I003'],
            'session': ['I004'],
            'profile': 'safety_dad',
        },
        'U003': {  # 孕期妈妈,全品类
            'history': ['I001', 'I003', 'I006'],
            'session': ['I001', 'I003'],
            'profile': 'pregnant_mom',
        },
    }
    return users, items


def build_item_vector(item):
    """构建商品嵌入向量"""
    category_map = {'breast_pump': [1,0,0,0,0,0], 'car_seat': [0,1,0,0,0,0],
                    'walker': [0,0,1,0,0,0], 'accessories': [0,0,0,1,0,0],
                    'sterilizer': [0,0,0,0,1,0]}
    cat_vec = category_map.get(item['category'], [0,0,0,0,0,1])

    age_map = {'newborn': 1.0, 'infant': 0.6, 'toddler': 0.3}
    age_score = age_map.get(item['age_stage'], 0.5)

    price_norm = 1.0 - min(item['price'] / 400, 1.0)  # 越便宜分越高(价格敏感)

8. 论文来源

  • 2508.00570