Communitygithub.com

推荐系统管道架构师

使用由xAI推广的六阶段框架(Source→Hydrator→Filter→Scorer→Selector→SideEffect)设计可组合的推荐、排序和推送管道。

推荐系统管道架构师 是什么?

推荐系统管道架构师(recsys-pipeline-architect)是一个专注于规范和脚手架生成的技能,用于构建可组合的推荐、排序和推送管道。它编码了由xAI开源的“For You”算法中推广的六阶段模式——Source(来源)→ Hydrator(充实器)→ Filter(过滤器)→ Scorer(评分器)→ Selector(选择器)→ SideEffect(副作用)。该技能是这一模式的独立重新实现(MIT许可证),不复制原始代码。当开发者需要构建任何“为用户/上下文选择前K个项目”的系统、设计排名机制、为评分函数搭建管道基础设施,或从单一相关性评分迁移到多动作预测时,该技能最为适用。它支持TypeScript、Go和Python堆栈,并提供可运行的示例脚手架。技能的主要工作流包括八个步骤:明确用例、识别候选来源、列出所需充实内容、设计过滤器链、构建评分器链、配置选择器、处理副作用,最后在用户堆栈中生成脚手架。关键权衡包括单一评分与多动作预测、候选隔离评分与联合评分、以及在线处理与预计算之间的选择。该技能遵循严格规则(如不得虚构基准数字、必须进行归因、不擅自使用商标等)并警告常见反模式(如评分前过滤、同步副作用等)。 主要使用者场景包括:构建推荐系统、推送算法、排名管道、“For You”推送、候选管道、内容推荐器以及RAG检索重排序器。该技能明确不属于模型架构设计或纯ML训练管道,其专注点在于模型周围的管道编排。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/recsys-pipeline-architect

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

推荐系统管道架构师 是做什么的?

一个用于构建可组合推荐、排序和推送管道的规范和脚手架技能。它编码了由 xAI 开源的 For You 算法(Apache 2.0)推广的 六阶段模式 — Source → Hydrator → Filter → Scorer → Selector → SideEffect。该技能是该模式的独立重新实现(MIT)——未复制原始代码。

上游仓库:https://github.com/mturac/recsys-pipeline-architect

何时使用

  • 用户想要构建任何“为用户/上下文选择前K个项目”的系统
  • 用户询问“我应该如何对X进行排序”或描述一个推送/个性化问题
  • 用户有一个评分函数,需要围绕它搭建管道基础设施
  • 用户希望从单一相关性评分迁移到具有可调权重的多动作预测
  • 用户正在封装一个LLM/ML评分器,并需要在其技术栈(TypeScript / Go / Python)中添加过滤器、充实器、副作用以及可运行的脚手架
  • 触发词:“推荐系统”、“推送算法”、“排名管道”、“For You 推送”、“候选管道”、“内容推荐器”、“推荐系统管道架构”、“RAG 检索重排序器”

何时不使用

  • 模型架构工作(Transformer设计、双塔检索、嵌入训练)——该技能是模型周围的管道,而非模型本身
  • 纯ML训练管道——评分函数是用户的责任
  • 运行已部署的管道(监控、自动扩缩容)——超出范围

六阶段框架

#阶段工作并行?
1Source从一个或多个来源获取候选集是——多个来源并行运行
2Hydrator为每个候选集丰富过滤和评分所需的元数据是——独立的充实器并行运行
3Filter删除不应展示的候选(已屏蔽、过期、重复、不符合条件)顺序——每个过滤器看到更少的项目
4Scorer为每个存活的候选分配一个或多个分数顺序——后面的评分器可以看到前面的分数
5Selector按最终分数排序,返回前K个单一操作
6SideEffect缓存已提供的ID,记录曝光,发出事件,更新计数器异步——绝不能阻塞响应

为什么是这个精确顺序

  • 充实前先获取来源:在付出成本充实候选之前,先知道存在哪些候选
  • 过滤前先充实:许多过滤器需要来源未提供的元数据
  • 评分前先过滤:评分是昂贵阶段;先删除不符合条件的候选项
  • 评分器链(而非单一评分器):真实系统组合了ML评分、多样性重排序和业务规则
  • 评分后选择:使评分具有确定性和可缓存性
  • 副作用最后且异步:副作用绝不能阻塞用户响应

调用时的工作流

引导用户完成以下八个步骤:

  1. 明确用例(一轮,三个问题):被排序的项目?输入上下文?语言/运行时?
  2. 识别候选来源:通常是网络内(已关注/已拥有/已订阅)+ 网络外(ML检索/热门/相似于已喜欢)
  3. 列出所需的充实内容:对于每个过滤器和评分器,它需要哪些来源未提供的数据?
  4. 列出过滤器:去重、自身、年龄、屏蔽/静音、之前提供过的、资格。顺序很重要——廉价先于昂贵。
  5. 设计评分器链:主要评分器(ML)→ 组合器(带权重的多动作)→ 多样性 → 业务规则
  6. 选择器:按最终分数降序排序,取前K个(或针对网络内/网络外进行分层混合)
  7. 副作用:缓存已提供的ID,发出曝光事件,更新计数器,记录分析——全部即发即忘
  8. 在用户的技术栈中生成脚手架

需要呈现的关键权衡(不要默默使用默认值)

1. 单一评分与多动作预测

  • 单一评分:训练一个模型预测相关性。要改变行为 → 重新训练。
  • 多动作:预测多个动作的 P(动作)(阅读、喜欢、分享、跳过、举报),在服务时用权重组合。要改变行为 → 改变权重。无需重新训练。

X For You 系统使用带有正负权重的多动作。当用户期望频繁调整时,推荐使用多动作。

2. 评分中的候选隔离

  • 隔离:每个候选独立评分。确定性,可缓存。
  • 联合:候选在评分期间相互关注(例如,对批次进行Transformer处理)。更具表达力,但跨批次不具有确定性。

默认使用隔离。仅在有特定理由时(例如,显式的批次感知多样性)才使用联合。

3. 在线与离线

  • 请求时(在线):管道在每个请求上运行。延迟预算:100–300毫秒。默认。
  • 预计算(离线批处理):管道定期运行,结果缓存。延迟更低,新鲜度更低。
  • 混合:候选检索离线,排名在线。

硬性规则

  1. 不要捏造基准数字。 “快多少?” → “取决于工作负载,请自行运行。”
  2. 归因纪律。 当引用该模式时,应归因于“由 xAI 开源的 For You 算法推广” / github.com/xai-org/x-algorithm(Apache 2.0)。
  3. 不使用商标。 不要将用户的工件命名为“类似X”或使用“For You”品牌。模式免费;品牌不免费。建议命名:“候选管道”、“推送管道”、“排名管道”、“推荐系统管道”。
  4. 呈现权衡。 多动作与单一、隔离与联合、在线与离线——切勿默默使用默认值。
  5. 生成的脚手架必须可运行。 伪代码不能当作代码。
  6. 过滤器顺序很重要。 廉价先于昂贵。通用先于特定用户。
  7. 副作用绝不阻塞。 使用即发即忘模式(goroutine / 无需 await 的 Promise / asyncio task)。

反模式

  • 评分前过滤(浪费计算资源在最终会被丢弃的候选项上)
  • 同步副作用(缓存写入/曝光发出阻塞响应)
  • 当产品需要针对多个目标进行调优时(参与度 vs 安全性 vs 多样性 vs 广告),仅使用单一的“相关性”评分
  • 默认使用联合评分(非确定性,更难缓存,不与重排序阶段组合)
  • 生成“用于说明”的伪代码——脚手架必须能实际运行

上游内容

上游仓库位于 https://github.com/mturac/recsys-pipeline-architect,提供:

  • 完整的 SKILL.md,包含完整的8步工作流
  • 5个按需加载的参考文档:4种语言(TS/Go/Python/Rust)的接口、多动作评分模式、候选隔离、过滤器手册(12种模式)、评分器手册(加权和、MMR、多样性惩罚、位置去偏)
  • 3个可运行的示例脚手架,每个在其测试套件上均为绿色通过:
    • Strapi v5 插件(TypeScript / Jest — 3/3 通过)
    • Zentra 兼容管道(使用泛型的 Go — 3/3 通过)
    • PMAI 任务优先级排序器(Python / FastAPI / pytest — 3/3 通过)
  • v0.1.0 版本已标记
  • MIT 许可证;模式归因于 xAI X For You 算法(Apache 2.0)

通过 skills.sh 安装:npx skills add mturac/recsys-pipeline-architect

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能