This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Use ML Code completion ranking as default.
ClosedPublic

Authored by usaxena95 on Feb 9 2021, 9:37 AM.

Details

Summary

This makes code completion use a Decision Forest based ranking algorithm to rank
completion candidates. [Estimated 6% accuracy boost]. This was
previously hidden behind the flag --ranking-model=decision_forest. This
patch makes it the default ranking algorithm.

Note: this is a generic model, not specialized for any particular
project. clangd does not collect or upload data to train code completion.

Also treat Keywords separately as they are not recorded by the training set generator.

Diff Detail

Event Timeline

usaxena95 created this revision.Feb 9 2021, 9:37 AM
usaxena95 requested review of this revision.Feb 9 2021, 9:37 AM
hokein added inline comments.Feb 10 2021, 11:51 PM
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
650

sorry, I didn't infer the motivation of this change func->ns from this patch, could you explain?

650–656

looks like the Results here is not verified, as you remove the line below, is it intentional?

usaxena95 updated this revision to Diff 322922.Feb 11 2021, 1:37 AM
usaxena95 marked 2 inline comments as done.

Addressed comments.

clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
650

Sorry about not highlighting this.
The ML model doesn't rank the function before the namespace. I removed this and made both of these as functions to independently validate the effect of references.

650–656

Oops. Thanks!.

hokein accepted this revision.Feb 11 2021, 1:49 AM

maybe add some data (improvement DecisionForest vs heuristic) in the patch description.

clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
650

ah, I see, that makes sense, thanks!

This revision is now accepted and ready to land.Feb 11 2021, 1:49 AM
This revision was automatically updated to reflect the committed changes.
usaxena95 edited the summary of this revision. (Show Details)Mar 2 2021, 2:00 AM