Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ASDL: Automatic Second-order Differentiation (for Fisher, Gradient covariance, Hessian, Jacobian, and Kernel) Library
ASDL is an extension library of PyTorch to easily perform gradient preconditioning using second-order information (e.g., Hessian, Fisher information) for deep neural networks.
ASDL provides various implementations and a unified interface (GradientMaker) for gradient preconditioning for deep neural networks. For example, to train your model with gradient preconditioning by K-FAC algorithm, you can replace a <Standard>
gradient calculation procedure (i.e., a forward pass followed by a backward pass) with one by <ASDL>
with KfacGradientMaker like the following:
from asdl.precondition import PreconditioningConfig, KfacGradientMaker
# Initialize model
model = Net()
# Initialize optimizer (SGD is recommended)
optimizer = torch.optim.SGD(model.parameters(), lr=0.1)
# Initialize KfacGradientMaker
config = PreconditioningConfig(data_size=batch_size, damping=0.01)
gm = KfacGradientMaker(model, config)
# Training loop
for x, t in data_loader:
optimizer.zero_grad()
# <Standard> (gradient calculation)
# y = model(x)
# loss = loss_fn(y, t)
# loss.backward()
# <ASDL> ('preconditioned' gradient calculation)
dummy_y = gm.setup_model_call(model, x)
gm.setup_loss_call(loss_fn, dummy_y, t)
y, loss = gm.forward_and_backward()
optimizer.step()
You can apply a different gradient preconditioning algorithm by replacing gm
with another XXXGradientMaker(model, config)
(XXX: algorithm name, e.g., ShampooGradientMaker for Shampoo algorithm) with the same interface.
This enables a flexible switching/comparison of a range of gradient preconditioning algorithms.
You can install the latest version of ASDL by running:
$ pip install asdfghjkl
ASDL is tested with Python 3.7 and is compatible with PyTorch 1.13.
The training script for training MLPs, CNNs, or ResNets using varous types of gradient preconditionig methods (which reproduces the results in the ASDL paper).
FAQs
ASDL: Automatic Second-order Differentiation (for Fisher, Gradient covariance, Hessian, Jacobian, and Kernel) Library
We found that asdfghjkl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.