While S-LDSC produces robust estimates of functional enrichment, it has two limitations in estimating var[βi|ai]: (i) these estimates can have large standard errors in the presence of many annotations, and (ii) the model may not be robust to model misspecification. To address the first limitation, PolyFun incorporates an L2-regularized extension of S-LDSC. To address the second limitation, PolyFun employs special procedures to ensure robustness to model misspecification. The key idea is to approximate arbitrary complex functional forms of var[βi|ai] via a piecewise-constant function. To do this, PolyFun partitions SNPs with similar estimated values of var[βi|ai] (estimated via a possibly misspecified model) into non-overlapping bins; estimates the SNP-heritability causally explained by each bin b; and specifies var[βi|ai] for SNPs in bin b as the SNP-heritability causally explained by bin b divided by the number of SNPs in bin b. PolyFun avoids winner’s curse by using different data for partitioning SNPs and for per-bin heritability estimation.