fix:更新算法

This commit is contained in:
吕新雨
2026-02-02 11:22:35 +08:00
parent 814b96edb6
commit 58d17fc39f
27 changed files with 3286 additions and 62 deletions

View File

@@ -5,7 +5,7 @@
>
> **共用基礎**
>
> * 用戶畫像Umom_stage one-hotemotion_score、context one-hot、need one-hot
> * 用戶畫像Umom_stage one-hotemotion/context/need 允许缺失/跳过;含 `profile_confidence/profile_answered`
> * 文案畫像Cᵢstage、emotion_score、context/need suitability、personalization_power、risk_flags建議含 content_id/author_id/template_id/review_confidence
> * 推薦骨架Hard Filter → Soft Scoring → Rerank多樣性/新鮮度/疲勞)
@@ -24,6 +24,7 @@
1. **Candidate Generation候選集生成**
* 依 U 取一個「候選池」:匹配 need/context/stage 的內容 + 一部分通用內容
* V1.2:若問卷允許跳過導致 `U.need/U.context/U.emotion_score` 缺失,候選池需自動提高通用安全內容占比,并视为至少进入 L1限制 `personalization_power≤0.5`
2. **Hard Filter硬性過濾**
* 依 risk_flags 與產品規則剔除高風險內容
@@ -93,10 +94,37 @@ S_{core} + S_{personal} + S_{fresh} - P_{fatigue} - P_{repeat} - P_{risk} - P_{u
S_{core} = w_{need}S_{need} + w_{emotion}S_{emotion} + w_{stage}S_{stage} + w_{context}S_{context}
]
* `S_need = Cᵢ.need_suitability[U.need]`
* `S_context = Cᵢ.context_suitability[U.context]`
* `S_need = Cᵢ.need_suitability[U.need]`(若 U.need 缺失,见 V1.2
* `S_context = Cᵢ.context_suitability[U.context]`(若 U.context 缺失,见 V1.2
* `S_stage`general=1命中=1unknown對非unknown=0.7;其餘=0
* `S_emotion`:若文案 general→0.8;否則 `1-|U.emotion_score-Cᵢ.emotion_score|`
* `S_emotion`:若文案 general→0.8;否則 `1-|U.emotion_score-Cᵢ.emotion_score|`(若 U.emotion_score 缺失,见 V1.2
### V1.2:当问卷允许跳过题目时的打分约定(工程必读)
> 目标:用户画像字段不全时仍能产出排序;并在不确定时自动降个性化/降风险。
判定缺失:
* `U.need` 为空对象 `{}` 或不存在 → 视为缺失
* `U.context` 为空对象 `{}` 或不存在 → 视为缺失
* `U.emotion_score``null`/不存在 → 视为缺失
缺失时的保守计算:
* `S_need`
*`U.need` 缺失 → `S_need = 0.5`
* 否则 → `S_need = Cᵢ.need_suitability[U.need]`
* `S_context`
*`U.context` 缺失 → `S_context = 0.5`
* 否则 → `S_context = Cᵢ.context_suitability[U.context]`
* `S_emotion`
*`U.emotion_score` 缺失 → `S_emotion = 0.8`
* 否则按原定义计算(文案 general 仍为 0.8
额外约束与回退梯度一致6A
*`conf_U` 偏低或字段缺失明显:必须启用 `P_uncertainty`
* 若进入回退梯度(`fallback_level_final>0`):按 L1/L2/L3 限制 `personalization_power` 上限(见 3.1
個性化加成:
[
@@ -125,7 +153,7 @@ P_{uncertainty} = \beta \cdot (1-\text{conf}_U) \cdot (1-\text{conf}_{Cᵢ}) \cd
* `U.stage.unknown=1` → 禁推 `unsafe_for_stage_unknown`
* `U.stage.parenting=1` → 禁推 `unsafe_for_stage_parenting`
* `U.emotion_score≤0.2` → 禁推 `unsafe_for_emotion_low`
* `U.context.health=1` → 禁推 `block_health_medical`(僅擋「醫療/診斷/嚴重暗示」)
* `Cᵢ.risk_flags``block_health_medical`**全场景禁推Hard Filter**(仅挡「医疗/诊断/严重暗示」)
> `soft_health_sensitive` 不做 Hard Filter改由 Soft Penalty見 Push 的 P_risk
@@ -218,6 +246,11 @@ P_{uncertainty} = \beta \cdot (1-\text{conf}_U) \cdot (1-\text{conf}_{Cᵢ}) \cd
>
> * `personalization_power` 上限降為 `≤0.5`L1或 `0`L2/L3
> * 若候選不足,優先回退到「通用安全句庫」,而不是擴大高個性化內容
>
> V1.2(支持问卷跳过)补充:
>
> * 若 `profile_answered.need=false` 或 `U.need` 缺失不得按“need 强命中”召回,候选池应提高通用安全句占比,并至少按 L1 降个性化
> * 若 `profile_answered.emotion=false` 或 `U.emotion_score` 缺失Push 应偏向 `Cᵢ.emotion_score` 为 `general` 或 0.40.8 的稳定内容,并启用 `P_uncertainty`
## 5.3 Push 打分權重(建議)
@@ -313,7 +346,7 @@ V1.1 補充(工程預設):
* FeedMMR `λ=0.7`
* Push啟用 `P_uncertainty`(或併入 `P_risk``fallback_level>=1``personalization_power` 上限降為 `≤0.5`
* HealthHard Filter 僅擋 `block_health_medical``soft_health_sensitive` 走 Soft Penalty
* Health`block_health_medical` 全场景 Hard Filter`soft_health_sensitive` 走 Soft Penalty
> 一句話:
> **同一套 U×Cᵢ 打分,按場景調候選池、權重與重排約束。**