================================================================================
      Sorami Architecture vs. Two Papers / the fluxflow Project:
                     A Comparative Report  (Collaborator Review Draft)
================================================================================
Subject under review : the "Sorami" adaptive-activation architecture in
                       WineSoramiV5TransformerSearch.py
Objects of comparison: (A) Paper 1811.08618v1 "Neural Networks with Activation Networks"
                       (B) Paper 2305.13508v1 "DeepBern-Nets" (Bernstein polynomial
                           activations)
                       (C) the Bezier activation architecture of the fluxflow project
                           (fluxflow-core 0.8.1)
Document type        : a technical comparison prepared for a collaborating researcher
                       (aims to be objective and discussion-friendly)
Intended readers     : collaborating researcher / technical reviewer
Language             : English (translated from the Chinese original)
Note                 : Concepts that may be unfamiliar (especially Transformer terms) are
                       explained in place, marked with "【Concept】", largely by analogy,
                       so that readers of different backgrounds can follow.

--------------------------------------------------------------------------------
Table of Contents
--------------------------------------------------------------------------------
Ch. 0  Preparation: a quick tour of core concepts
Ch. 1  Layer-by-layer dissection of the Sorami architecture
Ch. 2  Paper A: 1811.08618 "Activation Networks"
Ch. 3  Paper B: 2305.13508 "DeepBern-Nets (Bernstein polynomial activations)"
Ch. 4  The Bezier activation architecture of the fluxflow project
Ch. 5  What the four share: common ground at the conceptual level
Ch. 6  How the four differ: contrasts at the architectural level
Ch. 7  Comprehensive comparison table (at a glance)
Ch. 8  Positioning and objective assessment of Sorami
Ch. 9  Glossary
================================================================================

================================================================================
Ch. 0  Preparation: a quick tour of core concepts
================================================================================

Several terms related to "adaptive activations" and polynomials recur throughout this
report. Readers unfamiliar with them may wish to read this chapter first.

--------------------------------------------------------------------------------
0.3  What is a "Hypernetwork"?
--------------------------------------------------------------------------------
The parameters of an ordinary network are constants obtained by training. A "hypernetwork"
instead uses a small network to dynamically "generate," from the input, the parameters of
another network (its weights, or the shape of its activation).
In one sentence: the parameters are no longer dead; they are "computed on the fly from the
input." In all four architectures here, any scheme that "uses an auxiliary network to
generate activation parameters" is, in essence, an instance of this hypernetwork idea.
This is a key thread running through the whole report.

--------------------------------------------------------------------------------
0.4  What are Bezier curves / Bernstein polynomials?
--------------------------------------------------------------------------------
This is one of the technical cores of the report.

【Concept: Polynomials】
A function of the form c0 + c1·x + c2·x^2 + c3·x^3 is a polynomial. The highest power is
called the "degree."
- A degree-1 polynomial is a line; degree 3 can bend into an S shape; the higher the
  degree, the more it "can bend."
- Writing a polynomial in the "power basis" (1, x, x^2, ...) tends to be numerically
  unstable at high degree.

【Concept: Bernstein basis / Bezier curve】
A Bernstein polynomial is just another way to write a polynomial. The standard cubic Bezier
formula is
    B(t) = (1-t)^3·p0 + 3(1-t)^2·t·p1 + 3(1-t)·t^2·p2 + t^3·p3,   t in [0,1]
where p0,p1,p2,p3 are the "control points" and t is the interpolation parameter from 0 to 1.
The multipliers (1-t)^3, 3(1-t)^2 t, 3(1-t) t^2, t^3 are the "Bernstein basis functions";
they sum to exactly 1 (the "partition of unity"). In general, the basis functions of a
degree-n Bernstein polynomial are
    b_{n,k}(x) = C(n,k) · x^k · (1-x)^(n-k),   k = 0..n   (C(n,k) is the binomial coefficient)
A Bezier curve and a "polynomial in Bernstein form" are two names for the same thing:
control points = Bernstein coefficients.

【Concept: the geometry of control points】
Think of t as "how far the pen has traveled from the start to the end of the curve." The
control points act like magnets: the curve is pulled by p0..p3 but generally does not pass
through them (except the endpoints). Moving the control points shapes the curve arbitrarily.
- Four collinear control points -> a straight line;
- Arranged in an S shape -> a sigmoid / GELU-like S-curve;
- Any placement -> any smooth curve.
This "shapeability" is exactly what makes Bezier a natural candidate for a learnable
activation function.

【Concept: why Bernstein rather than the power basis x^k?】
The key is numerical stability. Paper 2305 proves that the gradient of a Bernstein activation
is bounded only by the magnitude of its coefficients (|dSigma/dx| <= 2n · max|c_k|); it does
not explode for |x|>1 the way a high-degree power-basis polynomial does. This "well-behaved"
property is the deeper reason the Bezier/Bernstein family keeps being chosen.

--------------------------------------------------------------------------------
0.5  What is a KAN (Kolmogorov-Arnold Network)?
--------------------------------------------------------------------------------
In 2024, Liu et al. proposed KAN, which inverts the traditional setup ("learnable weights,
fixed activations"): it makes the activation function learnable (via B-splines) while keeping
the connections between neurons simpler. KAN is the emblem of the recent "learnable
activation" wave, and the fluxflow project explicitly credits it as inspiration.
Understanding KAN helps one appreciate the shared backdrop of all four architectures.

--------------------------------------------------------------------------------
0.6  What are adversarial-robustness certification and interval bound propagation (IBP)?
--------------------------------------------------------------------------------
(Needed only for Ch. 3; may be skipped.)
"Certification" means proving mathematically that "no matter how the input is perturbed
within some range, the network's output satisfies a certain property" (e.g., however small
an adversarial noise is added to an image, the classification does not change).
"Interval Bound Propagation (IBP)" is an efficient method to propagate "output lower/upper
bounds" layer by layer: the input interval [l,u] is pushed through every layer to obtain an
output interval.
Paper 2305's entire motivation is to make the activation function itself "easy to bound,"
thereby making certification easier. This is entirely different from Sorami's goal
(improving regression accuracy); it is a case of "the same tool, used differently."

================================================================================
Ch. 1  Layer-by-layer dissection of the Sorami architecture
================================================================================

Source: WineSoramiV5TransformerSearch.py (1301 lines). We proceed "from whole to parts."

--------------------------------------------------------------------------------
1.1  Task and data-flow overview
--------------------------------------------------------------------------------
Task: predict wine quality (a regression problem). Input: 11 physicochemical features
(red and white wines merged; 5,318 rows after de-duplication). Output: 1 quality score
(MSE loss).
Data flow:
    11 scalar features
      -> reshaped into a sequence (N, 11, 1)   [X_train_seq]
      -> input_proj: Linear(1 -> 64)          [lift to d_model = 64]
      -> embedding_dropout
      -> TransformerEncoder: 3 layers          [each = attention + FFN, both with
                                                residual / LayerNorm]
      -> Mean Pooling                          [average 11 tokens into one 64-d vector]
      -> regression_head = SoramiFFN           [* the adaptive Bezier activation is here *]
      -> 1-d output

  Sorami overall architecture (WineSoramiV5TransformerSearch.py)
  -------------------------------------------------------------
  Input: 11 physicochemical features of one wine (11-d scalar)
    |
    +-> [reshape to sequence]  shape (N, 11, 1)      # 11 tokens, each 1-d
    |
    +-> input_proj: Linear(1 -> 64)                  # each token lifted to 64-d (d_model)
    |
    +-> TransformerEncoder (3 layers; each layer:)
    |       (Pre-Norm + residual)
    |        x -- LayerNorm --> Multi-Head Self-Attention (RoPE, 4 heads) --(+residual)--+
    |        |<------------------------------------------------------------------------+
    |        x -- LayerNorm --> FFN(Linear -> GELU -> Linear) -------------(+residual)--+
    |        |<------------------------------------------------------------------------+
    |        # NOTE: this FFN uses a "hard-coded GELU" (fixed activation)
    |
    +-> Mean Pooling: average 11 tokens -> one 64-d vector
    |
    +-> regression_head = SoramiFFN       ** the adaptive Bezier activation lives here **
    |
    +-> Output: 1 quality score

【Emphasis】There are two FFNs in the script:
  (a) TransformerEncoderLayer.ffn -- an ordinary FFN whose activation is the hard-coded
      nn.GELU() (a fixed activation).
  (b) regression_head = SoramiFFN -- this is the core of "Sorami": it replaces the activation
      with an adaptive Bezier curve. In other words, the project concentrates the "adaptive
      activation" in the regression head rather than using it everywhere in every layer.

--------------------------------------------------------------------------------
1.2  Part one: BezierActivation (the adaptive Bezier activation)
--------------------------------------------------------------------------------
This is the core part of Sorami. Key points follow.

(1) A base curve "anchored to GELU"
    - Fixed domain: domain_min = -5, domain_max = 5.
    - By default, 9 control points are given (i.e., a degree-8 Bernstein polynomial):
        (-5.0000, -0.0000014)   <- endpoint; y pinned to GELU(-5)
        (-1.3993, -0.0151)
        (-1.2368,  0.1352)
        (-0.6927, -0.4485)
        ( 0.3498, -1.1249)
        ( 0.8911,  1.1653)
        ( 1.4009,  1.3751)
        ( 2.4172,  2.4176)
        ( 5.0000,  4.9999986)   <- endpoint; y pinned to GELU(5)
      These 9 points come from "fitting the GELU function with a degree-8 Bezier curve."
      In other words, Sorami's base activation shape is approximately GELU. This is crucial:
      it is a design "anchored to the classical baseline."
    - The y-values of the two endpoints are forced to equal GELU at +/-5 (y_start / y_end),
      so the curve's endpoints coincide exactly with GELU.
    - Outside the domain (x < -5 or x > 5): it falls back directly to GELU(x).

(2) Parametric Bezier + Newton inversion x -> t (a key V5 fix)
    - A Bezier curve is naturally "parametric": both x(t) and y(t) are determined by t. But an
      activation must be a genuine function: a given x must yield a unique y. Hence one must
      first invert x to obtain t, then compute y from t.
    - The script solves for t such that x(t) = x, via a parametric Newton iteration
      (_solve_t, 15 steps):
        f  = x(t) - x
        t <- t - clamp(f / x'(t), -0.1, 0.1)
      Newton's iteration is differentiable, so gradients flow back normally.
    - 【Concept: Newton's iteration】To find a root of f(t)=0, approximate with the tangent:
      t_new = t - f(t)/f'(t); a few repetitions converge. Here f(t) = x(t) - x.
    - This is one of the V5 fixes relative to V4 ("the Bezier x->t must be inverted
      parametrically with Newton").

(3) The adaptation mechanism: y_biases (Sec. 1.3) and the temperature bias_scale
    - forward(x, y_biases=None): if y_biases is passed, an additive bias is added to the
      y-value of each "middle control point" (indices 1..7). The shape of y_biases is
      (..., d_hidden, num_middle_points = 7).
    - The endpoints (0 and 8) receive no bias, so the two ends of the curve remain exactly
      GELU. Only the "middle section" is bent.
    - Sorami therefore adapts by "locally deforming the GELU curve," not by redrawing a curve
      from scratch.

--------------------------------------------------------------------------------
1.3  Part two: SoramiFFN (a small hypernetwork + Bezier activation + linear projection)
--------------------------------------------------------------------------------
Structure (in forward order):
    hidden = linear1(x)                       # (B, S, d_hidden), first a linear transform
    y_biases_flat = bias_mlp(x)               # * a small MLP generates activation biases from x
    y_biases = reshape to (B, S, d_hidden, 7)
    y_biases = y_biases * bias_scale          # * multiply by the temperature parameter
    hidden = bezier_activation(hidden, y_biases)
    hidden = dropout(hidden)
    output = linear2(hidden)                  # (B, S, d_out)

Here bias_mlp is a 2-layer MLP:
    Linear(d_in -> mlp_hidden) -> GELU -> Dropout -> Linear(mlp_hidden -> d_hidden*7)
It reads the FFN input x and outputs an "additive bias for each neuron and each middle
control point." This is the hypernetwork idea: network B generates the activation parameters
used inside network A.

  SoramiFFN internals (input x, shape (B, S, d_in))
  -------------------------------------------------
  x --+--> linear1: Linear(d_in -> d_hidden) -------------------------> hidden
      |
      +--> bias_mlp (small MLP, i.e. the "activation network"):
              Linear(d_in -> mlp_hidden) -> GELU -> Dropout
              -> Linear(mlp_hidden -> d_hidden x 7)
              produces y_biases (7 control-point biases per neuron)
                    |
                    x bias_scale (temperature scalar, init 0)
                    v
      hidden ----> BezierActivation(hidden, y_biases)
                    # fixed GELU skeleton + additive bias on the middle control points
                    |
                    v
              dropout -> linear2: Linear(d_hidden -> d_out) -> output


【Concept: this bias_mlp is exactly what Paper A calls an "activation network"】
It does not produce the main output; it only "decides what the activation function looks
like." This is precisely the naming source of 1811.08618 and the biggest conceptual link
between Sorami and that paper (see Ch. 2 and Ch. 5).

Three key initializations (the essence of the V4 design):
    - linear1 / linear2: Kaiming normal init (a robust, standard choice).
    - bias_mlp: both layer weights std = 1e-2, biases zeroed -> initial output ~ 0.
    - bias_scale = nn.Parameter(torch.zeros(1)) -> initial value 0.
    => After multiplication the initial bias = 0 => initially BezierActivation degenerates to
       pure GELU.
    This is called a "soft start": the model begins exactly equal to the FixedGELU baseline,
    and bias_scale only grows away from 0 once training shows that "deviating from GELU
    helps."
【Significance】This guarantees, at the root, "fair comparison": Sorami and FixedGELU start
    from an identical point, so any improvement is genuinely learned rather than a lucky
    initialization. This is a distinctive design well worth including in a paper.

--------------------------------------------------------------------------------
1.4  Part three: TransformerModel (assembling the parts)
--------------------------------------------------------------------------------
    input_proj: Linear(input_dim=1, d_model=64)
    encoder: TransformerEncoder(d_model=64, n_heads=4, d_ff=256, n_layers=3)
             each layer = MultiheadAttentionWithRoPE + ordinary GELU FFN (fixed activation)
    regression_head: SoramiFFN(d_model=64, regress_hidden, d_out=1)  <- adaptive activation here
    pooling: mean

Note: the attention uses RoPE positional encoding, Pre-Norm, and dropout; these are "the
same backbone as fluxflow's Transformer block, differing only in the activation." The
difference is that fluxflow places Bezier in every block's MLP, whereas Sorami places it only
in the regression head.

--------------------------------------------------------------------------------
1.5  Part four: training and hyperparameter search (engineering, not the architectural core)
--------------------------------------------------------------------------------
- Optimizer AdamW; per-group learning rates: encoder / regression / encoder_mlp / regress_mlp
  each have their own lr and weight_decay (bias_mlp and bias_scale are placed in the
  regress_mlp group -- this is the third V5-fixed bug: "bias_scale belongs to the regress_mlp
  parameter group").
- LR schedule: linear warmup + cosine annealing.
- Early stopping: early_stop = False during search (runs the full epochs) to keep trials fair.
- Hyperparameter search: Optuna + TPE sampler, N_TRIALS = 256; the objective is "minimum mean
  validation MSE"; the test set is evaluated only after the hyperparameters are frozen
  (strict validation-only selection).
- Reproducibility: fixed SPLIT_SEED / SEARCH_SEED; final-evaluation seeds are read from
  RandomSeeds.txt; torch.use_deterministic_algorithms(True); data fingerprints, split
  manifest, scaler record, and checkpoint sha256 are all written to disk and verified.

【Concept: TPE (Tree-structured Parzen Estimator)】
A common Bayesian-optimization sampler in Optuna: based on "the hyperparameter combinations
already tried and their performance," it builds a probabilistic model and guesses "the next
combination most likely to be better." It saves compute relative to grid or random search.
【Concept: why split into train / validation / test sets】
The training set learns parameters; the validation set selects hyperparameters and guards
against overfitting; the test set is used only once, at the end, to represent true
generalization. This project strictly observes "hyperparameter search never sees the test
set," which is essential to research integrity.

================================================================================
Ch. 2  Paper A: 1811.08618 "Neural Networks with Activation Networks"
================================================================================
Title  : Neural Networks with Activation Networks
Authors: Jinhyeok Jang, Jaehong Kim, Jaeyeon Lee, Seungjoon Yang (ETRI / UNIST)
Date   : November 2018

--------------------------------------------------------------------------------
2.1  Core idea (conceptual level)
--------------------------------------------------------------------------------
In one sentence: "Every pixel, every node, and every layer gets its own polynomial
activation function, and the coefficients of this polynomial are generated dynamically by an
auxiliary 'activation network' based on the features themselves."

Its "imagined opponent" is: a single fixed activation function shared by the whole network
(ReLU, etc.). The authors observed that in biological neural systems, a feature's activation
is influenced by "neighboring features" (lateral inhibition, attention), and therefore wanted
the network to "learn from data how features influence each other's activations."

--------------------------------------------------------------------------------
2.2  Mathematical form and a detailed look at the "power basis" (architectural level)
--------------------------------------------------------------------------------
The conclusion up front: Paper A uses a "polynomial" as the activation. Which "basis" this
polynomial is written in determines its behavior. Paper A uses the "power basis." Below we
first make clear what the power basis is, then how the coefficients are generated and how
they act.

========================================
(1) What is a "basis"? What is the "power basis"?
========================================
【Concept: basis】In mathematics, if a set of basic functions can, through "weighted
summation," reproduce a target function, that set is called a "basis." For example, the four
items {1, u, u^2, u^3}: given any four coefficients (a0,a1,a2,a3), one can form
    a0·1 + a1·u + a2·u^2 + a3·u^3
which is a degree-3 polynomial. The set {1, u, u^2, u^3, ...} is called the "power basis"
because its members are exactly the powers of u.

It can therefore be stated explicitly: the "basis" of the activation in Paper A is exactly
the powers of u, u^k (k = 0..K).
- The term u^0 = 1 is the constant term (providing a vertical shift);
- The term u^1 = u is the linear term (providing the slope);
- The term u^2 and above provide the "bending";
- The highest power k = K determines how sharply it can bend (Paper A takes K = 5).

As a formula, any degree-K polynomial can be written
    P(u) = Sum_{k=0}^{K} a_k · u^k
where a_k is "the k-th order coefficient." Using this polynomial as an activation is simply
    x_out = P(u) = Sum_{k=0}^{K} a_k · u^k.

For contrast (helpful for understanding the difference from Bezier later):
- Power basis  : basis functions are u^k        (1, u, u^2, u^3, ...)          -- Paper A
- Bernstein    : basis functions are b_{n,k}(u) ((1-u)^n, n(1-u)^{n-1}u, ...) -- Bezier family
Both bases can represent the same polynomial, but their numerical properties differ (the
power basis tends to be unstable at high degree).

========================================
(2) How are the coefficients a_k "generated"? (This is the so-called "activation network")
========================================
The difficulty is here: a_k is not a trained constant; it is "computed on the fly for each
input and each node." How? With an auxiliary linear layer (which Paper A calls the
"activation network").

For node i of the l-th fully connected layer:
  1) First do the ordinary linear transform to get the "intermediate output" u_i, the i-th
     entry of the vector u of all nodes in this layer.
  2) The auxiliary network reads "the intermediate outputs u of all nodes in this layer"
     (length = number of nodes in the layer) and, for each order k, outputs a coefficient:
         a_{k,i} = Sum_j V_{k,j,i} · u_j + b_{k,i},   k = 0, 1, ..., K
     i.e., for each of the K+1 orders there is a weight set V_k and a bias b_k that linearly
     computes a_k from u.
     (The dimensions of V can be read as (K+1, #nodes, #nodes): one set per node and per order.)
  3) Substitute u_i into the polynomial using these coefficients to obtain the node's output.

【Key】a_k depends on u (this layer's features), so the "shape of the activation function"
varies with the input: the same node, faced with different samples, receives different
(a_0..a_K) and thus exhibits different activation curves. This is the source of the
"data-dependent / adaptive" behavior.

========================================
(2b) The actual form of the auxiliary network: a single linear layer, not a deep MLP
========================================
An easily misunderstood point: Paper A calls this an "activation network," but it is not a
multi-layer MLP -- it is merely a single linear map:
- Dense layer: a_{k,i} = Sum_j V_{k,j,i}·u_j + b_{k,i}. The input is this layer's
  intermediate output u (length n_l); the output is the coefficient for each node i and each
  order k. The weight V has shape (K+1) x n_l x n_l and the bias (K+1) x n_l. There is no
  hidden layer and no nonlinearity such as GELU/ReLU.
- Conv layer: a_{k,i} = conv(v_{k,i}, b_{k,i}, u_l) -- a single convolution.

  this layer's intermediate output u = (u_1 ... u_n)     <- length n
        |
        v
  one linear map: a_{k,i} = Sum_j V_{k,j,i} u_j + b_{k,i}
        |
        v
  K+1 coefficient sets (a_0 ... a_K)   (one set per node)
        |
        v
  x_i = Sum_k a_k (u_i)^k             <- polynomial activation with these coefficients

Difference from an MLP:
  Dimension      | Paper A's auxiliary network | A typical MLP
  ---------------+-----------------------------+---------------------------
  Depth          | 1 layer (purely linear)     | >= 2 layers
  Hidden layer   | none                        | yes
  Nonlinearity   | none                        | yes (GELU/ReLU/SiLU...)
  Essence        | one linear map V·u+b        | multi-layer linear + nonlinear
  Expressiveness | only linear functions       | universal approximation
- Structurally the difference is large: A's auxiliary network is the "simplest possible
  network," equivalent to a matrix; using an MLP would be far more expressive.
- In role they are not very different: both are "auxiliary networks / hypernetworks" that
  generate activation parameters from features; A's can be seen as the degenerate case of an
  MLP with depth 1 and identity nonlinearity.
- Important corollary: because A's auxiliary network is linear, the coefficients a_k are
  linear functions of u, so the final activation x = Sum_k a_k(u)·u^k is "a polynomial whose
  coefficients vary linearly with u." This keeps it simple and controllable and is also why
  its expressiveness is limited (contrast fluxflow's depth-3 pillar MLPs generating the
  control points).

How the four architectures' auxiliary networks compare (important):
  Implementation   | actual form of the auxiliary network
  -----------------+---------------------------------------------------
  1811 (A)         | single linear layer (one FC for dense, one conv), no nonlinearity
  Sorami           | 2-layer MLP: Linear -> GELU -> Linear (a genuine MLP)
  fluxflow pillar  | depth-3 MLP: Linear -> SiLU -> Linear -> SiLU -> Linear
  2305 (B)         | no auxiliary network (coefficients are ordinary learnable constants)

========================================
(3) How does it "act"? (A few intuitive special cases)
========================================
In the same formula x = Sum a_k u^k, merely changing the coefficient values (a_0..a_K) yields
completely different functions:
- (a0,a1,a2,...) = (0,1,0,...)   : gives x = u, i.e., identity (input unchanged);
- (a0,a1,a2,...) = (0,0,1,0,...) : gives x = u^2 (squaring);
- a0=0 with a small a1 and some a2..: gives a softened approximation of ReLU;
- a set to the Taylor coefficients of sigmoid/tanh (see (5)): gives an approximation of
  sigmoid/tanh.
So "one polynomial + variable coefficients" covers a large family of common activations --
exactly why the authors argue that "classical fixed activations are just special cases."

========================================
(4) Overall architecture diagrams for the dense / convolutional layers (Paper Fig. 1)
========================================
   (a) Fully connected (Dense) layer:

     previous layer output x^(l-1)
        |
        |  weights W^(l)
        v
     intermediate output u^(l) ---------+-----------------------+
        |                               |                       |
        |  fed to auxiliary             |  u_i substituted      |
        |  "activation network"         |  into the polynomial  |
        v                               v                       |
     a_k = Sum_j V_kj u_j + b_k     x_i = Sum_k a_k (u_i)^k    |
     (auxiliary linear layer,       (degree-K polynomial        |
      one coefficient per order k)   activation)                |
        +--------------------------->  output x^(l) <----------+

   (b) Convolutional (Conv) layer:

     part1: u_i(xi,zeta)     = conv(w_i, x^(l-1))     <- ordinary conv -> intermediate output
     part2: a_{k,i}(xi,zeta) = conv(v_{k,i}, u_l)     <- coefficients generated by convolving
                                                         over "neighboring pixels" feature maps
     part3: x_i(xi,zeta)     = Sum_k a_{k,i}(xi,zeta) · u_i(xi,zeta)^k  <- per-pixel polynomial

   Note: in the conv version the coefficients are contributed by "neighboring pixels," so
   adjacent pixels influence each other's activations -- the source of the authors'
   "feature interdependency" selling point (mirroring biological lateral inhibition).

========================================
(5) What does "approximating sigmoid with a polynomial" mean?
========================================
【Concept: Taylor expansion】Any smooth function can, near a point, be approximated as a sum
of powers. For sigmoid near 0:
    sigmoid(u) = 1/2 + u/4 - u^3/48 + u^5/480 - ...   (accurate only for modest |u|)
For tanh near 0:
    tanh(u) = u - u^3/3 + 2u^5/15 - 17u^7/315 + ...
Writing it in power-basis polynomial form (keeping the first few terms, dropping higher
ones) is "approximating sigmoid/tanh with a polynomial." In other words: fixing the
coefficients a_k to these constants makes the polynomial approximately equal to sigmoid
near 0.

Paper A uses this to make two points:
  (1) Classical activations (sigmoid/tanh) are themselves a (fixed-coefficient) polynomial,
      hence representable by "power-basis polynomial + fixed coefficients" -- so a classical
      network is the special case of the activation network with V = 0 and b = Taylor
      coefficients;
  (2) Conversely, letting the auxiliary network learn these coefficients allows "learning an
      activation better suited to the task than sigmoid."
  Note: the Taylor expansion is accurate only near 0 and diverges far from it. Paper A does
  not actually use a Taylor series as the activation; it only uses it to argue that "a
  polynomial suffices to uniformly express a variety of activations."

========================================
(6) Summary of key points
========================================
- Basis = the power basis u^k (k = 0..K, K = 5); the coefficients a_k are computed on the fly
  by an auxiliary "activation network" from this layer's features u.
- Action = x = Sum_k a_k u^k; changing the coefficients changes the activation shape, so the
  activation "varies with the input."
- "Approximating sigmoid with a polynomial" = taking the Taylor coefficients of sigmoid/tanh
  as fixed a_k, showing classical activations are special cases.
- The coefficients are "fully generated" (the entire polynomial is replaced each time),
  rather than "adding a bias to a fixed curve" as Sorami does.
- The auxiliary network and the main network are updated simultaneously with the same loss E
  (Eqs. 7-9 of the paper).

--------------------------------------------------------------------------------
2.3  Experiments and conclusions
--------------------------------------------------------------------------------
- LeNet + CIFAR-10 classification: LeNet-AN reaches 72.56%, beating the baseline LeNet
  (67.13%) and also deeper/wider LeNets, with only 121.5% of the baseline's parameters.
- U-Net + MNIST denoising: MSE 0.0133 vs. baseline 0.0144.
- VGG16 + CIFAR-10: VGG16-AN 83.60% vs. baseline 80.97% (120.5% of parameters).
- Interesting finding: with the activation network, even "shallow" layers extract high-level
  features (t-SNE shows better-separated classes).
- The authors' selling point: the activation network is a means to improve performance
  besides "adding nodes / layers."

================================================================================
Ch. 3  Paper B: 2305.13508 "DeepBern-Nets"
================================================================================
Title  : DeepBern-Nets: Taming the Complexity of Certifying Neural Networks using Bernstein
         Polynomial Activations and Precise Bound Propagation
Authors: Haitham Khedr, Yasser Shoukry (UC Irvine)
Date   : May 2023

--------------------------------------------------------------------------------
3.1  Core idea (conceptual level)
--------------------------------------------------------------------------------
In one sentence: "Replace ReLU with a Bernstein polynomial activation, making neural-network
certification both efficient and tight."

Its starting point is not "improving accuracy" but "certifiability." The authors call their
design philosophy Design-for-Certifiability: rather than struggling to certify a ReLU network
after the fact, choose from the outset an activation that is "easy to bound above and below."
This is, in effect, "the same tool, used differently" from Sorami's goal (improving
regression accuracy).

--------------------------------------------------------------------------------
3.2  Mathematical form (architectural level)
--------------------------------------------------------------------------------
  DeepBern-Net structure (feed-forward network, activation = Bernstein polynomial)
  ------------------------------------------------------------------------------
  input x
    |
    v
  [Linear layer]  y1 = W1 x + b1
    |
    v
  [Bernstein activation]  sigma(y1; l,u,c) = Sum_k c_k · b_{n,k}^{[l,u]}(y1)
    |                     c_k learnable, one set per neuron; n is the degree
    v
  [Linear layer]  y2 = W2 sigma1 + b2
    |
    v
  [Bernstein activation]  sigma(y2; l,u,c)
    |
    v
      ... (repeat for L layers) ...
    |
    v
   output
  Note: during training there is also a "bound-propagation" branch that pushes the input
  interval [l,u] through the layers, using Bernstein's enclosure property to obtain the
  lower/upper bounds of each layer's output (for certification).

(1) Bernstein polynomial activation (same family as Bezier):
        sigma(x; l, u, c) = Sum_{k=0}^{n} c_k · b_{n,k}^{[l,u]}(x),   x in [l,u]
        b_{n,k}^{[l,u]}(x) = C(n,k) (x-l)^k (u-x)^(n-k) / (u-l)^n
    where c = (c0..cn) are "per-neuron learnable Bernstein coefficients" and n is the degree
    (a hyperparameter).
    【Relation to Bezier】This is identical to the Bernstein basis of a Bezier curve; the
    control points are the Bernstein coefficients. The difference is that DeepBern treats the
    coefficients as "global learnable constants" (one set per neuron) and does not generate
    them in a data-dependent way, whereas the coefficients (control points) of Sorami and
    fluxflow vary with the input.

(2) The domain [l,u] and bound propagation:
    - A polynomial is meaningful only on the interval [l,u]. The authors make the input domain
      known (normalizable to [0,1]) and, during training, propagate the bounds [l^(k), u^(k)]
      layer by layer.
    - They use Bernstein's "Enclosure" property: the polynomial value must lie between the
      minimum and maximum of its coefficients (Property 1, a convex-hull property). Thus
      "computing an output bound" takes only O(n), even O(1).
    - The "Subdivision" property: splitting the interval into sub-intervals yields tighter
      bounds, used for local certification.
    - They propose the Bern-IBP algorithm (interval bound propagation), usable during training
      for "certified training."

(3) Gradient stability (directly connected to the core value of Bezier):
    Proposition 2.1: |dSigma/dx| <= 2n · max|c_k|, and |dSigma/dc_i| <= 1.
    The gradient depends only on the coefficient magnitudes; it does not explode as in a
    high-degree power-basis polynomial. This is the theoretical endorsement of the
    "well-behaved" nature of the Bernstein/Bezier family.

--------------------------------------------------------------------------------
3.3  Experiments and conclusions
--------------------------------------------------------------------------------
- Certifying adversarial robustness on MNIST / CIFAR-10; high certified accuracy even on
  million-parameter networks.
- Certified training with Bern-IBP reaches certified accuracy comparable to (sometimes
  exceeding) the strongest ReLU networks in the SOK benchmark.
- Contributions: a new activation (Bernstein) + a new certification algorithm (Bern-IBP) +
  empirical study.

【Implication for Sorami】Paper 2305 explains theoretically "why Bezier/Bernstein suits an
activation": not just flexible shaping, but numerical well-behavedness and controlled
gradients. Sorami's choice of Bezier (rather than a power-basis polynomial) is consistent
with this conclusion for stability -- though Sorami does not actively exploit the
"certification" downstream value.

================================================================================
Ch. 4  The Bezier activation architecture of the fluxflow project
================================================================================
Project: fluxflow-core 0.8.1 (PyPI package name fluxflow), text-to-image generation.
Architecture: a VAE (FluxCompressor encoder / FluxExpander decoder) + a diffusion Transformer
              (FluxFlowProcessor) + a DistilBERT text encoder + a PatchDiscriminator (during
              GAN training).
Core innovation: Bezier adaptive activation (explicitly inspired by KAN).

--------------------------------------------------------------------------------
4.1  fluxflow's three Bezier activations (the key to the whole report)
--------------------------------------------------------------------------------
  fluxflow overall architecture (text-to-image)
  ---------------------------------------------
  Training:
    image -> FluxCompressor (VAE enc) -> latent z0 -> add noise -> zt
    text  -> DistilBERT -> text embedding ---+
    zt + timestep t + text embedding -> FluxFlowProcessor (diffusion Transformer) -> predict v
  Generation:
    noise z1 + text -> FluxFlowProcessor (iterative denoising) -> z0 -> FluxExpander (VAE dec) -> image

Method 1: Input-Based BezierActivation (input-derived; 0 learnable parameters)
    - The previous layer outputs 5xC channels; the activation splits these 5 groups into
      [t, p0, p1, p2, p3].
    - It computes a cubic Bezier, outputting C channels (a 5 -> 1 reduction).
    - 0 activation parameters, but the previous layer needs 5x the output weights.
    - Used in the VAE's convolutional layers.
Method 2: TrainableBezier (4xD learnable parameters)
    - Each dimension learns 4 control points p0..p3 (global constants, not input-dependent).
    - t = sigmoid(x), then a cubic Bezier.
    - Used in the VAE latent bottleneck and the RGB output layer.
Method 3: Pillar-Based (4 MLPs generate the control points)  * closest to Sorami
    - 4 independent "pillar" MLPs (each depth 3, d_model x d_model) generate p0, p1, p2, p3.
    - Forward: g = sigmoid(img_seq) serves as the gated input; p_i = pillar_i(g ...); then
      [img_seq, p0, p1, p2, p3] is concatenated and fed to BezierActivation(), with t set to
      sigmoid(img_seq).
    - Very large parameter count: about 3xD^2 per pillar, ~198K per block for 4 pillars
      (D = 128).
    - Used only in the diffusion Transformer's MLP layers.
    - 【Concept: gate】A sigmoid squashes the feature into [0,1], acting as a switch/regulator.
    - Note: v0.8.0 upgrades this to "pillar-attention": each pillar is FiLM-modulated, and a
      cross-attention toward the text is performed on the pillar output before the FFN + Bezier.

  fluxflow's three Bezier activations, structurally compared
  ---------------------------------------------------------
  (1) Input-Based (0 params; previous layer outputs 5C channels):
      previous layer output: 5C channels
        |
        v
      [split into 5 groups]   t | p0 | p1 | p2 | p3
        +--------------+--------------+
                       v
      [cubic Bezier: B(t) = (1-t)^3 p0 + 3(1-t)^2 t·p1 + 3(1-t) t^2·p2 + t^3 p3]
                       |
                       v
                C-channel output (5 -> 1 reduction)

  (2) TrainableBezier (4xD learnable parameters):
      x -> [sigmoid] -> t
      p0,p1,p2,p3 (4 learnable constants per dimension)
        +------------+--------------+
                     v
             [cubic Bezier] -> output (same dimension)

  (3) Pillar-Based (4 MLPs generate control points; most like Sorami):
      img_seq (token features)
        |
        v
      g = sigmoid(img_seq)      <- gate
        +-> p0 = pillar0(g)     (depth-3 MLP)
        +-> p1 = pillar1(g)     (depth-3 MLP)
        +-> p2 = pillar2(g)     (depth-3 MLP)
        +-> p3 = pillar3(g)     (depth-3 MLP)
                |
                v
      concat [img_seq, p0, p1, p2, p3] -> BezierActivation (t = sigmoid(img_seq))
                |
                v
              output

--------------------------------------------------------------------------------
4.2  fluxflow's Transformer block (v0.7/v0.8)
--------------------------------------------------------------------------------
- Self-attention + cross-attention (injecting text into image tokens), both with RoPE,
  Pre-Norm, and residuals.
- ParallelAttention: Q uses one projection, while K and V share another (saving parameters).
- The MLP part: after Linear + residual, the Bezier activation is driven by "the 4 control
  points generated by the pillars."

  FluxTransformerBlock (v0.7) forward flow
  ----------------------------------------
  img_seq -> LayerNorm -> self-attention (RoPE) --(+residual)--
    |<---------------------------------------------------------+
  img_seq -> LayerNorm -> cross-attention (against text_seq) --(+residual)
    |
    v
  g = sigmoid(img_seq)
  img_p0..p3 = pillar0..3(g)            <- 4 pillar MLPs generate control points
    |
    v
  img_seq -> LayerNorm -> FFN --(+residual)
    |
    v
  BezierActivation( concat[img_seq, img_p0, img_p1, img_p2, img_p3] )
    |
    v
  output img_seq (plus p0..p3, passed to the next block)


--------------------------------------------------------------------------------
4.3  How do the four pillar MLPs "share data"? (v0.7 / v0.8)
--------------------------------------------------------------------------------
Question: each pillar handles one control point -- do they need to exchange information, and
if so, how?
Answer: fluxflow does NOT have the four MLPs exchange their hidden states -- the four pillars
are mutually independent subnetworks. The only "sharing" happens at three levels: the input,
the cross-block feedback, and the final combination.

I. v0.7: the four pillars are independent and "share" in only three places
  Source (v070/flow.py, FluxTransformerBlock.forward):
      g = torch.sigmoid(img_seq)
      img_p0 = self.p0(g * p0_x if p0_x is not None else g)
      img_p1 = self.p1(g * p1_x if p1_x is not None else g)
      img_p2 = self.p2(g * p2_x if p2_x is not None else g)
      img_p3 = self.p3(g * p3_x if p3_x is not None else g)
      img_seq = self.bezier_activation(
          torch.cat([img_seq, img_p0, img_p1, img_p2, img_p3], dim=-1))

    img_seq (already globally mixed by self-/cross-attention)
       |
       v
    g = sigmoid(img_seq) ------+---------+---------+---------+   <- all four share one input g
       |                       |         |         |         |
       x p0_x (prev block)     x p1_x    x p2_x    x p3_x
       v                       v         v         v
    pillar0(depth-3 MLP)   pillar1   pillar2   pillar3         <- four independent weight sets,
       | p0                    | p1      | p2      | p3            no communication between them
       +----------+-----------+---------+---------+
                  v
    BezierActivation( concat[img_seq, p0, p1, p2, p3] )         <- the four outputs jointly form
                                                                   one cubic curve here

  The three shared places:
  1) Common input: all four pillars read the same g (the same token representation, itself
     already globally mixed by attention and the FFN);
  2) Cross-block, per-pillar feedback: the previous block's p0..p3 become the next block's
     p0_x..p3_x and gate it elementwise: g*p_i_x. Note this is "each pillar's own memory across
     depth" (p0->p0, p1->p1), not cross-pillar;
  3) Final combination: the four control points are concatenated and fed to a single
     BezierActivation -- they meet at the "result level," not by exchanging intermediate
     tensors "during computation."

II. What v0.8 adds (still not inter-pillar communication)
  On top of v0.7:
  1) Per-pillar FiLM: g_pi = g*(1+gamma_i) + beta_i, where (gamma_i,beta_i)=film_pi(text_cond).
     The four film_pi projections are independent, but share the same text_cond (the pooled
     text + timestep conditioning).
  2) A shared "pillar cross-attention":
        raw_stacked = torch.cat([raw_p0, raw_p1, raw_p2, raw_p3], dim=1)   # [B, 4T, D]
        attended = self.pillar_cross_attn(normed_stacked, text_seq, ...)   # Q=pillars, KV=text
        raw_stacked = raw_stacked + attended
     The four pillars are stacked along the sequence dimension, processed by one shared
     attention (shared weights), then split back into p0..p3.
  It should be stated candidly: this attention has Q = pillar tokens and KV = text_seq, so the
  four pillars do NOT attend to one another (each query looks only at the text). Their coupling
  comes from (i) sharing the pillar_cross_attn module's weights, (ii) sharing the same text KV,
  and (iii) end-to-end training under the same loss. No genuine token-level interaction occurs.

       g --FiLM(text_cond)--> g_p0..g_p3   (independent film_pi, shared text_cond)
        four pillars (independent)
           |
           v
        stack [p0|p1|p2|p3] -> [B,4T,D]
           |
           v
        shared pillar_cross_attn: Q=pillars, KV=text   <- shared weights + shared text;
           |                                              pillars do not look at each other
           v
        residual -> split back to p0..p3

III. Design philosophy and the contrast with Sorami
  fluxflow places its "sharing" in "the shared input representation + the shared downstream
  combination," not in exchanging hidden states inside the four MLPs. This is like an ordinary
  MLP whose output units read the same input vector but do not communicate with one another in
  the forward pass; the consistency of the four control points emerges implicitly from
  "end-to-end training under one loss + concatenation into one Bezier," with no explicit
  constraint.

  Contrast with Sorami: Sorami has only ONE MLP (bias_mlp), which uses different output
  channels of its final layer to produce all 7 control-point biases at once (d_hidden x 7).
  That is, Sorami's "sharing" is built in by nature -- all control-point biases share the same
  hidden layer (mlp_hidden); whereas fluxflow uses four fully independent MLPs, which actually
  removes this hidden-layer sharing, at the cost of a heavier parameter count (~198K per block)
  and a greater implicit burden of "coordinating the four."

--------------------------------------------------------------------------------
4.4  fluxflow's conceptual slogan
--------------------------------------------------------------------------------
- An explicit analogy: "conventional ReLU = LEGO bricks (standard, but many are needed to
  approximate a smooth curve); Bezier = sculpting with clay (each neuron shapes itself,
  reaching equal expressiveness with fewer neurons)."
- Goal: 2-2.5x smaller models at equivalent quality, ~60% fewer parameters, ~38% faster
  inference (mostly targets still to be verified).
- Uses a "cubic" Bezier (4 control points, degree 3).
- Unlike Sorami: fluxflow applies Bezier "in every Transformer block of the generative model
  and throughout the VAE" -- a large-scale, comprehensive replacement; Sorami applies it only
  in the regression head.

================================================================================
Ch. 5  What the four share: common ground at the conceptual level
================================================================================

(1) A shared opponent and a shared stance
    Sorami, 1811, and fluxflow all explicitly oppose "one fixed activation curve for the
    whole network (one-size-fits-all)." Although 2305 aims at certification, it too advocates
    "replacing ReLU." All four belong to the broad "learnable / adaptive activation" movement
    (KAN is its famous emblem; fluxflow cites it directly).

(2) All use the "polynomial family" as the activation
    1811 uses power-basis polynomials (degree 5); 2305 uses Bernstein polynomials (any
    degree); fluxflow uses cubic Bezier; Sorami uses degree-8 Bezier. The reasons are the
    same: polynomials are smooth (differentiable, well-behaved gradients), easy to compute,
    and vectorizable on GPU. The Bernstein/Bezier family is chosen by two of the architectures
    specifically for numerical well-behavedness.

(3) The hypernetwork idea of "generating activation parameters with an auxiliary mechanism"
    (1811 / Sorami / fluxflow)
    1811: an auxiliary dense/conv activation network generates the coefficients.
    Sorami: bias_mlp (a small MLP) generates additive biases on the control points.
    fluxflow: 4 pillar MLPs generate the control points.
    The three are essentially the same -- the activation shape is decided dynamically by
    "another network" based on the features. This is the most central conceptual resonance.
    (2305 is the exception: its coefficients are ordinary learnable constants, not
    input-dependent.)

(4) All treat "adaptive activation" as a third path besides "wider / deeper"
    1811: states explicitly that "performance can be improved without adding nodes/layers."
    fluxflow: champions "smaller models reaching equal quality."
    Sorami: adds an adaptive regression head to a fixed backbone, exploring whether a gain is
    possible with essentially no increase in model size.
    2305: shifts the complexity burden "from the certification phase to the training phase."

(5) "The activation is data-dependent and per-unit customized"
    All four stress that the activation may differ for "each pixel / node / neuron /
    dimension"; 1811 and Sorami go further, making the activation differ for "each input
    sample" as well (data dependence).

(6) A strikingly similar backbone (an architectural commonality)
    Sorami's and fluxflow's Transformer backbones are almost the same: RoPE, Pre-Norm,
    multi-head attention, residual, FFN. Their real divergence is only in "where Bezier is
    placed and how the control points are produced."

(7) A shared technical difficulty and its directions of solution
    Both face the question "how to keep a polynomial activation numerically stable /
    differentiable"; fluxflow squashes the input to [0,1] with a sigmoid, 2305 uses the
    Bernstein basis to guarantee bounded gradients, and Sorami uses "domain clipping to
    [-5,5] + fallback to GELU outside the domain + parametric Newton inversion."

================================================================================
Ch. 6  How the four differ: contrasts at the architectural level
================================================================================

We compare dimension by dimension below. Codes: Sorami, A = 1811, B = 2305, F = fluxflow.

--------------------------------------------------------------------------------
6.1  Where the activation "parameters come from" (the most fundamental point)
--------------------------------------------------------------------------------
Sorami : A small MLP (bias_mlp) generates an "additive bias" from the FFN input x, added on
         top of the middle control points of a fixed GELU-Bezier base curve; then multiplied
         by the temperature bias_scale.
A=1811 : An auxiliary dense/conv network fully generates the degree-K polynomial coefficients
         from "this layer's intermediate output u" (not additive).
B=2305 : No auxiliary network; each neuron has a set of learnable Bernstein coefficients c
         (global constants, input-independent).
F      : Both kinds exist -- TrainableBezier uses learnable constants; Pillar-Based uses 4
         depth-3 MLPs to generate 4 control points from gated token features.
  Note: the closest to Sorami are F's Pillar-Based variant and A: both "generate activation
  parameters via a hypernetwork." But Sorami's generation is "additive bias + fixed skeleton,"
  whereas A/F "generate the entire parameter set"; the structure and parameter cost differ
  greatly.

--------------------------------------------------------------------------------
6.2  Whether the activation is anchored to a strong baseline (Sorami's distinctive design)
--------------------------------------------------------------------------------
Sorami : * Anchored to GELU. The soft start (bias_scale = 0, bias_mlp output ~ 0) makes the
         initial state exactly the fixed GELU baseline; only during training does it learn
         "how far to deviate from GELU." This guarantees a fair comparison with FixedGELU and
         is Sorami's most distinctive design philosophy.
A=1811 : Not anchored. The coefficients are learned entirely; they can "reduce to
         sigmoid/tanh," but that is only a theoretical possibility and is not used as a
         "soft start."
B=2305 : Not anchored. The coefficients are ordinary learnable parameters; "starting equal to
         some classical activation" is not emphasized.
F      : Not anchored. TrainableBezier's initial values (p0=1e-8, p1=.25, p2=.75, p3=1) are a
         near-identity/linear start, but not an anchoring to a strong baseline like GELU.
  Note: "letting the new activation start strictly from the baseline and then learn a
  residual deviation" is a selling point Sorami uniquely has among the four, directly serving
  a "fair comparison" research attitude.

--------------------------------------------------------------------------------
6.3  Polynomial basis and degree
--------------------------------------------------------------------------------
Sorami : Bezier/Bernstein, 9 control points = degree 8.
A=1811 : Power basis u^k, degree 5.
B=2305 : Bernstein, any degree (hyperparameter n).
F      : Cubic Bezier, 4 control points = degree 3.
  Note: Sorami's degree is markedly higher than fluxflow's because it must "fit an S-shape
  like GELU," requiring more degrees of freedom.

--------------------------------------------------------------------------------
6.4  How the input maps to the parameter t
--------------------------------------------------------------------------------
Sorami : Parametric Bezier + Newton iteration to invert t (so that x(t)=x), ensuring the
         curve is a well-defined function of x.
A=1811 : Substitutes the intermediate output u directly as the polynomial variable (power
         basis).
B=2305 : Normalizes x into the domain [l,u], then substitutes directly into the Bernstein
         basis.
F      : t = sigmoid(x) (or splitting from input channels) -- simple and direct.
  Note: "Newton inversion x -> t" is one of the key V5 fixes and the only approach among the
  four that explicitly handles the "inverse of a parametric curve."

--------------------------------------------------------------------------------
6.5  Granularity and scope of adaptation
--------------------------------------------------------------------------------
Sorami : Granularity = each "neuron/channel" (d_hidden) gets its own bias set; scope = the
         regression head only.
A=1811 : Granularity = each pixel / node / layer; scope = every layer where an activation
         network is inserted.
B=2305 : Granularity = each neuron; scope = every Bernstein layer.
F      : Granularity = each token (sequence position) / channel; scope = the diffusion
         Transformer's MLP layers + many places in the VAE.
  Note: Sorami's adaptation is "local and lightweight"; fluxflow's is "global and heavy."

--------------------------------------------------------------------------------
6.6  Parameter count and computational cost
--------------------------------------------------------------------------------
Sorami : Very cheap. bias_mlp = d_in x mlp_hidden + mlp_hidden x (d_hidden x 7), plus one
         scalar temperature parameter. Orders of magnitude smaller than fluxflow's pillars
         (~198K per block).
A=1811 : Moderate. The activation network adds parameters per layer, roughly +20% to +40%
         overall.
B=2305 : Cheap. (n+1) coefficients per neuron.
F      : Pillar-Based is very expensive (~198K per block); TrainableBezier is very cheap
         (4xD); Input-Based shifts the cost to the previous layer (5x channels).
  Note: Sorami trades "additive bias + fixed skeleton" for a very low parameter overhead, at
  the cost of expressiveness weaker than "generating the entire control-point set."

--------------------------------------------------------------------------------
6.7  Task domain and objective
--------------------------------------------------------------------------------
Sorami : Tabular/vector regression (Wine/Bangumi, etc.); objective = improve MSE/F1 and
         remain stable.
A=1811 : CNN image classification and denoising (CIFAR-10 / MNIST); objective = accuracy /
         efficiency.
B=2305 : Classification + adversarial robustness certification (MNIST / CIFAR-10);
         objective = certifiability / tight bounds.
F      : Text-to-image diffusion generation (COCO); objective = smaller and faster at equal
         quality (KAN-inspired compression).
  Note: "same tool, different uses" -- Sorami is regression accuracy, A is performance,
  B is safety certification, F is generative compression.

--------------------------------------------------------------------------------
6.8  Stability safeguards
--------------------------------------------------------------------------------
Sorami : Domain clipping [-5,5] + fallback to GELU outside + soft start + temperature
         parameter + parametric Newton inversion.
A=1811 : Not specifically emphasized; high-degree power basis is theoretically unstable for
         |u|>1.
B=2305 : Bernstein basis + a bounded-gradient proof (|dSigma/dx| <= 2n·max|c_k|) +
         coefficient regularization.
F      : Sigmoid squashes the input to [0,1] + bounded control points (xavier init).
  Note: Sorami and B both rely on the well-behavedness of Bernstein/Bezier; Sorami
  additionally uses "fallback to GELU" as a safety net.

--------------------------------------------------------------------------------
6.9  Whether sequence order / position is involved
--------------------------------------------------------------------------------
Sorami : The backbone uses RoPE (but the activation is position-independent).
F      : The backbone uses RoPE; Pillar-Based additionally introduces "cross-attention among
         pillars" and cross-block passing.
A=1811 : No notion of position (the CNN's local neighborhood plays a similar role).
B=2305 : No notion of position (a fully connected classification network).

--------------------------------------------------------------------------------
6.10  Academic lineage and timeline
--------------------------------------------------------------------------------
1811 (2018): the earliest systematic proposal of "using an auxiliary network to generate
             adaptive polynomial-activation coefficients."
2305 (2023): uses Bernstein polynomials as activations, in service of certifiability (with a
             well-behavedness proof).
KAN  (2024): a milestone of learnable activations, propelling "learnable activations" into a
             hot topic.
fluxflow   : explicitly after KAN, using cubic Bezier + three generation schemes to compress
             a generative model.
Sorami     : an independent route of "Bezier fitting to GELU + hypernetwork additive bias +
             soft start," engineered for regression tasks.
  Note: an important observation -- Sorami's core mechanism (hypernetwork-generated activation
  parameters) is highly isomorphic to 1811 (2018). This is both evidence of "consistency with
  the classical literature" and a reminder that the paper's narrative must squarely confront
  the fact that "the idea is not original" (see Ch. 8).

================================================================================
Ch. 7  Comprehensive comparison table (at a glance)
================================================================================
Dimension          | Sorami            | A=1811            | B=2305           | F=fluxflow
-------------------+-------------------+-------------------+------------------+-------------------
Activation family  | Bezier (deg 8)    | power basis (d5)  | Bernstein (any)  | Bezier (deg 3)
Parameter source   | small MLP -> bias | aux net -> coeffs | learnable consts | MLP pillars /
                   |                   |                   |                  | learnable consts
Hypernetwork?      | yes               | yes               | no               | yes (pillars) / no
Data-dependent?    | yes (per sample)  | yes (per sample)  | no               | yes (per token)
Anchored baseline? | * GELU soft start | no                | no               | no
x -> t mapping     | Newton inversion  | substitute u      | normalize + subst| sigmoid(x)
Adaptation grain   | per neuron        | per pixel / node  | per neuron       | per token/channel
Scope              | regression head   | every inserted ly | every act. layer | all MLP blocks+VAE
Param cost         | very low          | moderate (+20-40%)| low              | pillars high /
                   |                   |                   |                  | trainable low
Task               | regression        | classify/denoise  | classify+certify | text-to-image
Primary objective  | accuracy+stable   | accuracy/efficiency| certifiability  | compression/speed
Stability          | clip+fallback+soft| not emphasized    | Bernstein bounds | sigmoid bounded
Time               | independent(post24)| 2018              | 2023             | post-2024 (post-KAN)

================================================================================
Ch. 8  Positioning and objective assessment of Sorami
================================================================================

--------------------------------------------------------------------------------
8.1  Where Sorami is genuinely "distinctive" (relative to the three)
--------------------------------------------------------------------------------
(1) Anchored residual activation + soft start + temperature parameter.
    None of the three have this: Sorami lets the adaptive activation "start exactly from
    FixedGELU and then learn a deviation." Its value: (a) comparison is perfectly fair, so any
    gain is a net gain; (b) early in training it equals a known-good baseline, avoiding the
    instability of "learning an activation from scratch." This helps support a "fair
    comparison" paper narrative.
(2) Parametric Bezier + Newton inversion x -> t.
    It explicitly ensures the activation is a well-defined function of x and is exactly GELU
    at zero bias. This is careful engineering, and more "mathematical" than fluxflow's
    sigmoid(x) treatment.
(3) Degree-8 Bezier fitting GELU.
    A high-freedom curve fits the classical activation, yielding a "GELU-shaped skeleton" with
    more freedom than fluxflow's cubic curve. This enlarges the deformation space when
    "deviating from GELU."
(4) Very low parameter cost.
    Only a small MLP plus one scalar temperature modulate the activation -- friendly to a
    limited compute budget.

--------------------------------------------------------------------------------
8.2  Where Sorami overlaps with the three and should therefore not claim "novelty"
--------------------------------------------------------------------------------
(1) The idea "use an auxiliary network to generate activation parameters" was already
    proposed systematically by 1811 (2018), and implemented by fluxflow (pillar MLPs).
    Sorami's bias_mlp shares the same lineage. The paper must acknowledge this lineage.
(2) "Using Bezier/Bernstein as an activation" is already a mature practice in fluxflow and
    2305. Sorami is not the first to use Bezier as an activation.
(3) Therefore "adaptive activation" itself cannot be Sorami's novelty. The novelty can only
    lie in:
    - the "fair/stable" design of anchored residual + soft start + temperature;
    - its adaptation and empirical work in the specific setting of a Transformer regression
      head;
    - the engineering treatment of the parametric Newton inversion.

--------------------------------------------------------------------------------
8.3  Positioning recommendations for the paper
--------------------------------------------------------------------------------
- Narrative recommendation: do not say "Sorami first proposes adaptive activation"; instead
  say "Sorami proposes an adaptive-activation framework that 'anchors to a classical baseline
  and learns a residual deviation,' achieving robust gains (median on par, upper bound
  improved, no collapse) on regression tasks at very low parameter cost." This is consistent
  with the honest narrative the work advocates.
- Related work must cite and clearly distinguish 1811, 2305, and fluxflow (the KAN line),
  stating that Sorami's difference lies in "anchoring + residual + Newton inversion +
  regression setting."
- Selling-point choice: "stability" should not be the primary selling point (the property is
  too common); recommend making "the fair comparison enabled by the soft start + improvement
  of the upper bound" the primary selling point, with "no collapse / stability" as supporting
  evidence.
- The relationship to fluxflow can serve as an "efficiency comparison": Sorami reaches local
  adaptation with far fewer parameters than fluxflow's pillars, which is a story worth telling
  from a "lightweight adaptive activation" angle.

--------------------------------------------------------------------------------
8.4  Limitations (stated candidly)
--------------------------------------------------------------------------------
- The adaptation granularity reaches only "neuron-level additive bias," weaker in
  expressiveness than "full control-point generation" (fluxflow) and "full coefficient
  generation" (1811). This may be one architectural root cause of Sorami's "limited upper-
  bound improvement."
- It is used only in the regression head; the backbone FFN still uses a fixed GELU, so the
  overall "adaptivity" coverage is small.
- It does not exploit Bernstein/Bezier's "certifiability / bound-propagation" potential (that
  is 2305's downstream value), nor does it tackle a generative task (fluxflow's downstream
  value).

================================================================================
Ch. 9  Glossary
================================================================================
- Activation function: the nonlinear transform sigma of a neuron.
- Adaptive / learnable activation: an activation whose shape is not a fixed curve but is
  learnable or input-dependent.
- Hypernetwork: a network that generates the parameters of another network (or its activation
  parameters).
- Activation network: Paper 1811's term, specifically the "auxiliary network that generates
  activation coefficients."
- Polynomial degree: the highest power; higher degree "bends" more but is more prone to
  instability.
- Power basis: writing a polynomial as 1, x, x^2, ...; numerically unstable at high degree.
- Bernstein basis / Bezier curve: writing a polynomial with control points + Bernstein basis
  functions; numerically well-behaved.
- Control points: the p0..pn that determine a Bezier's shape.
- Domain [l,u] / domain: the range of the independent variable over which the polynomial is
  meaningful and evaluated.
- Soft start: initializing a new structure so it "degenerates to the baseline," then gradually
  learning a deviation.
- Temperature parameter (bias_scale): here a learnable scalar controlling "how strongly it
  deviates from GELU."
- Newton inversion x -> t: iteratively finding the parameter t given x, such that x(t) = x.
- Self-attention / QKV / multi-head: the core mechanism of a Transformer (Q = query, K = key,
  V = value; multi-head = several parallel attention computations, then concatenated).
- FFN / MLP: the small fully connected network after attention.
- Pre-Norm / residual / LayerNorm / Dropout: the stabilizing components of a Transformer.
- RoPE: rotary position embedding.
- Mean pooling: averaging over a sequence to obtain a fixed-length representation.
- TPE / Optuna: Bayesian hyperparameter search.
- IBP / certification / tight bounds: the core concepts of Paper 2305 (see Ch. 0).
- KAN: a representative network of learnable activations (2024).

================================================================================
Conclusion
================================================================================
The relationship between Sorami and the three can be summarized as follows:

  - Conceptually, Sorami belongs to the same lineage as 1811 and fluxflow (hypernetwork-
    driven adaptive activations) and shares the Bernstein/Bezier family with 2305; it is not
    an entirely new idea, but a careful engineering of this lineage in the setting of
    "regression tasks + fair comparison."
  - Architecturally, Sorami's distinctiveness centers on three points: the soft-start residual
    design anchored to GELU, the parametric Bezier with Newton inversion, and neuron-level
    additive-bias modulation at very low parameter cost.
  - Therefore, positioning Sorami as "a lightweight, anchored, fairly comparable adaptive
    activation" stands on firmer ground than positioning it as "the first of its kind," and is
    also more consistent with the honest narrative this work upholds.

(End of report)
================================================================================
