Mobile GBDT Machine Learning for LMSYS Human Preference
Engineering 58 linguistic, structural, and semantic alignment signals on Android Termux to train LightGBM and CatBoost ensembles under strict mobile memory budgets.In Part IX, team Pocket Data Lab established a zero-assumption baseline ladder for Kaggle’s LMSYS Chatbot Arena human preference benchmark. By combining class frequency priors with a calibrated continuous length disparity model, we scored an out-of-fold Multi-Class Log Loss of 1.07296 across 57,477 battles and achieved an official Kaggle public leaderboard standing of 1.07823 (placing Rank #222 out of 291 teams) without tuning a single machine learning parameter.
While static heuristics successfully exploit high-level behavioral biases—namely human verbosity bias and markdown formatting cues—they hit a rigid performance ceiling. Simple linear rules cannot model non-linear trade-offs: an excessively long response that fails to address the user’s prompt is heavily penalized as rambling or hallucinatory, while a concise answer rich in technical vocabulary frequently beats a repetitive essay. Capturing these subtle interaction dynamics requires supervised machine learning.
In this milestone installment, we advance from deterministic heuristics to competitive supervised learning on handheld edge hardware. Operating entirely inside Android Termux PRoot Linux, we engineer a 58-dimensional linguistic and semantic feature matrix, benchmark regularized multinomial logistic regression against native Gradient Boosted Decision Trees (LightGBM and CatBoost), and optimize a dual-GBDT blended ensemble that drives out-of-fold Log Loss down from 1.07296 to 1.03493 (a massive +0.06230 improvement over empirical prior baselines).
1 · The Edge Memory Challenge: 58 Dense Features in 14 Seconds
The LMSYS Chatbot Arena competition dataset presents a demanding computational workload for mobile devices: train.csv spans 57,477 rows and 184 MB on disk, containing unconstrained, multi-paragraph prompts and pair-wise LLM responses. On an Android smartphone constrained to a 2 to 4 GB RAM working ceiling, loading full raw text into Python objects and running iterative loops would quickly trigger Out-Of-Memory (OOM) kernel terminations.
To overcome mobile hardware constraints, team Pocket Data Lab designed a fully vectorized, single-pass feature extraction engine using optimized pandas string vectorization, NumPy C-extensions, and Python hash sets. The engine extracts 58 numeric features across 5 distinct linguistic and behavioral families in just 14.36 seconds on mobile CPU:
Crucially, our pipeline enforces strict pairwise symmetry: for every feature computed on Model A and Model B, we calculate both absolute differentials f_A - f_B and normalized relative ratios (f_A - f_B) / (f_A + f_B + \epsilon), ensuring the machine learning models learn directional preference without positional bias.
2 · Evaluation Metric & Formal Mathematical Definitions
In competitive human preference modeling, evaluation is governed by Multi-Class Logarithmic Loss across all pairwise comparisons:
As derived in our companion guide Multi-Class Log Loss Explained, Log Loss severely punishes overconfident errors: predicting p_{i,k} → 0 for the true winning class results in ln(p_{i,k}) → -\infty, destroying leaderboard standing. To maintain complete technical rigor, all variables in our pipeline are formally defined below:
3 · The 4-Experiment Machine Learning Ladder
To measure the exact contribution of feature engineering versus model family complexity, we conducted a rigorous 5-Fold Stratified Cross-Validation benchmark across all 57,477 training battles using random_state=42:
Experiment 1 · Calibrated Multinomial Logistic Regression (L2)
We first trained an L2-regularized multinomial logistic regression model (C=0.1) on standard-scaled features. As a generalized linear model, it models log-odds as linear combinations of the 58 features. The 5-fold out-of-fold Log Loss dropped to 1.05613. Submitted to Kaggle via standalone notebook (Submission Ref 57667634), it achieved an official public score of 1.06173—a sharp +0.01683 improvement over the Part IX calibrated heuristic. This proved that lexical density, punctuation, and prompt overlap carry substantial orthogonal predictive power beyond simple response lengths.
Experiment 2 · LightGBM MultiClass GBDT
Next, we deployed LightGBM (LGBMClassifier) configured for 3-class multi-logloss optimization with depth-bounded trees (max_depth=6, num_leaves=31, learning_rate=0.05, colsample_bytree=0.8). Unlike linear models, LightGBM learns non-linear decision splits and feature interactions—such as penalizing length when prompt Jaccard overlap is near zero. LightGBM achieved an out-of-fold Log Loss of 1.03601 (a dramatic +0.03695 reduction compared to Part IX).
Experiment 3 · CatBoost MultiClass Classifier
To achieve structural diversity, we introduced CatBoost (CatBoostClassifier) using oblivious symmetric decision trees (depth=5, learning_rate=0.06, iterations=400). Oblivious trees evaluate the same split condition across entire levels, acting as a natural regularizer against overfitting on subtle linguistic noise. CatBoost delivered a 5-fold out-of-fold Log Loss of 1.03594, slightly edging out LightGBM.
Experiment 4 · The Dual-GBDT Blended Ensemble
Finally, we combined the out-of-fold probability vectors of all models using bounded Sequential Least Squares Programming (SLSQP) to find the convex optimal blend. The optimizer allocated 50.6% weight to LightGBM and 49.4% weight to CatBoost (assigning 0% to the linear and heuristic priors, as the trees fully subsumed their signal). The blended ensemble scored a 5-fold out-of-fold Log Loss of 1.03493—our lowest error recorded across the series. Submitted to Kaggle via our automated edge runner, the ensemble scored an official 1.04158 on the public leaderboard, surging 52 positions up the global rankings to Rank #170 out of 290 teams (top 58.6%).
4 · Feature Importance: What Actually Drives Human LLM Preference?
Examining the tree split importances across all 5 folds of LightGBM reveals a profound insight into generative AI human evaluation. Contrary to common belief, raw character length is not the primary driver of human preference:
The empirical data demonstrates two vital principles:
- 1. Precision Over Length:
mean_word_len_diff(importance 721.0) is the single most influential feature in the entire ensemble. Human raters strongly prefer models that utilize precise, domain-appropriate vocabulary over models that stretch answers with monosyllabic filler words. - 2. Semantic Prompt Grounding: The lexical alignment disparity (
jaccard_diffat 624.2 andcov_diffat 605.2) heavily outranks raw length differences (len_diffat 468.8). A model that repeats or addresses the key technical entities in the user’s query consistently wins human votes over a verbose model with low query overlap.
5 · Master Benchmark Performance Summary
The progression from zero-assumption statistical priors to our dual-GBDT mobile ensemble demonstrates consistent, monotonic error reduction across all 57,477 battles:
6 · Kaggle Code Competition Submission Architecture
In Kaggle’s Code Competition format, internet access is disabled and submissions must execute inside a self-contained notebook container against withheld test sets. Because our feature extraction and training pipeline executes in under 60 seconds on CPU hardware, our notebook trains the full dual-GBDT model natively on worker startup without requiring pre-uploaded model artifacts:
# Pocket Data Science Part X: Self-Contained Kaggle Notebook Submission
import numpy as np
import pandas as pd
import lightgbm as lgb
from catboost import CatBoostClassifier
# 1. Load data and extract 58 vectorized features in 14s
X_train = extract_features(train_df)
X_test = extract_features(test_df)
# 2. Train LightGBM MultiClass GBDT
lgb_model = lgb.LGBMClassifier(
objective='multiclass', num_class=3, metric='multi_logloss',
learning_rate=0.05, num_leaves=31, max_depth=6, n_estimators=160,
random_state=42, n_jobs=4, verbose=-1
)
lgb_model.fit(X_train, y_train)
p_lgb = lgb_model.predict_proba(X_test)
# 3. Train CatBoost MultiClass Classifier
cb_model = CatBoostClassifier(
loss_function='MultiClass', iterations=300, learning_rate=0.06,
depth=5, random_seed=42, thread_count=4, verbose=0
)
cb_model.fit(X_train, y_train)
p_cb = cb_model.predict_proba(X_test)
# 4. Optimal convex blend and epsilon probability clipping
p_ens = 0.506 * p_lgb + 0.494 * p_cb
p_ens = np.clip(p_ens, 1e-15, 1.0 - 1e-15)
p_ens = p_ens / np.sum(p_ens, axis=1, keepdims=True)
# 5. Output submission
sub = pd.DataFrame({
'id': test_df['id'],
'winner_model_a': p_ens[:, 0],
'winner_model_b': p_ens[:, 1],
'winner_tie': p_ens[:, 2]
})
sub.to_csv('submission.csv', index=False)
The notebook is maintained on Kaggle at myhlow/llm-preference-mobile-gbdt-pocket-data-lab, providing complete reproducibility from smartphone shell to competition leaderboard.
Pocket Data Science Series 2026 · Engineered on Android Termux & PRoot Linux
✦ Benchmarked and verified by team Pocket Data Lab on Kaggle ✦
Leave a Reply