stanfordnlp/CoreNLP · error · RuntimeException

No annealing type specified

Error message

No annealing type specified

What it means

When Gibbs sampling uses annealing, CRFClassifier dispatches on flags.annealingType: "linear" and "exp"/"exponential" (case-insensitive) select the corresponding CoolingSchedule. Any other value falls through to this RuntimeException because no cooling schedule implementation exists for it in this version.

Solutions

  1. Set annealingType to "linear", "exp", or "exponential" (case-insensitive).
  2. Set annealingRate to a sensible value when using the exponential schedule.
  3. If another schedule is required, add a branch constructing the desired CoolingSchedule and recompile.
  4. Or drop annealingType so the sampler uses its non-annealing path.

Example fix

// before
props.setProperty("annealingType", "hyperbolic");
// after
props.setProperty("annealingType", "exp");
props.setProperty("annealingRate", "0.99");
Defensive patterns

Strategy: validation

Validate before calling

String at = props.getProperty("annealingType", "").toLowerCase(Locale.ROOT);
if (!at.isEmpty() && !at.equals("linear") && !at.equals("exp") && !at.equals("exponential")) {
  throw new IllegalArgumentException("annealingType must be linear or exp/exponential");
}

Try / catch

try {
  classifier.classify(docs);
} catch (RuntimeException e) {
  if ("No annealing type specified".equals(e.getMessage())) {
    props.setProperty("annealingType", "exp");
    props.setProperty("annealingRate", "0.99");
    // reconfigure and retry
  } else throw e;
}

Prevention

When it happens

Trigger: Setting annealingType to a misspelled or unsupported value (e.g. "hyperbolic", "exponencial") while the Gibbs path calls sampler.findBestUsingAnnealing.

Common situations: Typos; copying annealing settings from papers/toolkits supporting other schedules; forgetting that only linear and exponential schedules are implemented.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/ie/crf/CRFClassifier.java:1259

      TestSequenceModel testSequenceModel = new TestSequenceModel(cliqueTree);
      ExactBestSequenceFinder tagInference = new ExactBestSequenceFinder();
      int[] bestSequence = tagInference.bestSequence(testSequenceModel);
      System.arraycopy(bestSequence, windowSize - 1, sequence, 0, sequence.length);
    } else {
      int[] initialSequence = SequenceGibbsSampler.getRandomSequence(model);
      System.arraycopy(initialSequence, 0, sequence, 0, sequence.length);
    }

    sampler.verbose = 0;

    if (flags.annealingType.equalsIgnoreCase("linear")) {
      sequence = sampler.findBestUsingAnnealing(model, CoolingSchedule.getLinearSchedule(1.0, flags.numSamples),
          sequence);
    } else if (flags.annealingType.equalsIgnoreCase("exp") || flags.annealingType.equalsIgnoreCase("exponential")) {
      sequence = sampler.findBestUsingAnnealing(model, CoolingSchedule.getExponentialSchedule(1.0, flags.annealingRate,
          flags.numSamples), sequence);
    } else {
      throw new RuntimeException("No annealing type specified");
    }

    if (flags.useReverse) {
      Collections.reverse(document);
    }

    for (int j = 0, dsize = newDocument.size(); j < dsize; j++) {
      IN wi = document.get(j);
      if (wi == null) throw new RuntimeException("");
      if (classIndex == null) throw new RuntimeException("");
      wi.set(CoreAnnotations.AnswerAnnotation.class, classIndex.get(sequence[j]));
    }

    if (flags.useReverse) {
      Collections.reverse(document);
    }

    return document;

View on GitHub (pinned to 1b7edd19c4)