Increase completion model token lookback to 100

In moving to a pointer mixture network from a traditional language
model I had initially decreased model lookback to 50 tokens to
facilitate faster model training iteration. Now that we've landed
on a configuration that works well, increasing lookback to 100 tokens
improves accuracy further.

I also went ahead and followed a recommendation from Jacob to
oversample Flutter sources since they're greatly underrrepresented
in our training corpus compared to our users' code at prediction time.

Change-Id: I885ddb606270394198f3aca2554e381f4465bdae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124083
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Ari Aye <ariaye@google.com>
This commit is contained in:
Ari Aye 2019-11-04 18:00:16 +00:00 committed by commit-bot@chromium.org
parent f1fd342f71
commit 5bae0f23cf
4 changed files with 5 additions and 5 deletions

2
DEPS
View file

@ -427,7 +427,7 @@ deps = {
"packages": [
{
"package": "dart/language_model",
"version": "9fJQZ0TrnAGQKrEtuL3-AXbUfPzYxqpN_OBHr9P4hE4C",
"version": "lIRt14qoA1Cocb8j3yw_Fx5cfYou2ddam6ArBm4AI6QC",
}
],
"dep_type": "cipd",

View file

@ -14,7 +14,7 @@ import 'package:analysis_server/src/services/completion/dart/language_model.dart
import 'package:analyzer/dart/analysis/features.dart';
/// Number of lookback tokens.
const int _LOOKBACK = 50;
const int _LOOKBACK = 100;
/// Minimum probability to prioritize model-only suggestion.
const double _MODEL_RELEVANCE_CUTOFF = 0.5;

View file

@ -20,7 +20,7 @@ void main() {
final tokens =
tokenize('if (list == null) { return; } for (final i = 0; i < list.');
final response = await ranking.makeRequest('predict', tokens);
expect(response['data']['length'], greaterThan(0.85));
expect(response['data']['length'], greaterThan(0.9));
});
}

View file

@ -11,7 +11,7 @@ import 'package:test/test.dart';
final directory = path.join(File.fromUri(Platform.script).parent.path, '..',
'..', '..', '..', 'language_model', 'lexeme');
const expectedLookback = 50;
const expectedLookback = 100;
void main() {
if (sizeOf<IntPtr>() == 4) {
@ -46,7 +46,7 @@ void main() {
final suggestions = model.predictWithScores(tokens);
final best = suggestions.entries.first;
expect(best.key, 'length');
expect(best.value, greaterThan(0.85));
expect(best.value, greaterThan(0.9));
});
test('predict when no previous tokens', () {