I was working with some LLMs, and I need to compare a set of LLMs based on metrics like Latency, GPU Power Usage, Alignment, Similarity, Clarity, and Conciseness
for 9 Open Source LLMs. So I thought Spider/Radar Chart
would be the best to show the comparison in a single graph. On plotting my data directly I got
Before Normalizing
See, the scaling of my data was wrong, as Alignment to Conciseness
was scaled between 0-10 and the other two has no standard scaling. So I need to bring the Latency and GPU Power Usage
values between 0 to 10. So the solution was Min-Max Normalization
.
Min−MaxNormalization=[(max(x)−min(x))(x−min(x))]×(new_max−new_min)+new_minmin(x)is the minimum value in the data range to be scaledmax(x)is the maximum value in the data range to be scalednew_min(x)is the min value of new scale (0 in [0, 10])new_min(x)is the max value of new scale (10 in [0, 10])
After Normalizing
Now an Example:
We have values [23, 37, 11, 76]
and the requirement is to scale it between 0-10, i.e, min(x)=11,max(x)=76,new_max=10,new_min=0
Equation becomes:⟹[(76−11)(x−11)]×(10−0)+0⟹[(65)(x−11)]×10
Now we can put all the x(s) and get the min-max normalized
values
Real Values | New Values |
---|
23 | 1.8 |
37 | 4 |
11 | 0 |
76 | 10 |
Python Code Snippet for Min-Max Normalization:
normalized = ((values - old_min) / (old_max - old_min)) * (new_max - new_min) + new_min
Normalization vs Standardization vs Scaling
Concept | Definition | Formula | Range | Use Case |
---|
Normalization | Rescales values to a fixed range (usually [0, 1] or [0, 10]) | max(x)−min(x)x−min(x) | Any range | Visualizations, ML when scale matters (e.g., KNN) |
Standardization | Centers data around mean 0 and standard deviation 1 | σx−μ | Mean = 0, SD = 1 | When data is Gaussian, or algorithms assume zero-centered data |
Scaling | Generic term – includes both normalization and standardization | N/A | N/A | Any transformation to bring values into a defined scale |