Edit model card


This model is a fine-tuned version of xlm-roberta-base on the recipe ingredient NER dataset from the paper A Named Entity Based Approach to Model Recipes (using both the gk and ar datasets).

It achieves the following results on the evaluation set:

  • Loss: 0.1169
  • F1: 0.9672

On the test set it obtains an F1 of 0.9615, slightly above the CRF used in the paper.

Model description

Predicts tag of each token in an ingredient string.

Tag Significance Example
NAME Name of Ingredient salt, pepper
STATE Processing State of Ingredient. ground, thawed
UNIT Measuring unit(s). gram, cup
QUANTITY Quantity associated with the unit(s). 1, 1 1/2 , 2-4
SIZE Portion sizes mentioned. small, large
TEMP Temperature applied prior to cooking. hot, frozen
DF (DRY/FRESH) Fresh otherwise as mentioned. dry, fresh

Intended uses & limitations

  • Only trained on ingredient strings.
  • Tags subtokens; tag should be propagated to whole word
  • Works best with pre-tokenisation splitting of symbols (such as parentheses) and numbers (e.g. 50g -> 50 g)
  • Typically only detects the first ingredient if there are multiple.
  • Only trained on two American English data sources
  • Tags TEMP and DF have very few training data.

Training and evaluation data

Both the ar (AllRecipes.com) and gk (FOOD.com) datasets obtained from the TSVs from the authors' repository.

Training procedure

It follows the overall procedure from Chapter 4 of Natural Language Processing with Transformers by Tunstall, von Wera and Wolf.

See the training notebook for details.

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-05
  • train_batch_size: 16
  • eval_batch_size: 16
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 4

Training results

Training Loss Epoch Step Validation Loss F1
0.2529 1.0 331 0.1303 0.9592
0.1164 2.0 662 0.1224 0.9640
0.0904 3.0 993 0.1156 0.9671
0.0585 4.0 1324 0.1169 0.9672

Framework versions

  • Transformers 4.16.2
  • Pytorch 1.9.1
  • Datasets 1.18.4
  • Tokenizers 0.11.6
Downloads last month
Hosted inference API
Token Classification
This model can be loaded on the Inference API on-demand.