Open
Conversation
Ternary-weight Llama variant (microsoft/BitNet-b1.58-2B-4T) with sub-norm fusion, relu² activation, and TP-aware unit RMSNorm. Validated at 70.9% greedy / 97.2% teacher-forced match on TP=2. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use consistent CE/TG column table format across all contrib models. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
NeuronX Distributed Inference port of microsoft/BitNet-b1.58-2B-4T, a 2B-parameter Llama-variant with ternary quantized weights (1.58 bits per weight). Key implementation challenges include ternary weight unpacking (packed uint8 with 4 values per byte, values -1/0/+1), sub-norm fusion (attn_sub_norm and ffn_sub_norm fused into following linear layers), ReLU squared activation, and TP-aware unit RMSNorm.
Model Information
Model Name: BitNet-b1.58-2B-4T
Model Architecture: Decoder-only transformer (Llama variant) with ternary quantized weights -- 30 layers, 20 Q heads / 5 KV heads (GQA), RoPE (theta=500k), ReLU squared activation, sub-norm fusion, tied embeddings
Purpose: Efficient text generation with ternary weight quantization (1.58 bits/weight)
Checklist
Required Components
test/integration/test_model.py)src/)Optional Components
Folder Structure
Testing
Model was compiled and tested with TP=2, batch_size=1, seq_len=256, bfloat16 on trn1.32xlarge.
Test Results:
Compatibility
Tested with:
Additional Information
convert_hf_to_neuron_state_dictand scaled by per-tensorweight_scale.attn_sub_norm(before o_proj) andffn_sub_norm(before down_proj) have their gamma fused into the following linear layer's weights. At runtime,_TPAwareUnitRMSNormapplies unit RMSNorm with TP-aware all-reduce.relu2(ReLU(x)^2) instead of SiLU/SwiGLU.num_kv_heads % tp_degree != 0, KV heads are replicated viarepeat_interleavefor CONVERT_TO_MHA compatibility.Related Issues
N/A
vLLM Integration
By submitting this PR, I confirm that: