For smaller models and edge AI, key metrics include model size, latency, and energy efficiency. Accuracy remains important but must be balanced with these constraints. We want models that are small and fast enough to run on devices like phones or sensors, while still making good predictions.
Emerging trends (smaller models, edge AI) in Prompt Engineering / GenAI - Model Metrics & Evaluation
Start learning this pattern below
Jump into concepts and practice - no test required
| Predicted Positive | Predicted Negative |
|--------------------|--------------------|
| True Positive (TP): 40 | False Negative (FN): 10 |
| False Positive (FP): 5 | True Negative (TN): 45 |
Total samples = 40 + 10 + 5 + 45 = 100
Precision = TP / (TP + FP) = 40 / (40 + 5) = 0.89
Recall = TP / (TP + FN) = 40 / (40 + 10) = 0.80
Accuracy = (TP + TN) / Total = (40 + 45) / 100 = 0.85
This shows a balanced model that works well on-device with good precision and recall.
Imagine a smart home camera detecting intruders. High precision means it rarely mistakes a family member for an intruder (few false alarms). High recall means it catches almost all real intruders (few misses). On edge devices, we must balance these because complex models that improve recall might be too slow or large.
Choosing the right tradeoff depends on what matters more: avoiding false alarms (precision) or catching every threat (recall).
Good: Accuracy around 85%+, precision and recall balanced above 80%, model size under 10MB, latency under 100ms, and low power use.
Bad: Accuracy below 70%, very low recall (missing many cases), model size too large to run on device, or latency causing slow responses.
- Ignoring latency and size: A model with great accuracy but too big or slow is unusable on edge.
- Overfitting: Small models can overfit if not trained well, leading to poor real-world results.
- Data leakage: Using test data during training inflates accuracy falsely.
- Accuracy paradox: High accuracy on imbalanced data can be misleading if recall or precision is low.
Your edge AI model has 98% accuracy but only 12% recall on detecting faults. Is it good for production? Why or why not?
Answer: No, it is not good. The low recall means the model misses most faults, which is critical to detect. High accuracy can be misleading if the data is imbalanced with many normal cases.
Practice
Solution
Step 1: Understand smaller AI models
Smaller AI models are designed to be lightweight, so they use less memory and compute power.Step 2: Identify benefits for smartphones
Because phones have limited memory and processing power, smaller models help them run AI tasks faster and more efficiently.Final Answer:
They run faster and use less memory -> Option CQuick Check:
Smaller models = faster, less memory [OK]
- Thinking smaller models need big servers
- Assuming smaller models require internet
- Believing smaller models always improve accuracy
Solution
Step 1: Identify edge AI code
Edge AI runs AI models locally, so loading a small model like 'small_model.tflite' fits this.Step 2: Check correct method usage
Usingpredictruns inference, which is typical for edge AI. Training or uploading is not common on edge devices.Final Answer:
model = load_model('small_model.tflite') result = model.predict(input_data) -> Option DQuick Check:
Load small model + predict locally = edge AI [OK]
- Using training instead of prediction on edge
- Downloading models from cloud during inference
- Uploading data instead of predicting locally
class SmallModel:
def predict(self, x):
return x * 2
model = SmallModel()
result = model.predict(5)
print(result)Solution
Step 1: Understand the predict method
The method multiplies inputxby 2 and returns it.Step 2: Calculate the output for input 5
5 * 2 = 10, soresultis 10.Final Answer:
10 -> Option AQuick Check:
5 times 2 equals 10 [OK]
- Confusing multiplication with addition
- Expecting input as output
- Assuming code causes error
input_data = [1, 2, 3]
model = load_model('small_model.tflite')
result = model.train(input_data)
print(result)Solution
Step 1: Understand edge AI capabilities
Edge AI devices typically run inference (predict), not training, because training needs more resources.Step 2: Identify incorrect method usage
Callingtrainon the model is incorrect for edge AI; it should bepredict.Final Answer:
Edge devices usually do not train models, only predict -> Option BQuick Check:
Edge AI = predict, not train [OK]
- Thinking edge devices can train models
- Assuming file name causes error
- Ignoring method misuse
Solution
Step 1: Understand offline edge AI needs
Offline means no internet, so AI must run locally on the device.Step 2: Choose model size for smartwatch
Smartwatches have limited memory and power, so a small AI model is best to run locally.Final Answer:
Use a small AI model running locally on the watch -> Option AQuick Check:
Offline + smartwatch = small local model [OK]
- Choosing cloud models needing internet
- Streaming audio defeats offline goal
- Ignoring device memory limits
