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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CurvOpt: Mathematical Foundations
|
| 2 |
+
|
| 3 |
+
## Energy-Constrained Precision Allocation via Curvature and Information Theory
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## 1. Problem Formulation
|
| 8 |
+
|
| 9 |
+
Let a trained neural network with parameters \( \theta \in \mathbb{R}^d \) minimize empirical risk:
|
| 10 |
+
|
| 11 |
+
\[
|
| 12 |
+
L(\theta) = \frac{1}{n} \sum_{i=1}^{n} \ell(f_\theta(x_i), y_i)
|
| 13 |
+
\]
|
| 14 |
+
|
| 15 |
+
We introduce quantization:
|
| 16 |
+
|
| 17 |
+
\[
|
| 18 |
+
\theta_q = \theta + \varepsilon
|
| 19 |
+
\]
|
| 20 |
+
|
| 21 |
+
where \( \varepsilon \) represents quantization perturbation.
|
| 22 |
+
|
| 23 |
+
We seek precision assignments \( q_l \) per layer \( l \) solving:
|
| 24 |
+
|
| 25 |
+
\[
|
| 26 |
+
\min_{q_l \in \mathcal{Q}}
|
| 27 |
+
\sum_{l=1}^{L} \mathcal{E}_l(q_l)
|
| 28 |
+
\quad
|
| 29 |
+
\text{s.t.}
|
| 30 |
+
\quad
|
| 31 |
+
L(\theta_q) - L(\theta) \le \epsilon
|
| 32 |
+
\]
|
| 33 |
+
|
| 34 |
+
This is a constrained optimization problem over precision levels.
|
| 35 |
+
|
| 36 |
+
**Reference**
|
| 37 |
+
|
| 38 |
+
- Boyd, S., & Vandenberghe, L. (2004). *Convex Optimization*. Cambridge University Press.
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## 2. Second-Order Loss Perturbation
|
| 43 |
+
|
| 44 |
+
Assume \( L \) is twice continuously differentiable.
|
| 45 |
+
|
| 46 |
+
By Taylor expansion around \( \theta \):
|
| 47 |
+
|
| 48 |
+
\[
|
| 49 |
+
L(\theta + \varepsilon)
|
| 50 |
+
=
|
| 51 |
+
L(\theta)
|
| 52 |
+
+
|
| 53 |
+
\nabla L(\theta)^T \varepsilon
|
| 54 |
+
+
|
| 55 |
+
\frac{1}{2} \varepsilon^T H(\theta) \varepsilon
|
| 56 |
+
+
|
| 57 |
+
o(\|\varepsilon\|^2)
|
| 58 |
+
\]
|
| 59 |
+
|
| 60 |
+
where:
|
| 61 |
+
|
| 62 |
+
\[
|
| 63 |
+
H(\theta) = \nabla^2 L(\theta)
|
| 64 |
+
\]
|
| 65 |
+
|
| 66 |
+
Near a stationary point:
|
| 67 |
+
|
| 68 |
+
\[
|
| 69 |
+
\nabla L(\theta) \approx 0
|
| 70 |
+
\]
|
| 71 |
+
|
| 72 |
+
Thus:
|
| 73 |
+
|
| 74 |
+
\[
|
| 75 |
+
\Delta L
|
| 76 |
+
\approx
|
| 77 |
+
\frac{1}{2} \varepsilon^T H \varepsilon
|
| 78 |
+
\]
|
| 79 |
+
|
| 80 |
+
**Reference**
|
| 81 |
+
|
| 82 |
+
- Nocedal, J., & Wright, S. (2006). *Numerical Optimization*. Springer.
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
|
| 86 |
+
## 3. Spectral Bound via Rayleigh Quotient
|
| 87 |
+
|
| 88 |
+
Since \( H \) is symmetric:
|
| 89 |
+
|
| 90 |
+
\[
|
| 91 |
+
\lambda_{\min}(H) \|\varepsilon\|^2
|
| 92 |
+
\le
|
| 93 |
+
\varepsilon^T H \varepsilon
|
| 94 |
+
\le
|
| 95 |
+
\lambda_{\max}(H) \|\varepsilon\|^2
|
| 96 |
+
\]
|
| 97 |
+
|
| 98 |
+
Hence:
|
| 99 |
+
|
| 100 |
+
\[
|
| 101 |
+
\Delta L
|
| 102 |
+
\le
|
| 103 |
+
\frac{1}{2}
|
| 104 |
+
\lambda_{\max}(H)
|
| 105 |
+
\|\varepsilon\|^2
|
| 106 |
+
\]
|
| 107 |
+
|
| 108 |
+
Large eigenvalues correspond to sharp curvature and high sensitivity.
|
| 109 |
+
|
| 110 |
+
**Reference**
|
| 111 |
+
|
| 112 |
+
- Goodfellow, I., Bengio, Y., & Courville, A. (2016). *Deep Learning*. MIT Press.
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
## 4. Trace Approximation via Hutchinson Estimator
|
| 117 |
+
|
| 118 |
+
Exact Hessian computation is infeasible.
|
| 119 |
+
|
| 120 |
+
We use:
|
| 121 |
+
|
| 122 |
+
\[
|
| 123 |
+
\operatorname{Tr}(H)
|
| 124 |
+
=
|
| 125 |
+
\mathbb{E}_{v}
|
| 126 |
+
\left[
|
| 127 |
+
v^T H v
|
| 128 |
+
\right]
|
| 129 |
+
\]
|
| 130 |
+
|
| 131 |
+
where \( v_i \sim \{-1,+1\} \) (Rademacher distribution).
|
| 132 |
+
|
| 133 |
+
This estimator is unbiased.
|
| 134 |
+
|
| 135 |
+
**Reference**
|
| 136 |
+
|
| 137 |
+
- Robert, C., & Casella, G. (2004). *Monte Carlo Statistical Methods*. Springer.
|
| 138 |
+
|
| 139 |
+
---
|
| 140 |
+
|
| 141 |
+
## 5. Quantization Noise Model
|
| 142 |
+
|
| 143 |
+
Uniform quantization with step size \( \Delta \):
|
| 144 |
+
|
| 145 |
+
\[
|
| 146 |
+
\varepsilon \sim \mathcal{U}\left(-\frac{\Delta}{2}, \frac{\Delta}{2}\right)
|
| 147 |
+
\]
|
| 148 |
+
|
| 149 |
+
Variance:
|
| 150 |
+
|
| 151 |
+
\[
|
| 152 |
+
\operatorname{Var}(\varepsilon)
|
| 153 |
+
=
|
| 154 |
+
\frac{\Delta^2}{12}
|
| 155 |
+
\]
|
| 156 |
+
|
| 157 |
+
Expected loss increase:
|
| 158 |
+
|
| 159 |
+
\[
|
| 160 |
+
\mathbb{E}[\Delta L]
|
| 161 |
+
\approx
|
| 162 |
+
\frac{1}{2}
|
| 163 |
+
\operatorname{Tr}(H)
|
| 164 |
+
\cdot
|
| 165 |
+
\frac{\Delta^2}{12}
|
| 166 |
+
\]
|
| 167 |
+
|
| 168 |
+
This connects precision (through \( \Delta \)) directly to curvature.
|
| 169 |
+
|
| 170 |
+
**Reference**
|
| 171 |
+
|
| 172 |
+
- Gallager, R. (1968). *Information Theory and Reliable Communication*. Wiley.
|
| 173 |
+
|
| 174 |
+
---
|
| 175 |
+
|
| 176 |
+
## 6. Information-Theoretic Layer Relevance
|
| 177 |
+
|
| 178 |
+
For layer \( l \):
|
| 179 |
+
|
| 180 |
+
\[
|
| 181 |
+
I(X_l ; Y_l)
|
| 182 |
+
=
|
| 183 |
+
\int p(x,y)
|
| 184 |
+
\log
|
| 185 |
+
\frac{p(x,y)}{p(x)p(y)}
|
| 186 |
+
\, dx\,dy
|
| 187 |
+
\]
|
| 188 |
+
|
| 189 |
+
Data Processing Inequality:
|
| 190 |
+
|
| 191 |
+
\[
|
| 192 |
+
I(X; Y_{l+1}) \le I(X; Y_l)
|
| 193 |
+
\]
|
| 194 |
+
|
| 195 |
+
Thus information cannot increase through deterministic transformations.
|
| 196 |
+
|
| 197 |
+
Layers with low marginal information contribution can tolerate larger perturbations.
|
| 198 |
+
|
| 199 |
+
**Reference**
|
| 200 |
+
|
| 201 |
+
- Cover, T., & Thomas, J. (2006). *Elements of Information Theory*. Wiley.
|
| 202 |
+
|
| 203 |
+
---
|
| 204 |
+
|
| 205 |
+
## 7. Constrained Energy Minimization
|
| 206 |
+
|
| 207 |
+
We combine curvature-based sensitivity and energy cost:
|
| 208 |
+
|
| 209 |
+
\[
|
| 210 |
+
\min_{q_l}
|
| 211 |
+
\sum_l \mathcal{E}_l(q_l)
|
| 212 |
+
+
|
| 213 |
+
\lambda
|
| 214 |
+
\left(
|
| 215 |
+
\sum_l
|
| 216 |
+
\frac{1}{24}
|
| 217 |
+
\operatorname{Tr}(H_l)
|
| 218 |
+
\Delta_l^2
|
| 219 |
+
-
|
| 220 |
+
\epsilon
|
| 221 |
+
\right)
|
| 222 |
+
\]
|
| 223 |
+
|
| 224 |
+
Using KKT optimality conditions:
|
| 225 |
+
|
| 226 |
+
\[
|
| 227 |
+
\nabla_{q_l} \mathcal{L} = 0
|
| 228 |
+
\]
|
| 229 |
+
|
| 230 |
+
This yields optimal precision allocation under a global accuracy constraint.
|
| 231 |
+
|
| 232 |
+
**Reference**
|
| 233 |
+
|
| 234 |
+
- Bertsekas, D. (1999). *Nonlinear Programming*. Athena Scientific.
|
| 235 |
+
|
| 236 |
+
---
|
| 237 |
+
|
| 238 |
+
## 8. Summary
|
| 239 |
+
|
| 240 |
+
CurvOpt is grounded in:
|
| 241 |
+
|
| 242 |
+
1. Second-order perturbation theory
|
| 243 |
+
2. Spectral sensitivity bounds
|
| 244 |
+
3. Monte Carlo trace estimation
|
| 245 |
+
4. Classical quantization noise modeling
|
| 246 |
+
5. Shannon mutual information
|
| 247 |
+
6. Constrained nonlinear optimization via KKT
|
| 248 |
+
|
| 249 |
+
All formulations above are standard results from established literature.
|