Skip to content

Add CTRL contrib model port#84

Open
dhwanw wants to merge 3 commits intomainfrom
contrib/ctrl
Open

Add CTRL contrib model port#84
dhwanw wants to merge 3 commits intomainfrom
contrib/ctrl

Conversation

@dhwanw
Copy link

@dhwanw dhwanw commented Mar 18, 2026

Description

Adds NeuronX port of Salesforce CTRL to the contrib models collection.

Model Information

Field Value
Model Salesforce/ctrl
Architecture Decoder-only transformer (conditional text generation)
Parameters 1.63B
TP Degree 1
Precision BF16

Checklist

  • Model compiles successfully on Neuron
  • Token matching validated (99.06% greedy, 99.84% teacher-forced)
  • Performance profiled (59.3 tok/s)
  • README with architecture details, usage, validation results
  • Integration tests included

Folder Structure

contrib/models/ctrl/
├── README.md
├── src/
│   ├── __init__.py
│   └── modeling_ctrl.py
└── test/
    └── integration/
        └── test_model.py

Testing

  • Token Match (greedy): 99.06% (634/640 tokens)
  • Token Match (teacher-forced): 99.84%
  • Throughput: 59.3 tok/s (TP=1, BS=1, seq_len=128)

Compatibility

  • Neuron SDK: 2.22+
  • Instance: trn1.32xlarge

🤖 Generated with Claude Code

dhwanw and others added 3 commits March 16, 2026 21:52
Salesforce CTRL (1.63B params) ported to NeuronX with:
- Sinusoidal position embeddings (HF concatenated layout)
- Input embedding scaling by sqrt(d_model)
- Pre-LayerNorm with ReLU activation
- lm_head with bias

Validation: 99.84% teacher-forced match, 59.2 tok/s (TP=1, bf16, seq_len=128)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Not needed — validation instructions are in README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dhwanw dhwanw marked this pull request as ready for review March 19, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant