logits-processor-zoo  by NVIDIA

Logits processor collection for customizing LLM behavior

Created 10 months ago
356 stars

Top 78.3% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This repository provides a collection of LogitsProcessor implementations designed to fine-tune the behavior of Large Language Models (LLMs) for specific tasks beyond basic text generation. It targets developers and researchers working with LLMs who need to enforce constraints, guide output format, or influence response content. The primary benefit is enabling more controlled and predictable LLM outputs for applications like Q&A, code generation, and structured data extraction.

How It Works

The library offers specialized LogitsProcessor classes that intercept and modify the probability distribution of the next token during LLM generation. This is achieved by integrating with popular LLM inference frameworks like transformers and vLLM. For instance, GenLengthLogitsProcessor adjusts EOS token probabilities to control output length, while ForceLastPhraseLogitsProcessor ensures specific phrases precede the end of generation, useful for structured outputs.

Quick Start & Requirements

  • Install via pip: pip install logits-processor-zoo
  • Supported frameworks: transformers, vLLM, TensorRT-LLM.
  • Example usage with vLLM is provided in the README.

Highlighted Details

  • GenLengthLogitsProcessor: Encourages or discourages shorter answers by adjusting EOS token likelihood.
  • CiteFromPromptLogitsProcessor: Modifies token likelihood based on prompt content to encourage or discourage similarity.
  • ForceLastPhraseLogitsProcessor: Guarantees specific phrases (e.g., "References:\n") appear before generation completion.
  • MultipleChoiceLogitsProcessor: Guides LLMs to select specific options for multiple-choice questions.
  • TriggerPhraseLogitsProcessor: Forces the LLM to generate a specific phrase after encountering a trigger token.

Maintenance & Community

The project is maintained by NVIDIA. Further community engagement details are not explicitly provided in the README.

Licensing & Compatibility

The repository is released under an unspecified license. Compatibility for commercial use or closed-source linking is not detailed.

Limitations & Caveats

The README does not specify the exact license, which may impact commercial adoption. Detailed compatibility notes for all supported frameworks and versions are not provided.

Health Check
Last Commit

2 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
1
Star History
16 stars in the last 30 days

Explore Similar Projects

Starred by Yineng Zhang Yineng Zhang(Inference Lead at SGLang; Research Scientist at Together AI), Stas Bekman Stas Bekman(Author of "Machine Learning Engineering Open Book"; Research Engineer at Snowflake), and
3 more.

prompt-lookup-decoding by apoorvumang

0.2%
566
Decoding method for faster LLM generation
Created 1 year ago
Updated 1 year ago
Starred by Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera), Jason Knight Jason Knight(Director AI Compilers at NVIDIA; Cofounder of OctoML), and
1 more.

blt by facebookresearch

0.1%
2k
Code for Byte Latent Transformer research paper
Created 9 months ago
Updated 3 months ago
Starred by Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
5 more.

streaming-llm by mit-han-lab

0.1%
7k
Framework for efficient LLM streaming
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.