Skip to content

Conversation

@jacobkahn
Copy link
Contributor

@jacobkahn jacobkahn commented Sep 24, 2025

Purpose

Code World Model (CWM) in this collection https://huggingface.co/collections/facebook/cwm-68acbc3eb02570bd89b3aae8 need to be mapped before the Transformers implementation is complete, else we'll have working VLLM mappings that break in HuggingFace Transformers.

HuggingFace Transformers work is WIP -- this will ensure that we can send a CwmForCausalLM config to HuggingFace repos without enabling checkpoint use in Transformers, where it's currently supported.

It also prepares us to eventually use the CwmForCausalLM class once released.

Test Plan

Local env build + test with HF checkpoints from https://huggingface.co/collections/facebook/cwm-68acbc3eb02570bd89b3aae8 that have had their config.json modified to use CwmForCausalLM

Test Result

vllm serve . --tensor-parallel-size 8

(base) ➜  ~ curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "facebook/cwm-sft",
    "messages": [
      {"role": "system", "content": "You are a helpful AI assistant. You always reason before responding, using the following format:\n<think>\nyour internal reasoning\n</think>\nyour external response"},
      {"role": "user", "content": "Write a haiku about recursion in programming."}
    ],
    "chat_template_kwargs": {"enable_thinking": true, "preserve_previous_think": true}
  }'
{"id":"chatcmpl-f83c0580c0d64f438a8312b8ca9cc274","object":"chat.completion","created":1758746378,"model":"facebook/cwm-sft","choices":[{"index":0,"message":{"role":"assistant","content":"<think>\nRecursion refers to a function that calls itself in order to solve a problem. It's a fundamental concept in programming that allows for elegant solutions to complex problems. The idea of a function calling itself can be represented in a haiku, which is a traditional form of Japanese poetry consisting of three lines with a syllable count of 5, 7, and 5. The haiku should capture the essence of recursion, conveying the idea of a function looping back on itself to achieve its goal.\n\nTo start, I'll consider the key elements of recursion: the function calling itself, the base case that stops the recursion, and the problem being solved through this recursive process. I'll use imagery and language that evoke these concepts. For example, the phrase \"looping back\" could suggest the idea of a function calling itself, while \"endless depth\" could represent the recursive process. Meanwhile, \"problem solved\" would convey the outcome of the recursion.\n\nNext, I'll select specific words and phrases that fit within the traditional haiku syllable count of 5, 7, and 5. The words should be chosen for their ability to convey the intended meaning and to contribute to the overall rhythm and flow of the haiku. \n\nI'll aim to create a haiku that not only describes recursion in a way that's accessible to programmers and non-programmers alike but also does justice to the traditional poetic form. The haiku should be concise, yet evocative, painting a picture in the reader's mind that captures the essence of recursion.\n</think>\nEndless loops within\nFunction calls itself back\nProblem solved, endless","refusal":null,"annotations":null,"audio":null,"function_call":null,"tool_calls":[],"reasoning_content":null},"logprobs":null,"finish_reason":"stop","stop_reason":128009}],"service_tier":null,"system_fingerprint":null,"usage":{"prompt_tokens":55,"total_tokens":389,"completion_tokens":334,"prompt_tokens_details":null},"prompt_logprobs":null,"kv_transfer_params":null}%

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Code World Model (CWM) in this collection https://huggingface.co/collections/facebook/cwm-68acbc3eb02570bd89b3aae8 need to be mapped before the Transformers implementation is complete, else we'll have working VLLM mappings that break in HuggingFace.

Signed-off-by: Jacob Kahn <[email protected]>
@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@mergify mergify bot added llama Related to Llama models new-model Requests to new models labels Sep 24, 2025
Copy link
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

This pull request adds a mapping for the CwmForCausalLM architecture to vLLM's Llama implementation, which is a good step towards supporting Code World Models. The change is straightforward. However, a crucial update to the test registry is missing. The test_hf_registry_coverage test will fail because CwmForCausalLM has not been added to the HF_EXAMPLE_MODELS in tests/models/registry.py. This update is required to ensure CI passes and the new model is properly tracked in tests.

Copy link
Collaborator

@houseroad houseroad left a comment

Choose a reason for hiding this comment

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

Looks legit to me, I will let @ywang96 to give a quick pass as well.

Co-authored-by: Roger Wang <[email protected]>
Signed-off-by: Jacob Kahn <[email protected]>
@ywang96 ywang96 added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 24, 2025
@ywang96 ywang96 enabled auto-merge (squash) September 24, 2025 23:36
@houseroad houseroad added this to the v0.11.0 milestone Sep 24, 2025
@ywang96 ywang96 merged commit bc092ea into vllm-project:main Sep 25, 2025
48 checks passed
Zhuul pushed a commit to Zhuul/vllm that referenced this pull request Sep 26, 2025
yewentao256 pushed a commit that referenced this pull request Oct 3, 2025
Signed-off-by: Jacob Kahn <[email protected]>
Co-authored-by: Roger Wang <[email protected]>
Signed-off-by: yewentao256 <[email protected]>
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 10, 2025
Signed-off-by: Jacob Kahn <[email protected]>
Co-authored-by: Roger Wang <[email protected]>
Signed-off-by: xuebwang-amd <[email protected]>
choprahetarth pushed a commit to Tandemn-Labs/vllm that referenced this pull request Oct 11, 2025
lywa1998 pushed a commit to lywa1998/vllm that referenced this pull request Oct 20, 2025
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Oct 24, 2025
Signed-off-by: Jacob Kahn <[email protected]>
Co-authored-by: Roger Wang <[email protected]>
Signed-off-by: xuebwang-amd <[email protected]>
rtourgeman pushed a commit to rtourgeman/vllm that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llama Related to Llama models new-model Requests to new models ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants