algorithmically clean some outliers
Some 1km gridcells in the 2015 UN-adjusted dataset have population values as high as 183,000 persons per km2. These hyperpopulated cells account for ~30% of global population!
Hong Kong and Brazzavile are two examples: in real life according to wikipedia Hong Kong's densest suburb has density of 57,000 people/km2. Similarly you have values as low as 1e-12. Why not set a ceiling and floor, and redistribute surplus population to the whole country.
As it stands we users have to do a lot of data cleaning to be able to use dataset but automatically cleaning such outliers should be rather easy step to add to your processing pipeline.