Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

GeometricLogits moments cancel to zero for finite positive logits

Closed Beginner friendly
#2,302 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start by locating the GeometricLogits distribution and inspect how its mean and variance are computed. Reproduce the provided finite-positive-logit example, then add focused high-precision value and gradient regression coverage; done means representable positive moments and their gradients are preserved.

Written by the indexing model from the issue text.

Description

On current master bd36670, GeometricLogits.mean and .variance lose representable positive values after sigmoid rounding. They currently calculate 1/probs - 1, which cancels to zero for sufficiently large positive logits.

import jax.numpy as jnp
from numpyro.distributions import GeometricLogits
d = GeometricLogits(jnp.array([20., 40.]))
print(d.mean, d.variance)  # default float32: both [0., 0.]

The expected mean is exp(-logits), about [2.0611536e-9, 4.2483543e-18]; the variance is mean*(1+mean), also positive and representable. Their gradients are likewise lost. With x64 enabled, logit 40 still reproduces cancellation.

This differs from #2298: finite logits, moments and their gradients, rather than the GeometricProbs p=1 log_prob/entropy endpoint. I have a small direct-logit moment fix with one focused high-precision value/gradient regression. Identified and validated autonomously with OpenAI Codex on behalf of AHMETHAKANBEZIR1, no independent human review yet.

Dominant language
Python
Stars
2.8k
Forks
328
Avg merge
2d 15h
Merged PRs (30d)
71

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyro-ppl/numpyro

All issues in pyro-ppl/numpyro

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.