PECAN baselines

Baseline language identifiers retrained on the PECAN benchmark: Guesslang, SCC (Naive Bayes; corrected and as shipped), and SCC++ (Random Forest and XGBoost). All were trained from scratch on the same 28,623,869 PECAN training fragments as the PECAN encoders and evaluated on the full official test split (9,179,661 fragments, 319 languages). None of the original authors' models are used.

Artifact repository (training scripts, manifests, scoring): https://anonymous.4open.science/r/pecan-benchmark

Results (official PECAN test split)

Model Folder Accuracy Macro-F1 Top-5 Pop-20 Head Torso Tail ms / fragment
Guesslang (retrained) guesslang-pecan/ 0.880 0.803 0.948 0.736 0.914 0.780 0.735 1.72
SCC++ Random Forest sccpp_full/ 0.812 0.753 0.902 0.656 0.850 0.703 0.639 0.04
SCC++ XGBoost sccpp_full/ 0.805 0.746 0.899 0.635 0.839 0.700 0.668 0.05
SCC (Naive Bayes, corrected) scc_corrected/ 0.785 0.736 0.890 0.590 0.822 0.669 0.653 0.02
SCC (Naive Bayes, as shipped) scc_full/ 0.777 0.734 0.883 0.545 0.813 0.656 0.657 0.02

Macro-F1 is averaged over all 319 labels. Every folder includes a manifest.json recording the exact hyperparameters, library versions, row counts, and validation accuracy.

Guesslang (retrained), guesslang-pecan/

Setting Value
Model Guesslang's stock architecture (DNN-linear combined classifier over token n-grams), upstream commit 42ec637 (v2.2.x)
Changes Label set expanded from Guesslang's 54 languages to PECAN's 319, and TensorFlow API modernization; no architectural or hyperparameter changes (third_party/guesslang-pecan/pecan-modifications.patch in the artifact)
Training data PECAN training fragments (28,623,869)
Batch size 100 (Guesslang default)
Training steps 286,000 (about one epoch over the 28.6M training fragments at batch size 100; read from the saved model's global_step)
Format TensorFlow SavedModel (saved_model.pb, variables/, languages.json)

SCC (Naive Bayes), scc_corrected/ and scc_full/

Reference: SCC (Alrashedy et al., SCAM 2018), reference code SCC.py. Pipeline: word TF-IDF features into Multinomial Naive Bayes.

Setting Value
Training data All 28,623,869 PECAN training fragments (no subsampling)
Features HashingVectorizer with 2^18 = 262,144 buckets (word analyzer, lowercase, non-negative counts), then IDF weighting and L2 normalization. Hashing replaces the reference's exact vocabulary, which is intractable over 28.6M documents
Hash width selection 2^15 to 2^22 swept on all training data with 50,000 held-out validation fragments; 2^18 was best
Smoothing alpha = 0.1 (selected over the default 1.0: validation 0.834 vs. 0.808)
Validation accuracy 0.836 (corrected), 0.834 (as shipped)
Format model.joblib (scikit-learn), idf.npy, labels.json, manifest.json

The two folders differ only in two bugs in the reference code:

as shipped (scc_full/) corrected (scc_corrected/)
Stop words stop_words={'english'}, a set containing the word "english", which removes only that token scikit-learn's English stop-word list
TF-IDF Applied twice (TfidfVectorizer followed by a redundant TfidfTransformer) Applied once

The paper's results table reports the corrected model; the as-shipped model is the faithful reproduction.

SCC++ (Random Forest and XGBoost), sccpp_full/

Reference: SCC++ (Alrashedy et al., JSS 2019), reference code Classifier.py, code-only features (PECAN has no Stack Overflow question text). Both models share one TF-IDF vocabulary.

Setting Value
Training data All 28,623,869 PECAN training fragments (no subsampling; the reference code's debug truncation to 10,000 rows is not reproduced)
Vocabulary Top 10,000 terms by document frequency (the reference's max_features=10000), computed exactly over the full training set; single TF-IDF stage
Selection Explicit sweeps on all training data, scored on 50,000 held-out validation fragments (the reference's GridSearchCV is not used)

Capacity bounds. The reference grid's max_depth=4 cannot represent 319 classes, and memory grows with trees ร— leaves ร— classes, so depth and size were capped instead of subsampling the data:

Random Forest (model_rf.joblib, 38.6 GB) XGBoost (model_xgboost.json, 1.4 GB)
Trees / boosting rounds 100 trees 300 rounds (100, then resumed for 200 while validation accuracy was still rising), one tree per class per round
Max depth 550 10
Max leaves per tree 2,000,000 not capped (depth-limited)
Min samples per leaf 1
Features per split sqrt column subsample 0.5 per tree
Other learning rate 0.1, row subsample 0.8
How chosen depth and leaf caps raised until validation gains fell to about 0.3 points grid over depth 6/8/10/12 and learning rate 0.1/0.3 (0.3 diverged)
Validation accuracy 0.845 0.836

Other files: vocabulary.json, idf.npy, labels.json, manifest.json. See docs/README_BASELINES_SCC.md in the artifact for the full sweeps and commands.

Limitations

These are retrained baselines, not the original authors' released models, and differ from the published setups where noted above (hashed features for SCC, capped tree capacity for SCC++). Each was trained once (seed 42).

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train pecan-anon/pecan-baselines