Edge Intelligence Implementation in the Vivo Official App: Architecture, Feature Engineering, and Model Deployment
The article details how edge intelligence is applied to the Vivo official app to improve product recommendation on the smart‑hardware floor by abstracting the problem, designing feature engineering pipelines, training TensorFlow models, converting them to TFLite, and deploying inference on mobile devices, while also covering monitoring and performance considerations.
This article introduces the practical deployment of edge intelligence (端智能) in the Vivo official app, outlining the motivation to replace manual product configuration with AI‑driven recommendation for the smart‑hardware floor on the app's homepage.
Problem abstraction : The task is to select the top‑K items (K≤N) from a pool of N products for each user segment, which translates to ranking products by predicted click‑through probability using a model that ingests user and context features.
Edge intelligence solution : Deploy AI models on the device (edge) rather than relying on cloud inference, offering benefits such as reduced bandwidth, lower latency, enhanced privacy, and the ability to handle complex scenarios with deep‑learning models.
Overall architecture : Consists of three modules – offline model training, cloud configuration, and on‑device inference. The training pipeline creates a TensorFlow model (.h5), converts it to TensorFlow‑Lite (.tflite), and publishes it via a cloud version‑management service. The app loads the .tflite model with TensorFlow‑Lite and performs real‑time inference.
Data preparation : Raw logs (device model, city, gender, etc.) are cleaned and transformed into one‑hot encoded features. Example: "vivo X200, Nanjing, male" becomes the binary vector 1001000010 . Geographic locations are clustered into three groups, and missing values are handled with default one‑hot bits.
Feature engineering : Features are encoded as fixed‑length binary vectors, preserving order. Position, device model, and gender each use three bits, with additional bits for unknown values.
Model design : A simple fully‑connected neural network with input, hidden, and output layers predicts product probabilities. The architecture is illustrated in the article (see Figure 7).
Model training code example :
# 输入层
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)
# 输出层:top k index
output = NewSkuAndFilterPredictEnvSkuIdLayer(index_groups=acc.index_groups, )(output)
output = SkuTopKCategoricalLayer(acc.skuid_list, spu_count=len(acc.spuid_list))(output)Training process : The cleaned dataset is split 80/20 for training and testing, shuffled, batched, and fed into the model. Training uses RMSprop optimizer and monitors top‑5 categorical accuracy.
Model conversion :
# 保存模型
model.save(f'output/{config.MODEL_NAME}.h5')
# 转换为 TFLite
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_float_model = converter.convert()
with open('mnist_lenet5.tflite', 'wb') as f:
f.write(tflite_float_model)On‑device inference : The app loads the .tflite model via TensorFlow‑Lite Interpreter and runs inference using run() or runForMultipleInputsOutputs() with prepared input and output arrays.
Monitoring : After deployment, the system tracks model load success rate, version distribution, and average runtime to guide future model optimizations.
Conclusion : By abstracting the recommendation problem, engineering suitable features, training a lightweight model, and deploying it with TensorFlow‑Lite, the Vivo app achieves personalized product displays for different user groups, demonstrating the value of edge AI in mobile e‑commerce scenarios.
Architect
Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.
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.