Skip to content

大规模离散化稀疏特征模型的训练耗时问题 #3600

@lutaojian

Description

@lutaojian

原本一直使用LR模型作为CTR预估模型,最近正在调研LearningToRank模型(PaddlePaddle/models/ltr),随后便开始了对Paddle的学习。目前,遇到的最大问题是一轮训练(one pass)时间过长。

使用相同数据规模(7亿样本)、相同特征方案(离散化后的0/1稀疏特征3亿维)、相同cpu集群(40个节点),使用owlqn或LBFGS做优化的传统LR模型**# 训练60轮平均耗时2小时**,而使用Paddle实现的LR模型仅**# 训练一轮就需要超过3小时**。

以下是我使用Paddle实现的LR模型:

def lr(input_dim):
    # label layer
    label = paddle.layer.data("label", paddle.data_type.dense_vector(1))
    # data layer
    data = paddle.layer.data("data", paddle.data_type.sparse_binary_vector(input_dim))
    # sigmoid
    output = paddle.layer.fc(
        input=data,
        size=1,
        act=paddle.activation.Sigmoid(),
        param_attr=paddle.attr.Param(initial_std=0.01, name="output"))
    # cost layer
    cost = paddle.layer.multi_binary_label_cross_entropy_cost(input=output, label=label)
    return cost

优化算法选用Adam,配置代码如下:

    trainer = paddle.trainer.SGD(
        cost=cost,
        parameters=parameters,
        update_equation=paddle.optimizer.Adam(learning_rate=1e-3),
        is_local=True)

对于上面这个没有任何隐层的模型,目前的训练耗时已经无法接受,导致使用LearningToRank模型替代传统LR模型的方案也无法继续开展。

另外,我还在本地使用小数据集做了测试(1500W样本,feature_dim=3亿,batch_size=5W),及时小数据集训练一轮的平均耗时也仍在1.5个小时。

我需要请教的问题主要有三个:
1)是什么原因导致我模型训练耗时这么长?是否与我的模型配置有关?
2)从我的实验结果上来看,Paddle训练一轮的耗时基本是传统owlqn实现的四五十倍。这是正常的现象吗?...
3)对于大规模离散数据的模型优化,Paddle同学们有什么建议吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions