当前位置: 首页 > news >正文

End-To-End之于推荐-快手OneRec系列三(OneRec-Think)

在这里插入图片描述
快手OneRec系列的第三个公开的工作,增加了COT(Chain of thought) 相关应用,用了1.29% 的流量跑了一周,APP停留时长提升了0.159%,其他也有一定效果。
在这里插入图片描述

之前的两个工作OneRec~OneRec2,是大模型Scaling-law的扩展,形成了end-to-end 的 item 生成,但其本质依然是黑盒预测(implicit predictors):没有推理链路; 无法解释推荐原因; 难以人工干预和控制
这个工作就是把大语言模型(LLM)在 推理(Chain-of-Thought) 领域的突破,引入推荐,让系统先思考,再推荐。The framework of the OneRec-Think
由上图看到,模型主要由三个模块构成:

  1. Itemic Alignment: 将语义token作为LLM额外的词表去做预训练, 让Item语义(semantic)token对齐LLM的文本token embedding空间,本质上是让ID成为一种大模型可以理解的新模态,并且能让大模型认识ID的内部含义(就像一个人一样,看了视频,知道视频说啥,底层表达的什么,不仅仅是一个sequence 序列)
  2. Reasoning Activation: 在推荐上下文中激活模型的推理能力
  3. Reasoning Enhancement: 利用特定于推荐的奖励函数来捕获用户偏好的多样性(multi-validity)

用户的interaction history表示:
Su=(Sv1,...,Svn)S_u = (S_{v1}, ... , S_{vn})Su=(Sv1,...,Svn)

一 Itemic Alignment怎么做的

1. Itemic Tokenize

这个和OneRec一样,对每个Item使用了3 * 8192个语义ID来量化, 共有24,576个语义Token。
某个Item的Tokenized结果:Sv=<|item_begin|>< item_a_1123><item_b_5813><item_c_4212><|item_end|>
下图是一个视频的例子:
在这里插入图片描述

2. 多任务预训练实现Item语义对齐(Itemic Alignment with Multi-Task Pre-training)

设计了四个任务

1)交错式用户画像基础(Interleaved User Persona Grounding):
包含了基础用户画像描述、近期行为(如搜索、点赞、评论、关注)描述、用户主次兴趣刻画,其中Interleave 是关键,这些行为或者是描述并不是单一存在的,而是放到一起,这样item token应该也是一种语言。
在这里插入图片描述从这个里面可以看到,用户画像的描述中包含了tokenized产品信息。
2)序列偏好模型(Sequential Preference Modeling)
从用户的历史序列中预测后续的交互Item。
在这里插入图片描述
3)生成Item描述信息 (Itemic Dense Captioning)
Itemic tokens—》Description of Item
任务是从Item的tokens中解析Item的描述性内容,以此任务来获得LLM对Item token的语义理解,如下图所示,左边的内容,模型能给出类似右边的描述。
在这里插入图片描述
4)通用语言模型(General Language Modeling)
主要包含一些预训练和Instruction fine-tune的通用语料(general corpurs), 主要是为了维持模型的基础认知,不要为了订制化任务失去大模型的基础能力。

训练步骤
  1. 两个考虑点:1是要让大模型有对Itemic token有认知,认识这种语言;2 在训练大模型认知的过程中不能丢失原有信息。
  2. 训练基础模型:Qwen-8B作为Backbone model
  3. 训练方法:为了满足这两点,设定了两步走

Token Warm-up
这一步只是训练Embedding表证!!!

  • 目标: 主要训练新引入的itemic token embed,确保这些语义token能对齐原有LLM text token embed空间
  • 操作: 使用6B的用户画像数据, 训练时冻结原LLM的参数,只训练新引入的itemic token的Embedding。
  • 学习率: 使用较高的学习率(如 5 x 10-4),以便新的token embedding能快速收敛

Multi-task Intergration
推荐任务的能力在这一步体现!!!

  • 目标: 将上面的4个数据任务结合起来,共同训练模型。
  • 数据混合: 将不同任务的数据按照一定的比例混合,确保模型在训练过程中能够同时学习到语言生成能力和推荐任务所需的能力。
  • 学习率: 基于LoRA(实际使用,在公开数据集使用的是全参数微调),解冻 backbone,只对少量 LoRA adapter 权重做更新,其他参数保持冻结,同时使用较低的学习率(如3 x 10-4), 以确保模型在微调过程中能够稳定地适应新的任务。
    在这里插入图片描述

二 推理激活(Reasoning Activation)

在这里插入图片描述

这一部分是显式的让模型学会先思考,再输出。
通过Bootstrapping with Pruned Contexts
1 训练数据:Target item svn+1s_{v_{n+1}}svn+1 and form a contexttarget pair <(sv1,...,svn),svn+1><(s_{v_1} , . . . , s_{v_n}), s_{v_{n+1}}><(sv1,...,svn),svn+1>
2 先从历史交互序列中检索出来topK相似的
g((sv1,...,svn),svn+1)=(sw1,...,swk).g((s_{v_1}, . . . , s_{v_n}), s_{v_{n+1}} ) = (s_{w_1}, . . . , s_{w_k}).g((sv1,...,svn),svn+1)=(sw1,...,swk).
3 用这些相关的items,应用之前的aligned model生成解释目标交互的理论依据τ\tauτ
,其中Pτ(a,b)P\tau(a, b)Pτ(a,b) 是生成为什么与item a产生交互的用户会与item b 也产生交互.

在这里插入图片描述
Prompt&Answer

<|im_start|>system
You are an expert recommendation analyst.
Given a user’s relevant interaction
history, provide a step-by-step reasoning
process explaining why a specific target
item aligns with their preferences.
<|im_end|>
<|im_start|>userUser’s relevant interaction history:
<|item_begin|><item_a_1111><item_b_2222><item_c_3333><|item_end|> - Beginner’s guide to sourdough bread making
<|item_begin|><item_a_2947><item_b_8156><item_c_3402><|item_end|> - Professional chef knife skills tutorial
<|item_begin|><item_a_5618><item_b_3927><item_c_7084><|item_end|> - Italian pasta recipes from scratch
<|item_begin|><item_a_7293><item_b_5471><item_c_1836><|item_end|> - Kitchen organization and meal prep tips
<|item_begin|><item_a_9105><item_b_6248><item_c_4519><|item_end|> - Comparison of stand mixers for home baking
Target item: <|item_begin|><item_a_3672><item_b_9814><item_c_2657><|item_end|> -Advanced French pastry techniques and
equipment guide
Explain why this target item matches the
user’s interests. <|im_end|><|im_start|>assistant
Reasoning: The user’s viewing history shows a strong interest in advanced
cooking techniques and kitchen equipment, with engagement in sourdough baking,
handmade pasta, and stand mixer comparisons. The user has progressed from
basic skills to time-intensive culinary projects, demonstrating commitment to
mastering traditional cooking methods. French pastry represents a natural next
step that combines their baking experience with technical precision.
Therefore, the user would very likely click on candidate videos with similar
themes <|item_begin|><item_a_3672><item_b_9814><item_c_2657><|item_end|>.
<|im_end|>

Learning to Reason from Noisy Sequences

从用户的全部序列出发,激活推理过程,包含了两部分损失:
第一部分是推理序列对应损失,第二部分是Target Item的L个语义token所对应的损失,negative log-likelihood作为损失函数。
在这里插入图片描述
通过优化这两部分损失,让模型学会自己蒸馏相关的信息,并建立推理链接。

Prompt&Answer:

<|im_start|>system
You are an intelligent recommendation system. Given a user’s complete
interaction history, provide reasoning for your recommendation and 
then suggest the most appropriate next item.
<|im_end|>
<|im_start|>user
User’s complete interaction history:
<|item_begin|><item_a_1847><item_b_6392><
item_c_5104><|item_end|>, <|item_begin|><
item_a_9263><item_b_4571><item_c_8026><|
item_end|>, <|item_begin|><item_a_1111><
item_b_2222><item_c_3333><|item_end|>, <|
item_begin|><item_a_5419><item_b_8736><
item_c_2948><|item_end|>, <|item_begin|><
item_a_3082><item_b_7145><item_c_6379><|
item_end|>, <|item_begin|><item_a_2947><
item_b_8156><item_c_3402><|item_end|>, <|
item_begin|><item_a_7651><item_b_2493><
item_c_1087><|item_end|>, <|item_begin|><
item_a_5618><item_b_3927><item_c_7084><|
item_end|>, <|item_begin|><item_a_8304><
item_b_9672><item_c_4215><|item_end|>, <|
item_begin|><item_a_7293><item_b_5471><
item_c_1836><|item_end|>, <|item_begin|><
item_a_4926><item_b_1358><item_c_8740><|
item_end|>, <|item_begin|><item_a_9105><
item_b_6248><item_c_4519><|item_end|>, <|
item_begin|><item_a_1537><item_b_8904><
item_c_3261><|item_end|>
What item should be recommended next?
Explain your reasoning first.
<|im_end|>
<|im_start|>assistant
<think>
The user’s viewing history shows a strong
interest in advanced cooking techniques
and kitchen equipment, with engagement in
sourdough baking, handmade pasta, and
stand mixer comparisons. The user has
progressed from basic skills to timeintensive culinary projects,
demonstrating commitment to mastering
traditional cooking methods. French
pastry represents a natural next step
that combines their baking experience
with technical precision. Therefore, the
user would very likely click on candidate
videos with similar themes <|item_begin
|><item_a_3672><item_b_9814><item_c_2657
><|item_end|>.
</think>
Recommendation: <|item_begin|><
item_a_3672><item_b_9814><item_c_2657><|
item_end|>
<|im_end|>

三 推理增强(Reasoning Enhancement)

这一部分类似于大模型的强化学习微调阶段,用于提升最终推荐精度,作者基于beam search结果定义了一种新的奖励机制,称为Rollout-Beam奖励:使用beam search在每次推理时生成top-k条推理路径,给这些路径分别计算reward,用最优路径的奖励来反向优化模型。
在这里插入图片描述
基于上述Reward, 使用GRPO算法优化模型微调:
学习率1e-5
beam search: K=32
CoT paths: [G]=16
KL divergence系数: β=0.001\beta=0.001β=0.001
裁剪比率: ϵ=0.2\epsilon=0.2ϵ=0.2

四 实际应用落地的trick

推荐系统要求的时延很低,但是大模型如果需要思考推理的话对硬件和时间都是有需求的,如何平衡这两点,是能否真正落地的关键。
为了解决这一个矛盾体,改方案提出了Think-Ahead Inference Architecture,离线阶段提前预估出语义ID的前两位, 在线阶段使用线上的OneRec模型预估语义ID的最后一位,具体的:

  1. Reasoning Path synthesis:为每个用户生成几个推理路径,代表用户的兴趣
  2. Constrianed Prefix Generation:基于推理路径,生成前2个用户可能感兴趣的itemic token
  3. Semantic Space Materiallizaion:将所有生成的前缀合并,形成用户的个性化候选空间, 主要包含一些用户感兴趣的集合。
  4. Online Inference Stage: 当用户发起请求时,从分布式存储系统中检索CuC_uCu
    使用实时更新的OneRec模型进行最终的解码。

Ref:
1. 代码开源
2. paper
3. 知乎解读
4. 快手技术分享

http://www.dtcms.com/a/542305.html

相关文章:

  • 做游戏模板下载网站有哪些网站建设策划稿
  • 《投资-143》如何实现“过去思维”向“未来思维”的转变?
  • 做网站的开发软件企业网站 备案 网站名称
  • 企业网站seo实四川建筑培训考试网
  • 石家庄哪里做微网站宁夏自治区住房与城乡建设厅网站
  • 把文件删除了怎么恢复,8个文件恢复方案找回误删除的文件
  • 做会计题目的网站酒店网站建设哪家好
  • 响应式mvc企业网站源码苏州高端网站设计机构
  • java面试-0312-ThreadLocal理解?场景?原理?
  • Go与Python在AI大模型开发中的深度对比分析
  • 大丰哪家专业做网站重庆云阳网站建设
  • BETAFLIGHT固件如何更改陀螺仪引脚适配自己画的板子,带有教程实例
  • QtQuick3D入门(6):3D粒子系统
  • MySQL窗口函数精髓:ROW_NUMBER()详解与实战指南
  • css优先级、继承、经典问题
  • 江门市智企互联网站建设四川省建设厅网站填报获奖
  • 网站营销方案软件工程师培训学校
  • 自己可以做微网站吗深圳设计功能网站
  • 【Java后端进行ai coding实践系列二】记住规范,记住内容,如何使用iflow进行上下文管理
  • 不用建网站怎么做淘宝客广西来宾网站网站建设
  • 开源html5 网站模板wordpress cdn 插件
  • 做个网站成本商务电商网站建设
  • AI Agent设计总览
  • 专业的网站建设电话东莞东城医院
  • 【LeetCode】大厂面试算法真题回忆 (145):求解连续数列
  • Zadig,USB 驱动安装工具
  • POSIX 文件锁机制
  • 深圳公司建站推广网站怎么设置二级域名
  • 从流水线工人到AI开发者:我靠执行力打破命运的循环
  • 常州手机网站效果wordpress内容主题模板