{"record":{"id":"a38c57e820e62206","repo":"stanfordnlp/CoreNLP","slug":"useadadelta-is-currently-only-supported-for-prior","errorCode":null,"errorMessage":"useAdaDelta is currently only supported for Prior.NONE or Prior.GAUSSIAN","messagePattern":"useAdaDelta is currently only supported for Prior\\.NONE or Prior\\.GAUSSIAN","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/optimization/SGDWithAdaGradAndFOBOS.java","lineNumber":313,"sourceCode":"        bSize = totalSamples;\n        sayln(\"Using batch size=\" + bSize);\n      }\n      if (bSize <= 0) {\n        log.info(\"WARNING: Requested batch size=\" + bSize + \" <= 0 !!!\");\n        bSize = totalSamples;\n        sayln(\"Using batch size=\" + bSize);\n      }\n    }\n\n    x = new double[initial.length];\n    double[] testUpdateCache = null, currentRateCache = null, bCache = null;\n    sumGradSquare = new double[initial.length];\n    prevGrad = new double[initial.length];\n    prevDeltaX = new double[initial.length];\n    if (useAdaDelta) {\n      sumDeltaXSquare = new double[initial.length];\n      if (prior != Prior.NONE && prior != Prior.GAUSSIAN) {\n        throw new UnsupportedOperationException(\"useAdaDelta is currently only supported for Prior.NONE or Prior.GAUSSIAN\"); \n      }\n    }\n\n    int[][] featureGrouping = null;\n    if (prior != Prior.LASSO && prior != Prior.NONE) {\n      testUpdateCache = new double[initial.length];\n      currentRateCache = new double[initial.length];\n    }\n    if (prior != Prior.LASSO && prior != Prior.RIDGE && prior != Prior.GAUSSIAN) {\n      if (!(f instanceof HasFeatureGrouping)) {\n        throw new UnsupportedOperationException(\"prior is specified to be ae-lasso or g-lasso, but function does not support feature grouping\");\n      }\n      featureGrouping = ((HasFeatureGrouping)f).getFeatureGrouping();\n    }\n    if (prior == Prior.sgLASSO) {\n      bCache = new double[initial.length];\n    }\n","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/optimization/SGDWithAdaGradAndFOBOS.java#L295-L331","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the prior to Prior.NONE or Prior.GAUSSIAN before minimizing, e.g. setPrior(Prior.GAUSSIAN)","Disable AdaDelta with setUseAdaDelta(false) to keep the LASSO prior","Use a different optimizer that supports L1 regularization with your desired prior"],"exampleFix":"// before\noptimizer.setUseAdaDelta(true);\noptimizer.setPrior(Prior.LASSO);\n// after\noptimizer.setUseAdaDelta(true);\noptimizer.setPrior(Prior.GAUSSIAN); // AdaDelta-compatible prior","handlingStrategy":"validation","validationCode":"if (opt.isUseAdaDelta() && prior != Prior.NONE && prior != Prior.GAUSSIAN) { opt.setPrior(Prior.GAUSSIAN); }","typeGuard":"boolean adaDeltaCompatible(Prior p) { return p == Prior.NONE || p == Prior.GAUSSIAN; }","tryCatchPattern":null,"preventionTips":["Pair any useAdaDelta(true) call with a prior audit in the same setup method","Centralize optimizer configuration in one factory that enforces AdaDelta/prior compatibility","Write a unit test asserting optimizer configuration builds without throwing"],"tags":["java","optimization","unsupported-combination"],"backgroundTag":"conflicting-config-options","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}