Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve Precision Issues #19

Open
1 task
meiji163 opened this issue Apr 9, 2022 · 0 comments
Open
1 task

Solve Precision Issues #19

meiji163 opened this issue Apr 9, 2022 · 0 comments
Labels
tracking An issue to track and plan work on a large project

Comments

@meiji163
Copy link
Member

meiji163 commented Apr 9, 2022

This is a tracking issue for solving precision issues.

Problem Overview

Precision is one of the major obstacles to the adoption of hyperbolic geometry in machine learning.
As shown in Representation Tradeoffs for Hyperbolic Embeddings, there is a tradeoff between precision and dimensionality when representing points in hyperbolic space with floats, independent of the model that is used.

Hyperlib should have a solution to this in its core components. Ideally the solution will satisfy the following.

  1. reasonably efficient: it doesn't incur significant overhead compared to Euclidean methods and is GPU compatible
  2. easy to use: it's abstracted away from the API so that a casual user doesn't have to touch it
  3. general: it's general enough to be used with different models of hyperbolic space

Approaches

Hope for the best

We see many papers that simply accept the precision errors and try to mitigate them, or go to higher dimensions.
E.g. Our current approach in the Poincare model is to cast tf.float64, which only gets us 53 bits of precision.

Multiprecision

In the sarkar embeddings, we use a multi-precision library mpmath to represent points. As far as multiprecision arithmetic goes it is fast (assuming it is using the gmpy) backend. However the support for vector operations is not good and it cannot easily interoperate with numpy or tensorflow. Also we do not yet have a good method to automatically determine the precision setting (for example, in sarkar_embedding it uses far too much precision by default).

Avoiding the Problem

One common approach to avoid precision errors, especially in hyperbolic SGD, is to map from the (Euclidean) tangent space and do all operations there instead. We should definitely experiment with and support this method in Hyperlib. This will work for all models via the exponential map. However, it only solves part of the problem.

Multi-Component Float

Multi-Component Floats (MCF) are an alternate representation for floats that can be vectorized, proposed by Yu and De Sa as a way to do calculations in the upper half-space model. IMO this is the most promising approach if it can be extended to other models of hyperbolic space.

Todos

  • Spike: implementing MCF for upper-half space
@meiji163 meiji163 added the tracking An issue to track and plan work on a large project label Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracking An issue to track and plan work on a large project
Projects
None yet
Development

No branches or pull requests

1 participant