Skip to content

[R] LightGBM uses a lot of RAM when #feature and #leaves are both large #562

@Laurae2

Description

@Laurae2

I ran LightGBM on a very big dataset. It is twice faster than xgboost. But for comparing both, I am building from all the dataset and using all the features, in contrary to LightGBM default behavior.

Dataset properties:

  • 2,250,000 observations
  • 23,636 features

(Committed) RAM usage:

  • LightGBM: 164GB (173GB when building from 100000 observations using bin_construct_sample_cnt only)
  • xgboost fast histogram: 63GB
  • xgboost exact: 25GB (not sure, but it didn't use a lot)

image

Time per iteration (seems a big dataset fixes issue #542, but this one is really big...):

  • LightGBM: 8-12 seconds
  • xgboost fast histogram: 16-20 seconds
  • xgboost exact: 90 seconds (gave up)

I think with MinGW, the dataset must be really large for LightGBM to scale well. Otherwise, we see the overhead issue with multithreading (and LightGBM ends up with the same speed of xgboost or is worse).

Now the issue is LightGBM using so much RAM... it uses 54GB RAM, swaps, and commits a total of approx 170,000,000 bytes. In the case of xgboost, as I capped to 54GB RAM it swaps but it's unnoticeable at all thanks to RAID 0 2Gbps NVMe drives (adding more RAM just made the histogram faster, the training was not faster).

I can provide you the building scripts for the dataset if you need to reproduce it. It takes about 30 minutes to prepare them.

I am using:

  • 255 bins (intentional)
  • depth of 10
  • number of leaves of 1023
  • 8 threads

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions