How Vivo’s App Leverages Edge AI to Personalize Product Recommendations
This article details how Vivo’s official app implements edge intelligence to dynamically rank and recommend hardware products on its homepage, covering problem abstraction, data collection, feature engineering, model design, TensorFlow‑Lite conversion, on‑device inference, and monitoring for a personalized user experience.
Background : The Vivo official app homepage is the most trafficked page, responsible for distributing new products, promotions, and other entries. While cloud algorithms handle many scenarios, the smart‑hardware floor section still relied on manual configuration, limiting relevance for different user groups.
Problem Abstraction
The goal is to show four hardware products that best match each user segment instead of a static set. This can be abstracted as selecting the top‑K items (K ≤ N) from N candidates based on a probability score derived from user features.
Why Edge Intelligence?
Inference runs on the device, saving cloud compute and bandwidth.
Local processing yields faster response times.
Data stays on the device, improving privacy.
Deep‑learning models handle complex scenarios better than rule‑based systems.
Overall Architecture
The solution consists of three modules:
Offline model training: data cleaning, feature engineering, TensorFlow model training, conversion to .tflite.
Cloud side: model version management, monitoring, and configuration distribution.
App side: real‑time feature extraction, TensorFlow‑Lite inference, and result delivery to the business logic.
Data Collection & Feature Engineering
Raw logs provide dimensions such as device model, city, gender, etc. After cleaning, these are transformed into numeric features:
Location: cities clustered into three groups (A, B, C) and encoded as three‑digit binary codes (e.g., "100" for Nanjing).
Device model: grouped by series (X, S, Y) and encoded similarly.
Gender: three‑digit code (female, male, unknown).
Combined, a sample record "vivo X200, Nanjing, male" becomes the binary vector "1001000010".
Model Design
The neural network contains an input layer (engineered features), multiple fully‑connected hidden layers, and two output layers: one producing probability scores for each product class, the other mapping the top‑K classes to SKU IDs.
# Input layer
input_data = keras.layers.Input(shape=(input_size,), name="input")
output = tf.keras.layers.Dense(64, activation="relu")(input_data)
output = tf.keras.layers.Dense(128, activation="relu")(output)
output = tf.keras.layers.Dense(output_size, activation="softmax")(output)
# Output layer: top‑k index
output = NewSkuAndFilterPredictEnvSkuIdLayer(index_groups=acc.index_groups)(output)
# Output layer: map index to SKU ID
output = SkuTopKCategoricalLayer(acc.skuid_list, spu_count=len(acc.spuid_list))(output)Training Procedure
Data from the past three months is cleaned, then split 80/20 for training and testing. The model is trained with RMSprop optimizer and evaluated using SparseTopKCategoricalAccuracy(k=5). Example code:
train_dataset = tf.data.Dataset.from_tensor_slices((train_data, train_labels))
train_dataset = train_dataset.shuffle(buffer_size=datasets.train_len).batch(config.BATCH_SIZE)
model = build_parts_model(acc_input_size, acc_out_size)
optimizer = tf.keras.optimizers.legacy.RMSprop(learning_rate=config.LEARN_RATIO)
model.compile(optimizer=optimizer, loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False),
metrics=[tf.keras.metrics.SparseTopKCategoricalAccuracy(k=5, name="top5_acc_accuracy")])
model.fit(train_dataset, epochs=config.TRAIN_EPOCH)Model Export & Conversion
After ~13 epochs, the model is saved as .h5 and converted to .tflite using TensorFlow‑Lite Converter, ensuring operator compatibility with the mobile runtime.
# Convert Keras model to TFLite
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_float_model = converter.convert()
with open('model.tflite', 'wb') as f:
f.write(tflite_float_model)On‑Device Inference
TensorFlow‑Lite is added as a dependency ( org.tensorflow:tensorflow-lite:2.14.0). The model file is placed in the app’s assets folder and loaded via an Interpreter:
private Interpreter mTfLite = new Interpreter(loadModelFileFromAssets("model.tflite"));
float[][] inputDataArray = new float[1][inputDim];
float[][] outputDataArray = new float[1][outputDim];
mTfLite.run(inputDataArray, outputDataArray);Monitoring & Configuration
Model versioning, success rate, version distribution, and average latency are tracked in a monitoring dashboard to guide future model iterations and ensure stable upgrades.
Conclusion
By abstracting the recommendation problem, engineering relevant features, training a lightweight neural network, converting it to TensorFlow‑Lite, and deploying it on the Vivo app, the team achieved personalized product displays for different user groups, demonstrating the practical value of edge AI in mobile e‑commerce.
vivo Internet Technology
Sharing practical vivo Internet technology insights and salon events, plus the latest industry news and hot conferences.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
