stanfordnlp/CoreNLP · error · java.lang.UnsupportedOperationException

useAdaDelta is currently only supported for Prior.NONE or Pr

Error message

useAdaDelta is currently only supported for Prior.NONE or Prior.GAUSSIAN

What it means

SGDWithAdaGradAndFOBOS.minimize() throws this UnsupportedOperationException when useAdaDelta is enabled but the regularizer prior is anything other than Prior.NONE or Prior.GAUSSIAN. The AdaDelta update requires summing squared parameter deltas, an accounting scheme only implemented for these two priors. Other priors (LASSO, RIDGE, ae-lasso, g-lasso, sgLASSO) are incompatible with the AdaDelta code path.

Solutions

  1. Set the prior to Prior.NONE or Prior.GAUSSIAN before minimizing, e.g. setPrior(Prior.GAUSSIAN)
  2. Disable AdaDelta with setUseAdaDelta(false) to keep the LASSO prior
  3. Use a different optimizer that supports L1 regularization with your desired prior

Example fix

// before
optimizer.setUseAdaDelta(true);
optimizer.setPrior(Prior.LASSO);
// after
optimizer.setUseAdaDelta(true);
optimizer.setPrior(Prior.GAUSSIAN); // AdaDelta-compatible prior
Defensive patterns

Strategy: validation

Validate before calling

if (opt.isUseAdaDelta() && prior != Prior.NONE && prior != Prior.GAUSSIAN) { opt.setPrior(Prior.GAUSSIAN); }

Type guard

boolean adaDeltaCompatible(Prior p) { return p == Prior.NONE || p == Prior.GAUSSIAN; }

Prevention

When it happens

Trigger: Calling minimize() on an SGDWithAdaGradAndFOBOS instance with setUseAdaDelta(true) (or the equivalent options flag) while prior is set to Prior.LASSO, Prior.RIDGE, or any grouped-lasso prior.

Common situations: Copying optimizer configuration from a LASSO-regularized run and enabling AdaDelta without reverting the prior; switching from plain AdaGrad to AdaDelta for a sparse model that used L1 regularization.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/a38c57e820e62206. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/optimization/SGDWithAdaGradAndFOBOS.java:313

        bSize = totalSamples;
        sayln("Using batch size=" + bSize);
      }
      if (bSize <= 0) {
        log.info("WARNING: Requested batch size=" + bSize + " <= 0 !!!");
        bSize = totalSamples;
        sayln("Using batch size=" + bSize);
      }
    }

    x = new double[initial.length];
    double[] testUpdateCache = null, currentRateCache = null, bCache = null;
    sumGradSquare = new double[initial.length];
    prevGrad = new double[initial.length];
    prevDeltaX = new double[initial.length];
    if (useAdaDelta) {
      sumDeltaXSquare = new double[initial.length];
      if (prior != Prior.NONE && prior != Prior.GAUSSIAN) {
        throw new UnsupportedOperationException("useAdaDelta is currently only supported for Prior.NONE or Prior.GAUSSIAN"); 
      }
    }

    int[][] featureGrouping = null;
    if (prior != Prior.LASSO && prior != Prior.NONE) {
      testUpdateCache = new double[initial.length];
      currentRateCache = new double[initial.length];
    }
    if (prior != Prior.LASSO && prior != Prior.RIDGE && prior != Prior.GAUSSIAN) {
      if (!(f instanceof HasFeatureGrouping)) {
        throw new UnsupportedOperationException("prior is specified to be ae-lasso or g-lasso, but function does not support feature grouping");
      }
      featureGrouping = ((HasFeatureGrouping)f).getFeatureGrouping();
    }
    if (prior == Prior.sgLASSO) {
      bCache = new double[initial.length];
    }

View on GitHub (pinned to 1b7edd19c4)