dual_lphm_parameterized_concatenation_fusion
Bases: parameterized_concatenation_fusion
A parameterized concatenation fusion with dual low-rank hierarchical matrix (Dual-LPHM) 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}) = \mathbf{A} \otimes \mathbf{B} = ( \mathbf{P} \mathbf{Q}^\top) \otimes ( \mathbf{S} \mathbf{T}^\top) \in R^{(\sum_{i=1}^k n_i) \times n}, \end{equation} $$ where \(\mathbf{P} \in R^{p \times r}\), \(\mathbf{Q} \in R^{q \times r}\), \(\mathbf{S} \in R^{\frac{(\sum_{i=1}^k n_i)}{p} \times r}\) and \(\mathbf{T} \in R^{\frac{n}{q} \times r}\) are partitioned and reshaped from the parameter vector \(\mathbf{w}\).
The required length of parameter vector of this interdependence function is \(l = r \times (p + q + \frac{(\sum_{i=1}^k n_i)}{p} + \frac{n}{q})\).
Attributes:
Name | Type | Description |
---|---|---|
r |
int
|
Rank for the low-rank approximation. |
p |
int
|
Partition size for the hierarchical matrix. |
q |
int
|
Block size for the hierarchical matrix. |
Methods:
Name | Description |
---|---|
__init__ |
Initializes the Dual-LPHM parameterized concatenation fusion function. |
Source code in tinybig/fusion/parameterized_concatenation_fusion.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
|
__init__(r, p, q=None, name='dual_lphm_parameterized_concatenation_fusion', *args, **kwargs)
Initializes the Dual-LPHM parameterized concatenation fusion function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r
|
int
|
Rank for the low-rank approximation. |
required |
p
|
int
|
Partition size for the hierarchical matrix. |
required |
q
|
int
|
Block size for the hierarchical matrix. Defaults to |
None
|
name
|
str
|
Name of the fusion function. Defaults to "dual_lphm_parameterized_concatenation_fusion". |
'dual_lphm_parameterized_concatenation_fusion'
|
*args
|
tuple
|
Additional positional arguments for the parent class. |
()
|
**kwargs
|
dict
|
Additional keyword arguments for the parent class. |
{}
|
Raises:
Type | Description |
---|---|
AssertionError
|
If |