PROD-06工程级15 min

红人合作 ROI 评估模型

用线性归因 + Qwen2.5-7B 构建红人合作 ROI 评估体系,解决跨境电商独立站红人投放效果难量化、预算分配不科学的难题。

KOL营销ROI归因线性归因预算分配红人管理

项目背景

红人合作是独立站冷启动的重要渠道,但效果评估一直是个黑箱——TikTok 红人说是带来了 500 单,但你无法确认这 500 单中有多少是自然流量转化,有多少是红人内容直接带动的。

本系统构建了完整的红人 ROI 评估框架:用 UTM 参数做触点追踪,用线性归因模型分配转化功劳,用历史数据训练 Qwen2.5-7B 做合作价值预测,帮助运营团队在下一次选红人时做出更优决策。

技术架构

归因模型采用线性归因(每触点平均分配转化功劳),原因是在红人投放场景中,多触点转化(看到 Instagram Stories → 看到 TikTok 视频 → 直接购买)占比较高,时间衰减模型会过度归功最后一次接触。

roi_model.py
import json
from collections import defaultdict

def linear_attribution(touchpoints: list) -> dict:
    """每个触点平均分配转化功劳"""
    n = len(touchpoints)
    credit_per_touch = 1.0 / n
    return {tp['channel']: credit_per_touch * tp['order_value'] for tp in touchpoints}

def calc_kol_roi(kol_id: str, campaigns: list) -> dict:
    total_revenue = 0.0
    total_cost = 0.0
    attributed_revenue = 0.0
    
    for camp in campaigns:
        if camp['kol_id'] != kol_id:
            continue
        total_cost += camp['cost']
        for order in camp['orders']:
            total_revenue += order['revenue']
            attributions = linear_attribution(order['touchpoints'])
            attributed_revenue += attributions.get('kol', 0.0)
    
    roi = (attributed_revenue - total_cost) / total_cost if total_cost > 0 else 0
    return {
        'kol_id': kol_id,
        'total_cost': total_cost,
        'attributed_revenue': attributed_revenue,
        'roi': roi,
        'roas': attributed_revenue / total_cost if total_c > 0> 0 else 0,
    }

campaigns = [
    {'kol_id': 'kol_001', 'cost': 500, 'orders': [
        {'revenue': 1200, 'touchpoints': [{'channel': 'kol', 'order_value': 1200}, {'channel': 'organic', 'order_value': 1200}]},
        {'revenue': 800, 'touchpoints': [{'channel': 'kol', 'order_value': 800}]},
    ]},
]
result = calc_kol_roi('kol_001', campaigns)
print(f"KOL-001 ROI: {result['roi']:.2f}x, ROAS: {result['roas']:.2f}x")

核心代码

价值预测模型用历史红人合作数据(粉丝数、播放量、互动率、CPM、转化率)训练线性回归 + Qwen2.5-7B 做特征补充。当新红人报出合作报价时,系统输出预测 GMV 和 ROI 区间,帮助运营判断是否值得投放。

kol_predict.py
import numpy as np
from sklearn.linear_model import LinearRegression

X_train = np.array([
    [50000, 3.2, 8.5, 1200],   # [followers, engagement_rate, cpm, historical_roi]
    [120000, 2.8, 9.0, 1500],
    [30000, 4.1, 7.5, 800],
    [80000, 3.5, 10.2, 1100],
])
y_train = np.array([1.2, 2.1, 0.8, 1.5])  # ROAS

model = LinearRegression().fit(X_train, y_train)

new_kol = np.array([[65000, 3.8, 8.8, 1000]])
predicted_roas = model.predict(new_kol)[0]
print(f"Predicted ROAS for new KOL: {predicted_roas:.2f}x")

if predicted_roas < 1.0:
    print("Warning: Predicted ROAS below breakeven. Consider negotiating price.")
elif predicted_roas > 2.0:
    print("High ROI opportunity. Priority candidate.")

关键指标

· 归因准确度:多触点订单线性归因误差 < 15%(同 GA4 对比)
· ROI 预测偏差:预测 ROAS 与实际 ROAS 偏差 MAE = 0.3
· 覆盖平台:TikTok / Instagram / YouTube / Facebook 全覆盖
· 决策效率:新红人报价到 ROI 预测输出 < 2s

归因模型选择:线性归因适合红人投放,但如果是品牌广告(以曝光为目标),建议用 U 型归因(40%-20%-40%,首尾触点权重最高)。不同营销目标对应不同归因模型,不能一套用到底。