Skip to content

OPTForCasualLM Support (facebook/opt Series)#7440

Closed
b8zhong wants to merge 3 commits intosgl-project:mainfrom
bzhng-development:OPTForCasualLM
Closed

OPTForCasualLM Support (facebook/opt Series)#7440
b8zhong wants to merge 3 commits intosgl-project:mainfrom
bzhng-development:OPTForCasualLM

Conversation

@b8zhong
Copy link
Copy Markdown
Collaborator

@b8zhong b8zhong commented Jun 22, 2025

Motivation

Expand support for the OPT series, this includes from opt-125m to opt-175b.

"We present Open Pretrained Transformers (OPT), a suite of decoder-only pre-trained transformers ranging from 125M to 175B parameters, which we aim to fully and responsibly share with interested researchers. We train the OPT models to roughly match the performance and sizes of the GPT-3 class of models, while also applying the latest best practices in data collection and efficient training."

Modifications

Add the required modelling code. Note that since the activation is ReLU I added it to the activation registry for it to work.

Evaluation (MMLU):

python3 bench_other.py --nsub 10 --backend vllm and python3 bench_sglang.py --nsub 10 on facebook/opt-125m:

Subject # Questions Accuracy (SGLang) Accuracy (vLLM) Absolute Difference
abstract_algebra 100 0.280 0.270 0.010
anatomy 135 0.237 0.237 0.000
astronomy 152 0.263 0.263 0.000
business_ethics 100 0.010 0.010 0.000
clinical_knowledge 265 0.211 0.208 0.003
college_biology 144 0.104 0.104 0.000
college_chemistry 100 0.230 0.230 0.000
college_computer_science 100 0.330 0.330 0.000
college_mathematics 100 0.260 0.260 0.000
college_medicine 173 0.150 0.156 0.006
Average 0.205 0.204 0.001

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @b8zhong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates the Facebook OPT series of large language models into the system. It involves adding the complete model definition and associated components, ensuring compatibility with existing infrastructure, and updating documentation to reflect the expanded model support.

Highlights

  • New Model Support: I've added comprehensive support for the Facebook OPT series of large language models, ranging from 125M to 175B parameters. This includes the full model architecture, attention mechanisms, and weight loading logic, enabling the system to efficiently run and utilize these models.
  • Activation Function Registration: The nn.ReLU activation function has been registered in the activation registry. This is a necessary step as ReLU is used within the OPT models' architecture.
  • Documentation Update: The docs/supported_models/generative_models.md file has been updated to officially list the OPT series as a newly supported generative model.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request adds support for the OPT model family, including adding ReLU to the activation registry and implementing the OPT model architecture in python/sglang/srt/models/opt.py. The changes seem well-structured and include performance evaluation. A suggestion was made to improve the documentation.

Comment thread python/sglang/srt/layers/activation.py
Comment thread python/sglang/srt/models/opt.py
@b8zhong
Copy link
Copy Markdown
Collaborator Author

b8zhong commented Sep 20, 2025

#10165

@b8zhong b8zhong closed this Sep 20, 2025
@b8zhong b8zhong deleted the OPTForCasualLM branch October 4, 2025 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant