Files
Serendipity 5634b04b00 feat: Embedding FP16 开关 + 团队成员信息完善 + gitignore 更新
- infer.py: 新增 emb_fp16 CONFIG 选项(默认 False),Embedding 权重可 FP16 省查表带宽
- CLAUDE.md: 补充团队成员表(AI Studio 用户名→真实姓名)
- README.md: 新增团队区块,标注三人参赛身份
- .gitignore: 排除 DVC/HF 工具自动生成的元数据文件

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-15 17:26:25 +08:00

87 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CTI-Inference-Opt
百度商业AI技术创新大赛 (CTI) 2026 — **生成式推荐广告排序推理性能优化**
[![Gitea](https://img.shields.io/badge/Gitea-Serendipity%2FCTI--Inference--Opt-blue?logo=gitea)](https://gitea.liuhangyv.top/Serendipity/CTI-Inference-Opt)
## 团队
| 成员 | AI Studio 用户名 | 角色 |
|------|------------------|------|
| 刘航宇 | — | 队长 |
| 张君硕 | qianban139 | 队员 |
| 谢松熹 | sidny1988 | 队员 |
## 赛题
> [比赛主页](https://aistudio.baidu.com/competition/detail/1461) · [大赛官网](http://cti.baidu.com) · [提交结果](https://aistudio.baidu.com/competition/detail/1461/0/submit-result) · [比赛规则](https://aistudio.baidu.com/competition/detail/1461/0/rules)
给定基于 Transformer 的生成式推荐广告排序模型(GRAB),在**不改变模型结构、不在测试集上训练**的前提下,极致优化推理性能。量化/稀疏/剪枝明确允许。
## 模型架构
```
RepEncoder (28 slots × 512d Embedding) → segment_reduce → LayerNorm → Linear
→ 8 层 Transformer (512d, 8 heads, Pre-LN)
→ Multi-Head Attention (SDPA / Flash Attention)
→ SMoE FFN (8 experts, Top-2 gating, k=2)
→ Linear → Sigmoid → CTR
```
~6.5M~11.3M 参数,基于 [GRAB](https://arxiv.org/abs/2602.01865) / [HSTU](https://arxiv.org/abs/2402.17152) 论文。
## 有效优化
| # | 优化 | 原理 | 耗时 |
|---|------|------|------|
| 1 | FP16 量化 | 模型半精度 + Embedding FP32 | 152s |
| 2 | Flash Attention | SDPA 数学等价替换 | 94.5s |
| 3 | 消除 GPU 同步 | 移除 MoE mask.any() + searchsorted mask | 88.1s |
| 4 | Expert 相似度合并 | 余弦相似度 >0.90 的 expert 合并 | 86.5s |
| 5 | 稠密向量化 MoE | einsum 并行算 8 个 expert | PR#1 |
| 6 | RepEncoder 融合查表 | 28 slot 拼单次 segment_reduce | PR#1 |
## 评分规则
| 维度 | 要求 | 不达标 |
|------|------|--------|
| 推理效率 | ≤ 5min,环境构建 ≤ 20min | **总分 0** |
| 模型效果 | AUC ≥ 0.65PCOC ∈ [0.85, 1.15] | **总分 0** |
## 评测环境
- **硬件**: NVIDIA A800 (80GB, SM80)
- **软件**: Python 3.10 + PyTorch 2.6.0 + CUDA 12.4
- **评测数据集 ≠ baseline 数据集**
## 提交
```bash
cd 代码/code
zip submit.zip infer.py build_env.sh
```
约束:不包含 `dataset/``ckpt.pt`,包后缀 `.zip`,每天最多 10 次。
## 文件结构
```
代码/code/
├── infer.py # 推理主脚本(提交核心)
├── build_env.sh # 环境构建脚本
├── requirements.txt # 服务端依赖(torch 2.6.0 + CUDA 12.4
├── EXPERIMENTS.md # 实验记录表
└── bench.py # 本地测量脚本(不进提交包)
论文/
├── GRAB.md / HSTU.md # 论文 OCR markdown
└── imgs/ # 论文图片
代码/任务提交接口说明.md # 官方接口规范
CLAUDE.md # 项目开发指引
```
## 许可证
MIT License