## Description ##
This implements a special version of AdaGrad with a learning rate per row 
instead of for every parameter. This is useful for learning large embedding 
matrices, as it significantly reduces the memory requirements for the state 
array as well as reduces over-fitting due to having less learning rates. 
Consequently only 2D weight arrays are supported.

Compared to the AdaGrad optimizer already included in MXNet, this Optimizer 
also supports the group lasso proximal operator for inducing group sparsity, 
where each row of the weight is considered a group. As there is a single 
learning rate per group, we can use a [closed form solution for the proximal 
operator](https://en.wikipedia.org/wiki/Proximal_gradient_methods_for_learning#Group_lasso)
 which is not possible if different learning rates are used for parameters 
within a single group.

This Optimizer is useful for the GluonNLP project.

## Checklist ##
### Essentials ###
Please feel free to remove inapplicable items for your PR.
- [X] Changes are complete (i.e. I finished coding on this PR)
- [X] All changes have test coverage:
- Unit tests are added for small changes to verify correctness (e.g. adding a 
new operator)
- Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
- Build tests will be added for build configuration changes (e.g. adding a new 
build option with NCCL)
- [X] Code is well-documented: 
- For user-facing API changes, API doc string has been updated. 
- For new C++ functions in header files, their functionalities and arguments 
are documented. 
- For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
- Check the API doc at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
- [X] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change

### Changes ###
- [X] Add contrib.optimizer.ProximalGroupAdaGrad

## Comments ##
- If you have any suggestions for the API naming or other suggestions pleas let 
me know.
- Forcing an eager update of the lazily accumulated group lasso regularization 
for a set of rows requires access to some private API. I am not sure how this 
could be solved without access to private API:

        fake_grad = mx.nd.sparse.row_sparse_array(
            (mx.nd.zeros((len(indices_to_force_update), weight.shape[1])), 
indices_to_force_update))
        weight.grad()[:] = fake_grad
        weight.data()._fresh_grad = True
        trainer._optimizer._index_update_count[0] -= 1
        trainer._optimizer.num_update -= 1
        trainer.step(batch_size=1)


@szha @szhengac @eric-haibin-lin 

[ Full content available at: 
https://github.com/apache/incubator-mxnet/pull/12365 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to