Modeling an API's syntax

I’m looking to map human language queries to the syntax required by an API.

Example:

INPUT: 30 day average volatility in the 4th quarter of 2015
OUTPUT: avg_vol_30d['Y2015.Q4']

I’ve generated the training data. Got > 8 million training pairs.

What is the best model to use for a task like this?

Couple of thoughts:

  • It seems I need very little parameterized world-knowledge from the model. Can’t start with a randomly initialized model, since I do want the model to be flexible in its understanding of different ways to say, for example, the same date. But since the output is going to be limited by the syntax of the API, I guess using something like T5 is probably overkill.
  • It would be great to have something that can run inference on a CPU fairly fast.

Hey @leobg

Looking at the example, an encoder-decoder model seems like a good fit. T5-small is one of our smallest models, and runs pretty quickly on CPU.

If you’d rather have a smaller model, then perhaps training a smaller configuration of T5 from scratch could be the way to go :slight_smile: We have some related examples here.

1 Like