Pacaya - A Library for Hybrid Graphical Models and Neural Networks
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Pacaya Build Status


Pacaya is a library for joint modeling with graphical models, structured factors, neural networks, and hypergraphs. Structured factors allow us to encode structural constraints such as for dependency parsing, constituency parsing, etc. Neural factors are just factors where the scores are computed by a neural network.

This library has been used extensively for NLP. Check out Pacaya NLP for applications of this library to dependency parsing, relation extraction, semantic role labeling, and more.

A software tutorial is in the works. Check back soon for an update!

Contributions to this library come from Matt Gormley, Meg Mitchell, and Travis Wolfe.

Using the Library

The latest version is deployed on Maven Central:




This project has several dependencies all of which are available on Maven Central. Among others we make extensive use:

  • Prim: a Java primitives library
  • Optimize: a numerical optimization library


  • Compile the code from the command line:

      mvn compile
  • To build a single jar with all the dependencies included:

      mvn compile assembly:single

Eclipse setup:

  • Create local versions of the .project and .classpath files for Eclipse:

      mvn eclipse:eclipse
  • Add M2_REPO environment variable to Eclipse. Open the Preferences and navigate to 'Java --> Build Path --> Classpath Variables'. Add a new classpath variable M2_REPO with the path to your local repository (e.g. ~/.m2/repository).

  • To make the project Git aware, right click on the project and select Team -> Git...


If you use this library, please cite the thesis below:

        location = {Baltimore, {MD}},
        title = {Graphical Models with Structured Factors, Neural Factors, and Approximation-Aware Training},
        institution = {Johns Hopkins University},
        type = {phdthesis},
        author = {Gormley, Matthew R.},
        date = {2015}