identity_reconciliation
Bases: fabrication
The identity parameter reconciliation function.
It performs the identity parameter reconciliation, and returns the identity reconciled parameter matrix of shape (n, D). This class inherits from the reconciliation class (i.e., the fabrication class in the module directory).
...
Notes
The identity parameter reconciliation projects any input parameters to themselves as follows: $$ \begin{equation} \psi(\mathbf{w}) = \text{reshape}(\mathbf{w}) = \mathbf{W} \in {R}^{n \times D}, \end{equation} $$ where the function will reshape the parameters from vector \(\mathbf{w}\) of length \(l\) to the matrix \(\mathbf{W}\) of size \(n \times D\).
For the identity parameter reconciliation function, the required number of parameter length can be denoted as $$ \begin{equation} l = n \times D, \end{equation} $$ where \(n\) and \(D\) denote the output space and expansion space dimensions, respectively.
Identity parameter reconciliation is straightforward and may work well for some expansion functions whose output dimension \(D\) is not very large. However, when used with expansion functions that produce a large output dimension (such as the high-order Taylor's polynomial expansions), the identity parameter reconciliation function may fail due to the "curse of dimensionality" issues.
Attributes:
Name | Type | Description |
---|---|---|
name |
str, default = 'identity_reconciliation'
|
Name of the parameter reconciliation function |
Methods:
Name | Description |
---|---|
__init__ |
It initializes the parameter reconciliation function. |
calculate_l |
It calculates the length of required parameters. |
forward |
It implements the abstract forward method declared in the base reconciliation class. |
Source code in tinybig/reconciliation/basic_reconciliation.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 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 |
|
__init__(name='identity_reconciliation', *args, **kwargs)
The initialization method of the identity parameter reconciliation function.
It initializes an identity parameter reconciliation function object. This method will also call the initialization method of the base class as well.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Name of the identity parameter reconciliation function. |
'identity_reconciliation'
|
Returns:
Type | Description |
---|---|
fabrication
|
The identity parameter reconciliation function object. |
Source code in tinybig/reconciliation/basic_reconciliation.py
calculate_l(n, D)
The required parameter number calculation method.
It calculates the number of required learnable parameters, i.e., l, of the parameter reconciliation function based on the intermediate and output space dimensions, n and D, which can be represented as follows: $$ \begin{equation} l = n \times D. \end{equation} $$
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
int
|
The dimension of the output space. |
required |
D
|
int
|
The dimension of the intermediate expansion space. |
required |
Returns:
Type | Description |
---|---|
int
|
The number of required learnable parameters. |
Source code in tinybig/reconciliation/basic_reconciliation.py
forward(n, D, w, device='cpu', *args, **kwargs)
The forward method of the parameter reconciliation function.
It applies the identity parameter reconciliation operation to the input parameter of length l, and returns the reconciled parameter matrix of shape (n, D) as follows: $$ \begin{equation} \psi(\mathbf{w}) = \text{reshape}(\mathbf{w}) = \mathbf{W} \in {R}^{n \times D}, \end{equation} $$
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
int
|
The dimension of the output space. |
required |
D
|
int
|
The dimension of the intermediate expansion space. |
required |
w
|
Parameter
|
The learnable parameters of the model. |
required |
device
|
str
|
Device to perform the parameter reconciliation. |
'cpu'
|
Returns:
Type | Description |
---|---|
Tensor
|
The reconciled parameter matrix of shape (n, D). |