Skip to Content
You are currently on the new version of our website. Access the old version .
  • Proceeding Paper
  • Open Access

18 September 2026

Mixed-Integer Nonlinear Programming for Compact-Weight Training of Two-Hidden-Layer Neural Networks †

and
Computer Science School, Faculty of Agricultural Industries and Environmental Sciences, Universidad Politécnica Estatal del Carchi (UPEC), Tulcán 040150, Ecuador
*
Author to whom correspondence should be addressed.
†
Presented at the Sixth International Conference on Information Systems and Software Technologies (ICI2ST 2026), Quito, Ecuador, 23–25 September 2026.

Abstract

We formulate the training of a fully connected feed-forward neural network with two hidden layers as a nonlinear programming framework with integer-parameterized architectures. The upper level selects an L2 regularization coefficient λ ∈ [ λ min , λ max ] , a learning rate α ∈ [ α min , α max ] , and admissible hidden widths ( h 1 , h 2 ) ∈ N 2 to minimize the compactness-augmented objective f = BCE ( W N ) + γ ∥ W N ∥ F 2 , where W N = A N ( λ , α ; W 0 ) is the deterministic output of N Adam iterations on L λ ( W ) = BCE ( W ) + λ 2 ∥ θ ( W ) ∥ 2 2 . The continuous relaxation is solved with projected L-BFGS-B and feasible finite-difference gradients; integer architectures are handled by exhaustive enumeration over a finite set H . We establish: (i) coercivity and attainment of the inner objective for λ > 0 under full-parameter L2 regularization; (ii) attainment of the upper-level problem under lower semi-continuity on the compact hyperparameter box; (iii) conditional KKT accumulation of projected L-BFGS-B under idealized smoothness and vanishing finite-difference assumptions. The framework is validated on five synthetic two-dimensional binary classification benchmarks using the fixed architecture ( 48 , 24 ) to isolate the continuous optimization level. Across the five datasets, the optimized network reaches a Frobenius weight norm 6.4 – 43.7 % smaller than the baseline while the classification accuracy gap stays within − 4.0 to + 0.0 percentage points. A three-dimensional visualization of the upper-level objective in ( log 10 λ , log 10 α ) reveals a smooth small- λ basin and a steep ridge of trivial near-zero weight solutions near the upper regularization bound.

1. Introduction

Two-hidden-layer fully connected neural networks remain canonical models for low-dimensional binary classification, yet their behavior depends sensitively on the L2 regularization coefficient λ and the learning rate α  [1,2]. In compact-deployment settings, the user also faces discrete architectural choices: selecting hidden widths ( h 1 , h 2 ) ∈ N 2 from a finite admissible set and selecting continuous hyperparameters that control accuracy and weight magnitude. We use the term compact-weight training rather than memory-efficient training: with a fixed architecture, the number of stored parameters is unchanged, and the reported compactness is a reduction in the Frobenius norm of the trained weights; structural memory reduction would require the integer level to select a smaller architecture.
Hyperparameter optimization is often treated by black-box methods such as Bayesian optimization and random search [3,4], whereas L-BFGS-B and related quasi-Newton methods provide structured tools for smooth box-constrained nonlinear programs [5,6,7]. This paper connects these viewpoints for a small feed-forward network whose weights are produced by a finite Adam recursion [8]. The continuous relaxation is solved by projected L-BFGS-B with feasible finite-difference gradients, and integer widths are handled by outer enumeration over a finite architectural set H . The implementation is available as a single Python 3.13 module [9].
The contributions are: (i) an explicit mixed-integer nonlinear formulation with an algorithmic inner map W N ( λ , α ) , rather than an ambiguous nonconvex argmin; (ii) structural results on inner coercivity, upper-level attainment under lower semi-continuity, and conditional KKT accumulation of projected L-BFGS-B; (iii) a fixed-architecture validation on five synthetic datasets showing 6.4–43.7% Frobenius norm reduction with an accuracy gap in [ − 4.0 , + 0.0 ] percentage points; (iv) a surface analysis explaining the role of the upper bound λ max in avoiding trivial near-zero-weight solutions.
Section 2, Section 3 and Section 4 give the formulation and mathematical analysis, with the algorithmic two-level structure summarized in Figure 1; Section 5 reports the experiments; Section 6 concludes.
Figure 1. Two-level structure of the continuous relaxation NLP − INT c : L-BFGS-B searches over ( λ , α ) ∈ B , while each upper-level objective evaluation calls a finite N-step Adam recursion that returns W N ( λ , α ) , the network parameters obtained after N Adam iterations from the deterministic initialization W 0 .

2. Problem Formulation

2.1. Network and Admissible Architectures

Let X ∈ R m × 2 be a feature matrix of m samples and let y ∈ { 0 , 1 } m × 1 be the associated binary labels. The classifier is a two-hidden-layer feed-forward network of the form
y ^ ( x ; W ) = σ ϕ ϕ ( x W ( 1 ) + b ( 1 ) ) W ( 2 ) + b ( 2 ) W ( 3 ) + b ( 3 ) ,
where σ is the logistic function and ϕ is a configurable activation, taken as ReLU in all the experiments. The weight matrices are W ( 1 ) ∈ R 2 × h 1 , W ( 2 ) ∈ R h 1 × h 2 , W ( 3 ) ∈ R h 2 × 1 , with bias vectors b ( ℓ ) ∈ R 1 × h ℓ , ℓ = 1 , 2 , 3 (where h 3 = 1 ). The full parameter is
W = ( W ( 1 ) , b ( 1 ) , W ( 2 ) , b ( 2 ) , W ( 3 ) , b ( 3 ) ) ∈ R n ( h 1 , h 2 ) , n ( h 1 , h 2 ) = 3 h 1 + h 1 h 2 + 2 h 2 + 1 .
For the purpose of regularization we write θ ( W ) ∈ R n ( h 1 , h 2 ) for the vector that stacks all weight and bias entries of W. The full Euclidean norm of θ ( W ) is then
∥ θ ( W ) ∥ 2 2 = ∑ ℓ = 1 3 ∥ W ( ℓ ) ∥ F 2 + ∥ b ( ℓ ) ∥ 2 2 .
We will explicitly distinguish between the full-parameter norm (3), used for regularization and coercivity arguments, and the weight-only Frobenius norm
∥ W ∥ F 2 = ∥ W ( 1 ) ∥ F 2 + ∥ W ( 2 ) ∥ F 2 + ∥ W ( 3 ) ∥ F 2 ,
used as the compactness diagnostic in the upper-level objective and reported in the experimental tables.
The integer hidden widths ( h 1 , h 2 ) are constrained to a finite architectural admissible set
H ⊂ N > 0 2 , | H | < ∞ ,
which encodes the discrete decision component of the program. The theoretical formulation and Algorithm 1 apply to any finite admissible set H ⊂ N > 0 2 . In the computational validation, we use the singleton set
H exp = { ( 48 , 24 ) } ,
so that the experiments isolate the continuous optimization level in ( λ , α ) without introducing additional variability from architectural search. A larger architectural set, such as { ( 16 , 8 ) , ( 24 , 12 ) , ( 32 , 16 ) , ( 48 , 24 ) , ( 64 , 32 ) } , can be handled by the same outer enumeration in Algorithm 1 but is not used to generate the numerical results reported here.
Algorithm 1 Solver for NLP − INT : outer enumeration plus inner L-BFGS-B
Require: Data ( X , y ) ; admissible set H ; box B ; weight γ ; inner length N pre .
Ensure: Tuple ( λ ★ , α ★ , h 1 ★ , h 2 ★ ) approximately solving NLP − INT .
  1:
Initialize f ★ ← + ∞ .
  2:
for each ( h 1 , h 2 ) ∈ H  do
  3:
      Generate deterministic Xavier initialization W 0 ( h 1 , h 2 ) .
  4:
      Choose an initial point p 0 = ( λ 0 , α 0 ) ∈ B .
  5:
      Solve min p ∈ B f ( p ; h 1 , h 2 ) with projected L-BFGS-B using the finite-difference gradient (17); obtain ( λ † , α † ) and value f † .
  6:
      if  f † < f ★  then
  7:
             f ★ ← f † ; ( λ ★ , α ★ , h 1 ★ , h 2 ★ ) ← ( λ † , α † , h 1 , h 2 ) .
  8:
      end if
  9:
end for
10:
return  ( λ ★ , α ★ , h 1 ★ , h 2 ★ ) .

2.2. Loss, Regularization and the Compactness Diagnostic

For a fixed architecture ( h 1 , h 2 ) ∈ H , define the binary cross-entropy loss as
BCE ( W ) = − 1 m ∑ i = 1 m y i log y ^ ( x i ; W ) + ( 1 − y i ) log 1 − y ^ ( x i ; W ) ,
where y ^ is the output in (1); for the theoretical bounds and the numerical implementation, the sigmoid output is clipped to [ ε 0 , 1 − ε 0 ] with a fixed ε 0 ∈ ( 0 , 1 / 2 ) before evaluating the logarithms. The inner (lower-level) objective combines BCE and L2 regularization on the full parameter θ ( W ) :
L λ ( W ) = BCE ( W ) + λ 2 ∥ θ ( W ) ∥ 2 2 , λ ≥ 0 .
Regularizing the full parameter vector (weights and biases) is the convention required for the coercivity argument of Theorem 1 below; it differs marginally from the bias-free L2 convention of textbook references [1,2], with no practical impact in our experiments since the trained biases remain small relative to the weights.
The upper-level objective penalizes the weight-only Frobenius norm as a compactness diagnostic:
f ( λ , α ; h 1 , h 2 ) = BCE W N ( λ , α ; h 1 , h 2 ) + γ ∥ W N ( λ , α ; h 1 , h 2 ) ∥ F 2 ,
where W N ( λ , α ; h 1 , h 2 ) denotes the deterministic output of N Adam iterations on the inner objective L λ (defined precisely in Section 3). Because the weight-only norm is the quantity that practitioners customarily monitor for weight compactness, we keep ∥ · ∥ F rather than ∥ θ ( · ) ∥ 2 in the upper-level penalty; the two coincide up to a small bias contribution in all our experiments.

2.3. The Mixed-Integer Nonlinear Program NLP − INT

The full problem is
NLP − INT : min ( λ , α , h 1 , h 2 ) f ( λ , α ; h 1 , h 2 )
s . t . W N ( λ , α ; h 1 , h 2 ) = A N λ , α ; W 0 ( h 1 , h 2 ) ,
λ ∈ [ λ min , λ max ] = [ 10 − 6 , 10 − 1 ] ,
α ∈ [ α min , α max ] = [ 10 − 4 , 5 × 10 − 2 ] ,
( h 1 , h 2 ) ∈ H ⊂ N > 0 2 ,
where A N denotes N iterations of the Adam recursion applied to L λ starting from a deterministic Xavier initialization W 0 ( h 1 , h 2 ) that depends on the architecture but not on the hyperparameters. The decision variables ( h 1 , h 2 ) enter NLP − INT both through H (an integer constraint) and through the dimension n ( h 1 , h 2 ) of the weight space; the variables ( λ , α ) are continuous and box-constrained. The problem is therefore mixed-integer, nonlinear and bilevel. The choice γ > 0 small (we use γ = 2 × 10 − 3 ) keeps classification dominant in (9); the role of γ is discussed below.
Remark 1
(Algorithmic vs. variational inner solution). A variational definition W ★ ( λ ) ∈ arg min W L λ ( W ) is unsuitable here because L λ is nonconvex and the argmin set need not be single-valued. We therefore define W N ( λ , α ; h 1 , h 2 ) as the deterministic N-step Adam output. This makes the upper objective single-valued, explicitly incorporates the learning rate α, and matches the implementation.
Definition 1
(Continuous relaxation). Fix ( h 1 , h 2 ) ∈ H . The continuous relaxation NLP − INT c ( h 1 , h 2 ) of NLP − INT is obtained by holding the integer pair fixed and minimizing f ( λ , α ; h 1 , h 2 ) over the rectangle B = [ λ min , λ max ] × [ α min , α max ] .

3. Lower-Level Nonconvex Problem and Adam Map

3.1. The Adam Recursion

For fixed hyperparameters ( λ , α ) and fixed architecture, the lower level is a continuous, piecewise differentiable nonconvex unconstrained problem; under ReLU, gradients are understood in the usual implementation sense, with an arbitrary admissible subgradient selected at kink points. The algorithmic choice in the code is the Adam optimizer [8]. With β 1 = 0.9 , β 2 = 0.999 , ε = 10 − 8 and bias-corrected first and second moments m ^ t , v ^ t , one iteration reads
g t = ∇ L λ ( W t − 1 ) , m ^ t = m t 1 − β 1 t , v ^ t = v t 1 − β 2 t , W t = W t − 1 − α m ^ t ⊘ v ^ t + ε ,
where m t = β 1 m t − 1 + ( 1 − β 1 ) g t , v t = β 2 v t − 1 + ( 1 − β 2 ) g t ⊙ g t , ⊙ is the Hadamard product and ⊘ is element-wise division. The recursion is initialized with Xavier weights W 0 ( ℓ ) ∼ N ( 0 , 2 / h ℓ − 1 ) and zero biases, with a fixed random seed so that the initial point depends on ( h 1 , h 2 ) but not on ( λ , α ) . We denote the resulting deterministic map of length N by
W N ( λ , α ; h 1 , h 2 ) = A N λ , α ; W 0 ( h 1 , h 2 ) ,
which is the precise object that enters the upper-level objective (9).

3.2. Existence of Lower-Level Minimizers

Theorem 1
(Inner coercivity and attainment). For every fixed λ > 0 and every architecture ( h 1 , h 2 ) ∈ N > 0 2 , the inner objective L λ : R n ( h 1 , h 2 ) → R defined in (8) is continuous, bounded below, and coercive, namely
lim ∥ θ ( W ) ∥ 2 → ∞ L λ ( W ) = + ∞ .
Consequently L λ attains its infimum on R n ( h 1 , h 2 ) , and the argmin set arg min W L λ ( W ) is nonempty.
Lemma 1
(BCE is bounded and continuous under output clipping). Let y ^ ( · ; W ) be the clipped sigmoid output y ^ ∈ [ ε 0 , 1 − ε 0 ] with ε 0 ∈ ( 0 , 1 2 ) . Then, the BCE map W ↦ BCE ( W ) in (7) is continuous on R n ( h 1 , h 2 ) and satisfies
0 ≤ BCE ( W ) ≤ − log ε 0 for all W ∈ R n ( h 1 , h 2 ) .
Proof. 
The composition W ↦ y ^ ( · ; W ) is the composition of finitely many affine maps with the continuous activations ϕ (ReLU) and σ , projected to [ ε 0 , 1 − ε 0 ] by the clip; hence, it is continuous in W. For each sample, − y log y ^ − ( 1 − y ) log ( 1 − y ^ ) ≥ 0 , and, since y ^ ∈ [ ε 0 , 1 − ε 0 ] , both log y ^ and log ( 1 − y ^ ) lie in [ log ε 0 , log ( 1 − ε 0 ) ] ⊂ [ log ε 0 , 0 ] , so each summand is at most − log ε 0 . Averaging over m samples gives (14). □
Proof of Theorem 1.
By Lemma 1, BCE is continuous on R n ( h 1 , h 2 ) and bounded in [ 0 , − log ε 0 ] . The map W ↦ λ 2 ∥ θ ( W ) ∥ 2 2 is continuous, non-negative, and quadratic in the full parameter; in particular, it tends to + ∞ as ∥ θ ( W ) ∥ 2 → ∞ whenever λ > 0 . Since θ : R n ( h 1 , h 2 ) → R n ( h 1 , h 2 ) is the identity reshape of the parameter, we have ∥ θ ( W ) ∥ 2 2 = ∥ W ( 1 ) ∥ F 2 + ∥ b ( 1 ) ∥ 2 2 + ∥ W ( 2 ) ∥ F 2 + ∥ b ( 2 ) ∥ 2 2 + ∥ W ( 3 ) ∥ F 2 + ∥ b ( 3 ) ∥ 2 2 , so the regularizer penalizes every entry of W. Adding the two terms reveals that L λ is continuous on R n ( h 1 , h 2 ) , bounded below by 0, and satisfies
L λ ( W ) ≥ λ 2 ∥ θ ( W ) ∥ 2 2 → ∥ θ ( W ) ∥ 2 → ∞ + ∞ ,
which is exactly (13). By the Weierstrass theorem [10], the sublevel set S 0 = { W : L λ ( W ) ≤ L λ ( 0 ) } is nonempty (it contains 0) and bounded (otherwise, we could extract a sequence { W k } ⊂ S 0 with ∥ θ ( W k ) ∥ 2 → ∞ , contradicting coercivity), hence becoming compact since it is closed. The continuous function L λ attains its infimum on S 0 , and since any minimizer must satisfy L λ ( W ★ ) ≤ L λ ( 0 ) , this minimizer is global on R n ( h 1 , h 2 ) . Therefore, arg min W L λ ( W ) ≠ ∅ . □
Remark 2
(Why full-parameter L2 is needed). A bias-free L2 penalty would not be coercive on the full-parameter space: one may set all weight matrices to zero and let a bias vector diverge while the BCE remains bounded by Lemma 1. The full-parameter penalty (8) removes this gap. Numerically, this adjustment is negligible in the reported runs because the trained biases remain small relative to the weights.
Remark 3.
Theorem 1 guarantees the existence but not the uniqueness of a lower-level minimizer: L λ is nonconvex in W due to the composition with the activation ϕ, and multiple local minima are routine. The Adam map A N in (12) is a deterministic surrogate that returns one specific point in the parameter space after N iterations; this surrogate is what enters the upper-level objective, by the convention adopted in Remark 1 and Equation (10b). Throughout we use N = N pre = 200 in the L-BFGS-B inner evaluations and N = 1200 (with early stopping) for the final retraining at the optimized hyperparameters.

3.3. Empirical Lower-Level Convergence

Figure 2 reports the training loss, classification accuracy, and Frobenius norm of W t on the Spiral dataset for two distinct choices of ( λ , α ) : the unstructured baseline ( λ base , α base ) = ( 10 − 4 , 3 × 10 − 3 ) and the L-BFGS-B-tuned pair ( λ ★ , α ★ ) obtained on the same problem. The baseline converges faster in accuracy but reaches a much larger weight norm; the L-BFGS-B-tuned pair drives ∥ W t ∥ F to a significantly smaller value at the price of a slower-accuracy ramp-up. Both trajectories use early stopping with patience 80 and two learning-rate decays of factor 0.3 , exactly as in the implementation.
Figure 2. Adam trajectory on Spiral for the baseline and L-BFGS-B-tuned hyperparameters. Here, ( λ * , α * ) denotes the hyperparameter pair returned by the upper-level L-BFGS-B optimization. (left) Training loss L λ ; (centre) accuracy; (right) Frobenius weight norm.

4. Upper-Level Mixed-Integer Nonlinear Program

4.1. Attainment of the Upper-Level Infimum

We now switch to f ( λ , α ; h 1 , h 2 ) in (9). Throughout, the inner map ( λ , α ) ↦ W N ( λ , α ) is the deterministic Adam recursion of length N pre = 200 defined in (12), starting from the deterministic Xavier initialization W 0 ( h 1 , h 2 ) .
Theorem 2
(Upper-level attainment under lower semi-continuity). Fix ( h 1 , h 2 ) ∈ H and the inner recursion parameters ( N pre , β 1 , β 2 , ε , W 0 ) . Assume that the finite-step upper-level objective f ( · , · ; h 1 , h 2 ) defined in (9) is lower semi-continuous on the compact rectangle B . Then, the continuous relaxation NLP − INT c ( h 1 , h 2 ) is feasible, f is bounded below by 0, and its infimum is attained on B . If H is finite and the same lower semi-continuity assumption holds for every ( h 1 , h 2 ) ∈ H , then the full problem NLP − INT in (10) admits an optimal ( λ ★ , α ★ , h 1 ★ , h 2 ★ ) .
Proof. 
The rectangle B = [ λ min , λ max ] × [ α min , α max ] is nonempty and compact. The point ( λ base , α base ) ∈ B is feasible, so NLP − INT c ( h 1 , h 2 ) is feasible. Since BCE ≥ 0 and γ ∥ W N ∥ F 2 ≥ 0 , the upper-level objective satisfies f ≥ 0 on B . By assumption, f is lower semi-continuous on the compact set B ; therefore, by the Weierstrass extreme-value theorem for lower semi-continuous functions on compact sets [10], f attains its infimum on B . If H is finite, the collection of architecture-wise minima { min ( λ , α ) ∈ B f ( λ , α ; h 1 , h 2 ) : ( h 1 , h 2 ) ∈ H } is finite and nonempty. Thus, its minimum is attained by enumeration. This gives an optimal tuple for NLP − INT . □
Remark 4
(Regularity of the finite-step objective). The lower semi-continuity assumption in Theorem 2 is deliberately stated explicitly. It is automatic if the activation used in the inner recursion is smooth, such as softplus, and if the training schedule is fixed for exactly N pre steps. In the implementation reported here, the activation is ReLU, the sigmoid output is clipped, and the L-BFGS-B objective evaluation uses a fixed finite Adam budget. This produces a piecewise smooth objective in practice, but it is safer mathematically to state upper-level attainment as a conditional structural result rather than to claim unconditional smoothness for a ReLU-trained bilevel map.
Remark 5
(Boundedness below). A more quantitative lower bound is available: since BCE ≥ 0 everywhere and γ ∥ W N ∥ F 2 ≥ 0 , we have f ≥ 0 on B . The infimum is therefore in [ 0 , f ( λ base , α base ) ] .

4.2. Projected L-BFGS-B with Finite-Difference Gradient

The upper-level relaxation (10a)–(10d) is solved with the projected quasi-Newton L-BFGS-B method [5,6]. At iterate p k = ( λ k , α k ) ∈ B , the algorithm produces a search direction
d k = − H ^ k − 1 ∇ ^ f ( p k ) ,
where H ^ k − 1 is the L-BFGS limited-memory inverse-Hessian approximation built from the last ≤ 10 pairs of curvature information ( s i , y i ) = ( p i + 1 − p i , ∇ ^ f ( p i + 1 ) − ∇ ^ f ( p i ) ) , and ∇ ^ f is computed with feasible one-sided finite differences inside the box:
∇ ^ f ( p ) j = f ( p + h j ( p ) e j ) − f ( p ) h j ( p ) , h j ( p ) = δ , p j + δ ≤ u j , − δ , p j + δ > u j , j = 1 , 2 , δ = δ k > 0 ,
where B = [ ℓ 1 , u 1 ] × [ ℓ 2 , u 2 ] . For sufficiently small δ k (and, in particular, for the value used in the computations), the perturbed point p + h j ( p ) e j remains feasible for all p ∈ B . The direction is projected onto B to maintain feasibility, the step length is chosen by Armijo–Wolfe line search, and the iteration is terminated when ∥ P B ( p k − ∇ ^ f ( p k ) ) − p k ∥ 2 < ftol with ftol = 10 − 8 or after 40 outer iterations.

4.3. Conditional KKT Accumulation Statement

For the box-constrained relaxation NLP − INT c ( h 1 , h 2 ) the Karush–Kuhn–Tucker conditions at a point p ★ = ( λ ★ , α ★ ) ∈ B read
p ★ = P B p ★ − ∇ f ( p ★ ) ,
where P B is the Euclidean projection onto the rectangle B . Equation (18) is the standard fixed-point characterization of a stationary point of a continuously differentiable function over a closed convex set [10].
Because the bilevel objective f defined in (9) arises from a N pre -step Adam recursion through a ReLU network—and is therefore at best Lipschitz continuous on B , with a measure-zero set of nondifferentiability inherited from the ReLU breakpoints—we phrase the convergence statement of projected L-BFGS-B as a conditional proposition under explicit idealized hypotheses, rather than as an unconditional theorem.
Proposition 1
(Conditional KKT accumulation of projected L-BFGS-B). Assume that:
(H1) 
The bilevel objective f admits a continuously differentiable extension on the closed rectangle B , i.e., f ∈ C 1 ( B ) ;
(H2) 
The forward finite-difference step δ = δ k in (17) is driven to zero along a subsequence, δ k → 0 + ;
(H3) 
The Armijo–Wolfe line search is well-defined at every iterate and satisfies sufficient decrease;
(H4) 
The L-BFGS curvature pairs ( s i , y i ) satisfy the positive-curvature condition ⟨ s i , y i ⟩ > 0 .
Then, every accumulation point p ∞ of the sequence { p k } produced by the projected L-BFGS-B iteration (16) satisfies the KKT condition (18), i.e., p ∞ is a stationary point of the continuous relaxation NLP − INT c ( h 1 , h 2 ) . The convergence is to a KKT point, not necessarily to a global minimum, since f is nonconvex on B .
Proof sketch.
Under (H1)–(H4), the claim is a particularization of the convergence theorem of Byrd–Lu–Nocedal–Zhu for L-BFGS-B [5] (Theorem 6.3), [6] (Section 3). The cited result assumes continuous differentiability of the objective on the feasible box (provided by (H1)), the positive-curvature condition (provided by (H4)), and a step length chosen by Armijo–Wolfe to enforce sufficient decrease (provided by (H3)). The only additional ingredient here is the use of a finite-difference gradient (17) instead of an analytic gradient. By the mean value theorem applied component-wise, ∇ ^ f ( p ) j = ∂ j f ( ξ p , j ) for some ξ p , j on the feasible segment joining p and p + h j ( p ) e j ; under (H1), the partial derivatives are continuous on the compact B and hence uniformly continuous, so (H2) yields ∇ ^ f ( p ) → ∇ f ( p ) uniformly on B as | h j ( p ) | → 0 , and the conclusion of the cited theorem applies on the limit. Compactness of B guarantees the existence of accumulation points. □
Remark 6
(Gap between theory and implementation). The implementation does not satisfy all idealized hypotheses of Proposition 1: ReLU makes f piecewise smooth rather than globally C 1 , and SciPy uses a fixed finite-difference step δ = 10 − 5 rather than δ k → 0 [11]. Early stopping and learning-rate decay are used only for final post-optimization training curves, not inside the finite-step objective evaluated by L-BFGS-B. Thus, the proposition is a structural justification of the pipeline, while the computed iterate should be interpreted as an approximate KKT point affected by finite-difference and non-smoothness residuals.

4.4. Integer Enumeration over Architectures

The integer pair ( h 1 , h 2 ) ∈ H is handled by an outer enumeration: for every ( h 1 , h 2 ) ∈ H , the continuous relaxation NLP − INT c ( h 1 , h 2 ) is solved by Algorithm 1 and the best value is reported. Since H is finite, the enumeration is exhaustive and finite-time. In the numerical study below we set H = H exp = { ( 48 , 24 ) } , so the enumeration contains one architecture and the reported empirical effect comes from the continuous L-BFGS-B level. This conservative choice avoids claiming architecture-search results that were not generated, while preserving the mixed-integer formulation and the exact algorithm needed for larger finite architectural sets.
The inner cost of evaluating f ( p ; h 1 , h 2 ) is one Adam recursion of length N pre , which is O ( N pre · m · n ( h 1 , h 2 ) ) floating-point operations. The total cost of Algorithm 1 is therefore O | H | · K LBFGSB · N pre · m · max ( h 1 , h 2 ) ∈ H n ( h 1 , h 2 ) , where K LBFGSB is the number of inner evaluations of f that L-BFGS-B performs.

5. Experimental Results

5.1. Experimental Setup

We instantiate Algorithm 1 on the five synthetic two-dimensional balanced binary classification datasets shown in Figure 3: Spiral, Moons, Circles, XOR and Gaussians. Each dataset contains m = 400 samples, is standardized component-wise, and is generated with a fixed random seed for reproducibility. The reported experiments use the fixed architectural admissible set H exp = { ( 48 , 24 ) } , so both the baseline and optimized networks have the same structural parameter count n ( 48 , 24 ) = 1345 . We set γ = 2 × 10 − 3 in (9), N pre = 200 for the inner Adam pre-training, a full training horizon of 1200 epochs with early stopping patience 80, and use the ReLU activation. All computations were carried out with the script accompanying this paper [9].
Figure 3. Five synthetic two-dimensional balanced binary classification benchmarks used in the experiments; each dataset contains 400 standardized points. Blue and red points represent the two binary classes.
For each dataset we compare two trained networks:
  • The baseline, trained at the canonical unstructured hyperparameters ( λ base , α base ) = ( 10 − 4 , 3 × 10 − 3 ) on the fixed architecture ( 48 , 24 ) ;
  • The optimized network, trained at the pair ( λ ★ , α ★ ) returned by Algorithm 1 for the same fixed architecture ( 48 , 24 ) .
Both networks share the architecture, seed, training horizon and early stopping policy; they differ only in the continuous hyperparameters ( λ , α ) .

5.1.1. Determinism of the Training Pipeline

The entire pipeline is fully deterministic. Gradients are evaluated in full-batch mode over all m = 400 samples, with no mini-batch sampling, no inter-epoch data shuffling, and no stochastic augmentation; the Adam recursion (11) is a deterministic map; the Xavier initialization and the dataset generator are each driven by a fixed random seed; and all computations are carried out on CPU in double precision with NumPy/SciPy [11], without nondeterministic GPU kernels. Consequently, for a fixed ( λ , α ) and architecture, the trained weights W N are reproduced bit-for-bit across independent executions, so every quantity in Table 1 is an exact value rather than a sample mean. We verified this explicitly: repeating each run yielded differences of exactly 0 (machine-zero) in both classification accuracy and Frobenius norm, so reporting the mean and standard deviation over independent runs would give a degenerate zero standard deviation. Run-to-run variability therefore does not affect the single-point values reported in Table 1.
Table 1. Quantitative comparison of the baseline network and the network trained at the L-BFGS-B-optimized hyperparameters across the five synthetic benchmarks. Architecture ( h 1 , h 2 ) = ( 48 , 24 ) , parameter count n = 1345 , γ = 2 × 10 − 3 , and inner Adam steps for L-BFGS-B evaluation N pre = 200 .

5.1.2. Choice of the Baseline Hyperparameters

The pair ( λ base , α base ) = ( 10 − 4 , 3 × 10 − 3 ) is a conventional default operating point rather than a value tuned in our favor. The learning rate is of the order of the canonical Adam default α = 10 − 3 [8], and λ = 10 − 4 is a standard weak L2 regularization strength for feed-forward classifiers [1,2]. To confirm that this point is representative rather than a deliberately weak reference, we evaluated a coarse 4 × 4 grid of ( λ , α ) values around it on the Spiral dataset under the identical training protocol: the baseline attains 98.0 % and lies inside a broad high-accuracy plateau (accuracy ≥ 96 % for all λ ≤ 10 − 3 and α ∈ [ 3 × 10 − 3 , 3 × 10 − 2 ] ). The reductions in Table 1 therefore cannot be attributed to an artificially poor baseline, since the comparison point is itself accuracy-competitive.

5.2. Quantitative Results: Accuracy and Weight Norm

The principal quantitative results are collected in Table 1. The optimized network achieves a Frobenius weight norm ∥ W ★ ∥ F that is between 6.4 % and 43.7 % smaller than that of the unstructured baseline. Because the architecture is fixed at ( 48 , 24 ) in both conditions, this reduction should be interpreted as compact-weight training rather than as a reduction in structural memory footprint. The classification accuracy is preserved exactly on Moons and Circles, remains within 0.3 percentage points on Gaussians, drops by 1.0 percentage point on XOR, and degrades by 4.0 percentage points on the harder Spiral dataset. These results jointly confirm the intuition behind the formulation: the L-BFGS-B level systematically discovers a regularization–learning rate pair that compresses the weight vector at a moderate or null accuracy cost.
A complementary view of the same results is given in Figure 4: the absolute Frobenius norm of the weight vector drops for every dataset, with the largest gains on the well-separated Moons and Circles (43– 44 % reduction) and the smallest on the already-easy Gaussians ( 6 % , on which the baseline norm is already moderate).
Figure 4. Frobenius weight norm before and after L-BFGS-B-based hyperparameter optimization. Annotations report relative reduction.

5.3. Scope of the Integer Level in the Present Experiments

The formulation in (10) and Algorithm 1 are mixed-integer because ( h 1 , h 2 ) may be selected from any finite architectural admissible set H . The numerical study in this proceeding paper deliberately uses the singleton set H exp = { ( 48 , 24 ) } , so the empirical results in Table 1 validate the continuous L-BFGS-B level rather than a full multi-architecture search. This distinction is important: the reduction reported in Table 1 is a reduction in the Frobenius norm of the trained weights, not a reduction in the number of stored parameters. A genuine structural memory comparison would require running Algorithm 1 on a larger set such as { ( 16 , 8 ) , ( 24 , 12 ) , ( 32 , 16 ) , ( 48 , 24 ) , ( 64 , 32 ) } and reporting the selected architecture and parameter count for each dataset; this is retained as a direct extension of the present framework.

5.4. Convergence of the Upper-Level Optimizer

Figure 5 shows the cumulative best-so-far value min j ≤ k f ( λ j , α j ) of the L-BFGS-B iteration on each dataset. The Moons and Circles benchmarks exhibit fast monotone descent reaching a numerical plateau within the first ∼20 evaluations; the Spiral, XOR and Gaussians benchmarks reach the plateau more slowly, with the descent profile reflecting the geometry of f on each dataset (cf. Figure 6). The number of inner evaluations K LBFGSB ranges from 93 (XOR) to 309 (Circles), well within the maximum budget of 40 outer iterations.
Figure 5. Cumulative best-so-far value of the upper-level L-BFGS-B optimizer. Each function evaluation costs one Adam recursion of length N pre = 200 .
Figure 6. Upper-level objective surface f ( λ , α ) on Spiral at ( h 1 , h 2 ) = ( 48 , 24 ) . (Left) 3D view with L-BFGS-B path and optimum. (Right) Level sets and projected path; the small- λ basin contrasts with the sharp near-zero weight ridge close to λ max .

5.5. Three-Dimensional Structure of the Upper-Level Objective

To understand the geometric reason for the success of the L-BFGS-B step, we evaluate f ( λ , α ) on a regular 18 × 18 logarithmic grid over B for the Spiral dataset at the fixed architecture ( h 1 , h 2 ) = ( 48 , 24 ) , with log 10 λ ranging over [ − 6 , − 1 ] and log 10 α over [ − 4 , log 10 ( 0.05 ) ] . Each grid point costs one Adam recursion of length N pre . Figure 6 renders the resulting surface and level sets with the L-BFGS-B path. The surface exhibits: a smooth small- λ basin ( log 10 λ ≲ − 3 ) where L-BFGS-B settles; a steep near-zero weight ridge close to λ max , where the classifier approaches chance performance ( BCE → − log 0.5 ≈ 0.693 ) and the objective is driven mainly by the compactness term; and a descent path that remains in the useful basin instead of entering the trivial ridge. Thus, the upper bound λ max = 10 − 1 is not cosmetic: it prevents the search from being dominated by excessively regularized near-zero weight solutions.
The shape of f in Figure 6 explains a structural calibration choice that motivated the bounds in (10c) and (10d): the lower bound λ min = 10 − 6 prevents the formulation from degenerating into the unregularized case where ∥ θ ( W ) ∥ 2 → ∞ becomes admissible, and the upper bound λ max = 10 − 1 keeps this near-zero-weight ridge from expanding into increasingly over-regularized regimes. Similarly, α ∈ [ 10 − 4 , 5 × 10 − 2 ] excludes both pathologically slow inner trajectories ( α → 0 ) and Adam-divergent regimes ( α too large). Together, the four box constraints define a compact closed convex region in which Algorithm 1 is well-posed; under the lower-semicontinuity hypothesis of Theorem 2, an optimum is attained inside this region.

5.6. Decision-Boundary Inspection

A qualitative confirmation that the weight-norm reduction does not destroy the classification structure is provided in Figure 7, which plots the decision boundary of both networks on the Spiral dataset. Both classifiers separate the two intertwined arms of the spiral correctly on most of the support of the data; the L-BFGS-B-tuned classifier produces a slightly smoother boundary, consistent with a smaller weight norm and the standard intuition that stronger L2 regularization yields more regular decision frontiers [2].
Figure 7. Decision boundary of the baseline (left) and L-BFGS-B-tuned (right) network on Spiral; the contour y ^ = 0.5 separates the classes.

5.7. Sensitivity to the Compactness Weight γ

The argument above relies on γ being small enough that classification, rather than compactness, dominates the upper-level objective (9). To make this dependence explicit and quantitative, we sweep γ over more than two decades and, for each value, locate the global minimizer of f ( λ , α ) on the same 18 × 18 logarithmic grid over B used in Figure 6 (Spiral, ( h 1 , h 2 ) = ( 48 , 24 ) , N pre = 200 ). Reading the minimizer off the grid isolates the effect of γ on the objective landscape itself, independently of the local behavior of the finite-difference L-BFGS-B iteration. Table 2 reports the minimizing pair ( λ ★ , α ★ ) together with the binary cross-entropy and the classification accuracy attained there.
Table 2. Sensitivity of the upper-level objective to the compactness weight γ (Spiral, architecture ( 48 , 24 ) , N pre = 200 ). For each γ , the row reports the global minimizer ( λ ★ , α ★ ) of f over the 18 × 18 logarithmic grid of Figure 6, with the BCE and classification accuracy attained at that minimizer. Only γ = 2 × 10 − 3 keeps the minimizer inside the useful small- λ basin.
The trend is sharp. At γ = 2 × 10 − 3 , the global minimizer remains inside the small- λ basin ( λ ★ ≈ 1.7 × 10 − 3 ) and yields a usable classifier ( 95.2 % accuracy, BCE = 0.308 ). For every larger value the minimizer migrates onto the near-zero weight ridge: λ ★ climbs to, and then saturates at, λ max = 10 − 1 ; the accuracy collapses to chance ( 50.0 % ); and the BCE locks at − log 0.5 ≈ 0.693 , exactly the chance reference identified in the surface analysis of Figure 6. Beyond this threshold, the compactness term dominates and the formulation degenerates into the trivial near-zero weight solution. The chosen value γ = 2 × 10 − 3 is thus the stable operating point used throughout Table 1: it is the largest tested weight that still leaves the objective minimizer in the operationally meaningful region.

5.8. Discussion

The norm reductions in Table 1 are larger than 25 % on four out of five datasets, beyond the few-percent variability observed for fixed hyperparameters, and the same pattern is visible in Figure 4. The largest accuracy degradation (4 percentage points) occurs on Spiral, the hardest dataset; the optimized network reaches 94 % with a much smaller norm, and a longer inner training horizon could reduce this gap at greater computational cost. Finally, the bounds in (10c) and (10d) are essential: as quantified in the γ -sensitivity analysis of Section 5.7 (Table 2), increasing γ beyond 2 × 10 − 3 drives the upper-level minimizer to λ ★ = λ max and collapses accuracy to chance, confirming that a small γ together with a finite upper regularization bound is necessary for a usable formulation [3,4].

6. Conclusions

We presented a nonlinear programming framework with integer-parameterized architectures for compact-weight training of a two-hidden-layer feed-forward classifier. The upper level minimizes a weight norm-augmented BCE over a compact box of ( λ , α ) values, the lower level returns the deterministic Adam output W N ( λ , α ) , and finite architectural sets can be handled by outer enumeration. Theorem 1 proves lower-level coercivity and attainment under full-parameter L2 regularization; Theorem 2 gives upper-level attainment under lower semi-continuity; and Proposition 1 states conditional KKT accumulation for projected L-BFGS-B with finite differences, with the implementation gap made explicit in Remark 6. On five synthetic datasets and the fixed architecture ( 48 , 24 ) , the method reduces the Frobenius weight norm by 6.4–43.7%, with no accuracy loss on two datasets and at most a 4 percentage-point loss on Spiral.
The surface analysis in Figure 6 shows why the upper bound λ max is structurally important: it limits the influence of the trivial near-zero weight ridge and keeps the search inside a compact, operationally meaningful region. Future work should activate the integer level on larger architectural sets, replace finite differences with analytic or implicit gradients of the Adam recursion, and extend the formulation to multi-class classification through softmax and categorical cross-entropy.

Author Contributions

Conceptualization, K.L.O.C.; methodology, K.L.O.C.; formal analysis, Y.F.F.; investigation, K.L.O.C.; software, Y.F.F.; writing—original draft preparation, K.L.O.C.; writing—review and editing, K.L.O.C. and Y.F.F. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

All five datasets are synthetic and fully described in Section 5; their generation code, together with the implementation of Algorithm 1 and the scripts used to produce all the figures and Table 1, is publicly available [9].

Acknowledgments

The authors acknowledge the academic context of the Universidad Politécnica Estatal del Carchi (UPEC) that supported the elaboration of this article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Goodfellow, I.; Bengio, Y.; Courville, A. Deep Learning; MIT Press: Cambridge, MA, USA, 2016. [Google Scholar]
  2. Bishop, C.M. Pattern Recognition and Machine Learning; Springer: New York, NY, USA, 2006. [Google Scholar]
  3. Snoek, J.; Larochelle, H.; Adams, R.P. Practical Bayesian optimization of machine learning algorithms. Adv. Neural Inf. Process. Syst. 2012, 25, 2951–2959. [Google Scholar]
  4. Bergstra, J.; Bengio, Y. Random search for hyper-parameter optimization. J. Mach. Learn. Res. 2012, 13, 281–305. [Google Scholar]
  5. Byrd, R.H.; Lu, P.; Nocedal, J.; Zhu, C. A limited memory algorithm for bound constrained optimization. SIAM J. Sci. Comput. 1995, 16, 1190–1208. [Google Scholar] [CrossRef] [Scilit]
  6. Zhu, C.; Byrd, R.H.; Lu, P.; Nocedal, J. Algorithm 778: L-BFGS-B: Fortran subroutines for large-scale bound-constrained optimization. ACM Trans. Math. Softw. 1997, 23, 550–560. [Google Scholar]
  7. Nocedal, J.; Wright, S.J. Numerical Optimization, 2nd ed.; Springer: New York, NY, USA, 2006. [Google Scholar]
  8. Kingma, D.P.; Ba, J. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), San Diego, CA, USA, 7–9 May 2015. [Google Scholar]
  9. Ortega-Chávez, K.L.; Fernández-Fernández, Y. Entrenamiento Eficiente en Memoria de Redes Neuronales Mediante Programación No Lineal, v1.0.0; Zenodo: Geneva, Switzerland, 2026. [CrossRef]
  10. Bertsekas, D.P. Nonlinear Programming, 2nd ed.; Athena Scientific: Belmont, MA, USA, 1999. [Google Scholar]
  11. Virtanen, P.; Gommers, R.; Oliphant, T.E.; Haberland, M.; Reddy, T.; Cournapeau, D.; Burovski, E.; Peterson, P.; Weckesser, W.; Bright, J.; et al. SciPy 1.0: Fundamental algorithms for scientific computing in Python. Nat. Methods 2020, 17, 261–272. [Google Scholar] [CrossRef] [Scilit] [PubMed]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.