Back to directory

treelstm-code-generation

A PyTorch Tree2Tree model that translates natural-language descriptions into source code by decoding a syntax tree of grammar rules instead of generating tokens one at a time.

treelstm-code-generation

treelstm-code-generation is a PyTorch implementation of a Tree2Tree neural network that translates natural-language descriptions into source code, built for the author's master's thesis on generating code from text with syntactic parsing. The approach parses the input sentence into a syntax tree (CCG, PCFG or dependency), encodes it with a recursive tree-LSTM, and decodes the output as a sequence of grammar rules that assemble a target-language abstract syntax tree, rather than generating code token-by-token. It is inspired by, and follows a structure similar to, Yin and Neubig's syntactic neural code-generation model and its NL2code reference implementation.

It is trained and evaluated on two natural-language-to-code datasets: HearthStone card text mapped to Python card implementations, and Django docstrings and comments mapped to Python code. Model and training options such as encoder type, syntax formalism, embedding sizes and the copy mechanism are configured in a single config file.

The author describes it as research/thesis code rather than production software.

More in Models

See all 405
  • mini-AGI

    github.com

    A continual learning language model that trains from scratch on a single 8 GB VRAM GPU, assembling its own architecture and adapting its size to the hardware and data available rather than shipping as a fixed pretrained model.

  • An open-source contrastive-embedding pipeline that maps technical CVE vulnerability descriptions to formal cybersecurity compliance controls in NIST SP 800-53 and CMMC, published with its model generation, fine-tuning and evaluation code.

  • peekaboolean

    github.com

    A small vision-language model, fine-tuned with LoRA on a 500-million-parameter backbone, that answers typed multiple-choice, ordinal-score and yes/no questions about an image with calibrated probabilities, in about 400 milliseconds on a laptop.