Open kcarnold opened 3 years ago
Has anyone working on this yet?
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
If no one else beats me to it, I may tackle this mid-summer. No promises.
@kcarnold any update?
There is another recent paper on constrained decoding with complex constraints (fairseq only has positive constraints): NeuroLogic Decoding: (Un)supervised Neural Text Generation with Predicate Logic Constraints
fairseq has an implementation of unordered and ordered multi-token constraints: see their PR and example.
This is more advanced than the single-token constraints that have been occasionally requested here mainly due to the bookkeeping involved; see the papers referenced in the fairseq PR.
Has anyone looked into porting this feature? fairseq's constraint tracking logic looks to be well-factored and could probably be adopted verbatim, license permitting. The beam search modifications (fairseq implementation) may be able to be implemented as a
LogitsProcessor
, or maybe even just aprefix_allowed_tokens_fn
, but the papers propose some additional logic around making sure that a partial constraint stays in the beam; I'm not sure whether those hooks are sufficient to implement that logic (or how essential it is to the functionality).(I've found one related issue.)