Skip to content

Guided Decoding #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
johnml1135 opened this issue Jul 18, 2023 · 9 comments
Open

Guided Decoding #178

johnml1135 opened this issue Jul 18, 2023 · 9 comments
Labels
research Research topics

Comments

@johnml1135
Copy link
Collaborator

From the papers out there, determine the best path forward, research and implement guided decoding. Assess the improved Bleu score and user assessment of quality. Address concerns with different types of languages with preixes and suffixes on proper names and key terms.

@johnml1135 johnml1135 added the enhancement New feature or request label Jul 18, 2023
@johnml1135 johnml1135 moved this to 🆕 New in Serval Jul 18, 2023
@johnml1135
Copy link
Collaborator Author

johnml1135 commented Jul 24, 2023

@johnml1135
Copy link
Collaborator Author

We should likely just use the huggingface implementation from 2022 (see links above) - but it may need to be modified. A few reasons:

  • It does not use alignment to guide when to add tokens
  • It cannot deal with wildcards - which is useful in many languages we deal with - but we may be able to build it on disjunctive constraints

@johnml1135 johnml1135 added this to the 1.4 NMT Dynamic Suggestions milestone Jul 27, 2023
@ddaspit
Copy link
Collaborator

ddaspit commented Aug 3, 2023

I added preliminary support for using HF constrained beam search to silnlp. From the experiments I have run, it doesn't work very well.

@johnml1135
Copy link
Collaborator Author

@ddaspit - do you know why the tests didn't go that well? Do you have the results documented somewhere? Is it "keyterms with asterisks don't work well" or "their algorithm is poor" or "certain languages don't do well with this"? Is it worth more research now, or do we want someone else to lead the charge? Do we need to add alignment data to enhance it? LILT appears to have been able to get this working well enough to integrate into their main offering - so I am inclined to believe it is possible to have it be advantageous.

@ddaspit
Copy link
Collaborator

ddaspit commented Aug 4, 2023

There definitely seems to be something wrong with the implementation in HF. Here is an issue that describes the problems I was seeing.

@ddaspit ddaspit moved this from 🆕 New to 📋 Backlog in Serval Sep 4, 2023
@johnml1135 johnml1135 removed this from Serval Dec 1, 2023
@johnml1135
Copy link
Collaborator Author

While not implemented, this may do better than the current hugging face implementation: https://arxiv.org/pdf/2112.08726.pdf - with this code: https://github.com/GXimingLu/a_star_neurologic.

@ddaspit ddaspit moved this to 🆕 New in SIL-NLP Research Jun 7, 2024
@ddaspit ddaspit removed this from the Research 2024 Q2 milestone Jun 7, 2024
@ddaspit ddaspit removed their assignment Jun 7, 2024
@ddaspit ddaspit added research Research topics and removed enhancement New feature or request labels Jun 7, 2024
@ddaspit ddaspit changed the title Research Guided Decoding Guided Decoding Jun 7, 2024
@ddaspit ddaspit moved this from 🆕 New to 📋 Backlog in SIL-NLP Research Jun 7, 2024
@johnml1135
Copy link
Collaborator Author

johnml1135 commented Feb 7, 2025

It appears that the old "constraint" decoding is not supported anymore, but rather sequence_bias and repetition_penalty in the GenerationConfig.

I strongly suspect that this new set of updates may be worth another round of research to see how well it fairs.

@johnml1135
Copy link
Collaborator Author

Actually, I took a look at sequence_bias, and it is a bit different than constrained decoding - potentially more for LLM's than NLLB - still it may be worth another look. When we checked out constrained decoding last, it was verifiably broken, and it is not due to be fixed or maintained by the huggingface team. If we want something that will work today and tomorrow, we should investigate sequence_bias.

@ddaspit
Copy link
Collaborator

ddaspit commented Feb 7, 2025

Sequence bias looks interesting. Hopefully, it works better than constrained decoding. At some point, we should update the existing code to use sequence bias instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
research Research topics
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants