random_matrix_adaption_parameterized_concatenation_fusion
Bases: parameterized_concatenation_fusion
A parameterized concatenation fusion with random matrix adaptation for parameter fabrication.
Notes
Formally, given input interdependence matrices \(\mathbf{A}_1, \mathbf{A}_2, \ldots, \mathbf{A}_k\), where each matrix \(\mathbf{A}_i \in R^{m \times n_i}\) has \(m\) rows and \(n_i\) columns, we define the fusion operator as follows:
\[ \begin{equation} \begin{aligned} \mathbf{A} &= \text{fusion}(\mathbf{A}_1, \mathbf{A}_2, \cdots, \mathbf{A}_k) \\ &= \left( \mathbf{A}_1 \sqcup \mathbf{A}_2 \sqcup \cdots \sqcup \mathbf{A}_k \right) \mathbf{W} \in R^{m \times n}, \end{aligned} \end{equation} \]
where \(\sqcup\) denotes the row-wise concatenation of the matrices.
Notation \(\mathbf{W} \in R^{(\sum_{i=1}^k n_i) \times n}\) denotes the parameter matrix fabricated from the learnable parameter vector \(\mathbf{w} \in R^{l}\), which can be represented as follows:
\[ \begin{equation} \psi(\mathbf{w}) = \Lambda_1 \mathbf{A} \Lambda_1 \mathbf{B}^\top \in R^{(\sum_{i=1}^k n_i) \times n}, \end{equation} \]
Notations \(\Lambda_1\) and \(\Lambda_2\) denote two diagonal matrices \(\Lambda_1 = diag( \lambda_1) \in R^{(\sum_{i=1}^k n_i) \times (\sum_{i=1}^k n_i)}\) and \(\Lambda_2 = diag(\lambda_2) \in R^{r \times r}\) where the diagonal vectors \(\lambda_1\) and \(\lambda_2\) are partitioned from the parameter vector \(\mathbf{w}\). Matrices \(\mathbf{A} \in R^{(\sum_{i=1}^k n_i) \times r}\) and \(\mathbf{B} \in R^{r \times n}\) are randomly sampled from the Gaussian distribution \(\mathcal{N}(\mathbf{0}, \mathbf{I})\).
The required length of parameter vector of this interdependence function is \(\mathbf{w}\) is \(l = (\sum_{i=1}^k n_i) + r\).
Attributes:
Name | Type | Description |
---|---|---|
r |
int
|
Rank for the random matrix adaptation. |
Methods:
Name | Description |
---|---|
__init__ |
Initializes the random matrix adaptation parameterized concatenation fusion function. |
Source code in tinybig/fusion/parameterized_concatenation_fusion.py
__init__(r=2, name='random_matrix_adaption_parameterized_concatenation_fusion', *args, **kwargs)
Initializes the random matrix adaptation parameterized concatenation fusion function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r
|
int
|
Rank for the random matrix adaptation. Defaults to 2. |
2
|
name
|
str
|
Name of the fusion function. Defaults to "random_matrix_adaption_parameterized_concatenation_fusion". |
'random_matrix_adaption_parameterized_concatenation_fusion'
|
*args
|
tuple
|
Additional positional arguments for the parent class. |
()
|
**kwargs
|
dict
|
Additional keyword arguments for the parent class. |
{}
|