Skip to content
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

OutlinesLogitsProcessor Benchmarks #979

Closed
lapp0 opened this issue Jun 16, 2024 · 1 comment
Closed

OutlinesLogitsProcessor Benchmarks #979

lapp0 opened this issue Jun 16, 2024 · 1 comment
Labels
enhancement optimization Related to performance optimizations tests Linked to library tests

Comments

@lapp0
Copy link
Collaborator

lapp0 commented Jun 16, 2024

What behavior of the library made you think about the improvement?

In #956 I noticed some performance issues relating to a large number of allowed_tokens. We should profile how long it takes for a logits processor to augment logits:

The core performance issue with outlines.generate.regex(model, ".{200}") is the need to convert a large (~150,000 integer) list into a tensor in the logits processor

    allowed_tokens = self.fsm.get_next_instruction(self._fsm_state).tokens
    allowed_tokens = torch.tensor(allowed_tokens, device=logits.device)

To mitigate, we can create a separate issue to ensure the FSM index uses tensors of token IDs, not lists. This will result in self.fsm.get_next_instruction(self._fsm_state).tokens being a tensor of token IDs.

How would you like it to behave?

As part of our ASV benchmark test suite, we should benchmark the performance of OutlinesLogitsProcessor to ensure there aren't performance regressions, and track performance improvements.

@lapp0 lapp0 changed the title LogitsProcessor Benchmarks OutlinesLogitsProcessor Benchmarks Jun 16, 2024
@lapp0 lapp0 added tests Linked to library tests optimization Related to performance optimizations labels Jun 19, 2024
@lapp0
Copy link
Collaborator Author

lapp0 commented Jul 13, 2024

Resolved by #1013

@lapp0 lapp0 closed this as completed Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement optimization Related to performance optimizations tests Linked to library tests
Projects
None yet
Development

No branches or pull requests

1 participant