Downloads · 30 days
5
10% of all-time downloads
nuhuibrahim/recifinegold-recipebert-ka-example
recifinegold-recipebert-ka-example is a token classification model from nuhuibrahim. Use it when you need labels on individual words, such as names. The card lists the license as cc-by-nc-4.0.
This model is a BERT-base-uncased token-classification model trained on ReciFineGold for recipe-focused Named Entity Recognition (NER) using a Knowledge-Augmented & Entity Type-Specific (KAES) formulation.
Downloads · 30 days
5
10% of all-time downloads
All-time downloads
51
Public
Parameters
109M
436 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors436 MB · 100%
From the Hugging Face model README
recifinegold-recipebert-ka-exampleThis model is a BERT-base-uncased token-classification model trained on ReciFineGold for recipe-focused Named Entity Recognition (NER) using a Knowledge-Augmented & Entity Type-Specific (KAES) formulation.
In KAES, the model extracts one entity type at a time by prepending a curated knowledge context (here: a natural-language example prompt) to the input recipe sentence. This encourages the encoder to focus on spans relevant to the requested entity type, rather than relying only on the sentence’s internal context.
The ReciFine library provides a lightweight inference wrapper (ReciFineNER) that handles the KAES prompting and decoding.
# Install ReciFine (see repo for latest install instructions)
pip install https://github.com/nuhu-ibrahim/ReciFine/archive/refs/tags/V1.zip
from recifine.inferencing.inference import ReciFineNER
ner = ReciFineNER.from_pretrained(
model="recipebert",
task_formulation="knowledge_guided",
knowledge_type="example",
)
text = "Add 2 cups of chopped onions and fry until golden."
prediction = ner.process_text(text, entity_type="QUANTITY")
print(prediction)
ReciFine library (recommended): training scripts, inference wrappers, and full documentation
https://github.com/nuhu-ibrahim/ReciFine/tree/main
Colab (end-to-end usage demo):
https://colab.research.google.com/drive/1CatH2YOhnOWf-VglprEgxONWRkrXRBXo?usp=sharing&authuser=1
Use this model to extract fine-grained recipe entities from procedural recipe text (e.g., instructions), including ingredients, tools, quantities, durations, actions, and state descriptors.
Typical applications:
Unlike traditional token classification pipelines that rely solely on internal sentence context, we adopt a KA formulation that prepends curated knowledge contexts to the input to guide the model toward the entities of the relevant entity type.
Let the token sequence for a recipe sentence be denoted as:
x = {x1, x2, ..., xn}
and let the knowledge context associated with a particular entity type Ej be represented as a natural language context:
pj = {p1(j), ..., pm(j)}
Each context pj belongs to one of five types (questions type, definition type, examples type, entity type name type, and combined type).
We construct the augmented input to the encoder as:
x̃ = {[CLS], pj, [SEP], x1, ..., xn, [SEP]}
where m is the length of the context and n is the length of the recipe tokens. The full sequence x̃ is passed through a transformer encoder (e.g., BERT or RoBERTa), and a feedforward classification layer predicts BIO tags for each token.
This setup introduces a form of entity type conditioning, enabling the model to modulate its attention and token representations based on the target entity type. Unlike multi-entity type classification with shared label spaces, our formulation uses a single encoder across all entity types but treats each classification task independently.
entity_type): A plain directive that names the entity type, e.g., FOOD STATE.question): A natural question about the entity type, e.g., Which words describe the state of the food?.example): A list of entity examples, e.g., melted, frozen, chopped.definition): A brief definition of the entity type, e.g., A STATE describes the physical condition of an ingredient.all): A concatenation of all the above, providing the richest context.| Entity Type | Definition |
|---|---|
FOOD | Edible items, including both raw ingredients and intermediate products |
TOOL | Cooking tools such as knives, bowls, pans |
DURATION | Time durations in cooking (e.g., 20 minutes) |
QUANTITY | Quantities associated with ingredients |
ACTION_BY_CHEF | Verbs for deliberate cook actions (e.g., bring in “Bring the mixture to a boil”) |
ACTION_BY_CHEF_DISCONTINUOUS | Non-contiguous parts of compound chef actions (e.g., to a boil) |
ACTION_BY_FOOD | Verbs where food is the agent (e.g., melt, boil) |
ACTION_BY_TOOL | Verbs denoting tool actions (e.g., grind, beat) |
FOOD_STATE | Descriptions of food’s state (e.g., chopped, soft) |
TOOL_STATE | Descriptions of tool readiness (e.g., preheated, greased, covered) |
The knowledge-augmented and entity type-specific token classification model architecture is described in the paper Knowledge Augmentation Enhances Token Classification for Recipe Understanding.
@inproceedings{
title = {Knowledge Augmentation Enhances Token Classification for Recipe Understanding},
author = {Ibrahim, Nuhu and Stevens, Robert and Batista-Navarro, Riza},
booktitle = {EACL},
year = {2026}
}
The ReciFine, ReciFineGold and ReciFineGen datasets are described in the paper ReciFine: Finely Annotated Recipe Dataset for Controllable Recipe Generation.
@inproceedings{
title = {ReciFine: Finely Annotated Recipe Dataset for Controllable Recipe Generation},
author = {Ibrahim, Nuhu and Ravikumar, Rishi and Stevens, Robert and Batista-Navarro, Riza},
booktitle = {EACL},
year = {2026}
}