huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
134.32k stars 26.86k forks source link

[generation] Exact Search Decoding #28356

Open Saibo-creator opened 10 months ago

Saibo-creator commented 10 months ago

Feature request

Hello Hugging Face Transformers Team,

I am writing to suggest a feature of an "exact search" decoding method, suggested in https://aclanthology.org/D19-1331/

Greedy search and beam search are both "greedy" in the sense that they are not guaranteed to find the global most likely generation.

An exact search is a DFS-based search method with branch pruning that can guarantee to return the global optimal.

The original implementation is located here: DFS.py in SGNMT. Just need to adapt it to transformers generation module.

Motivation

It has a strong research value because it returns the global optimal. However, it may not be very practical for general users because it may be very slow.

Your contribution

I could take the job to submit a PR if this is interesting for you. Otherwise, I can work on it as a fork under my account.

ArthurZucker commented 10 months ago

FYI @gante

gante commented 9 months ago

Hi @Saibo-creator 👋

I'll do my usual bargain! I haven't seen demand for this feature, so my current decision is negative. However, if this comment reaches 10 reactions within a 3-month time spawn, I'll revisit this decision -- it means the community is interested in the feature 🙌

(whoever does the 10th reaction, please ping me)