Quantize a Language Model to Int4 for On-Device Inference on Pixel

Last updated: November 29, 2026

Quick Overview

Plan how to quantize a few-billion-parameter language model to 4-bit weights for on-device inference on a Pixel phone, explaining scale choices, outliers, and how to keep quality from regressing.

Google
Machine Learning
Machine Learning Engineer
Google
November 29, 2026
Machine Learning Engineer
Onsite
Machine Learning
Hard

0

0

0 solved


Plan how to quantize a few-billion-parameter language model to 4-bit weights for on-device inference on a Pixel phone, explaining scale choices, outliers, and how to keep quality from regressing.

On-device models such as Gemini Nano power features like summarization and smart replies on Pixel, where memory and battery dominate. Google interviewers ask this to see whether a candidate understands quantization error mechanically and can run a disciplined quality evaluation rather than trusting a single benchmark.

What the Interviewer Expects
  • Computes memory at different bit widths
  • Explains symmetric scale-and-round quantization and error sources
  • Compares per-tensor, per-channel, and group-wise scales
  • Explains why outlier features and activations are the hard part
  • Contrasts post-training quantization methods with quantization-aware training
  • Proposes an evaluation plan including on-device latency and task quality
Key Topics to Cover
Quantization
Int4 weights
On-device inference
Outliers
Quantization-aware training
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • Why are activations harder to quantize than weights?
  • How do error-compensating methods choose rounding to minimize layer output error?
  • Would you also quantize the KV cache, and how?
  • How would you detect quality regressions that average benchmark scores hide?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Model: about 3B parameters, target phone with a few GB of RAM shared with apps, decode speed limited by memory bandwidth. Target: weights in 4 bits, activations in 8 or 16 bits, quality within a small...

Approach

Memory: 3B parameters is 6 GB in bf16, 3 GB in int8, about 1.5 GB in int4 plus scales. Because decoding reads every weight per token, 4-bit also roughly quadruples decode speed versus bf16. Symmetric ...


Submit Your Answer
Markdown supported