CoolFace
Modelpublic

khawarizmiai/Khawarizmi-SPI-MLP-8B

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes10downloads
Model Card

Khawarizmi-SPI-MLP-8B

Model Overview

Khawarizmi-SPI-MLP-8B is a hybrid language model developed by Khawarizmi AI, leveraging the innovative Selective Parameter Interpolation on MLP Layers (SPI-MLP) algorithm. This model ingeniously combines the robust linguistic capabilities of Qwen3-8B with the advanced reasoning patterns of DeepSeek-R1. The fusion is specifically applied to the Multi-Layer Perceptron (MLP) layers, with a composition of 60% DeepSeek and 40% Qwen, while critically preserving Qwen's original attention and normalization layers. This unique architectural approach aims to deliver a model highly proficient in complex reasoning, code generation, and multilingual tasks, with a particular emphasis on Arabic-English understanding.

Technical Specifications

Based on the config.json and generation_config.json files, the Khawarizmi-SPI-MLP-8B model exhibits the following technical characteristics:

Architecture and Configuration

ParameterValueDescription
architectures["Qwen3ForCausalLM"]Indicates the model architecture is a Causal Language Model based on Qwen3.
attention_biasfalseSpecifies if attention bias is used.
attention_dropout0.0Dropout rate for attention layers.
bos_token_id151643Beginning-of-sequence token ID.
eos_token_id[151645, 151643]End-of-sequence token IDs.
head_dim128Dimension of each attention head.
hidden_act"silu"Activation function used in hidden layers.
hidden_size4096Dimensionality of the encoder layers and the pooler layer.
initializer_range0.02Standard deviation of the truncated normal initializer.
intermediate_size12288Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
max_position_embeddings40960The maximum sequence length that this model might ever be used with.
max_window_layers36Maximum number of layers for windowed attention.
model_type"qwen3"The type of the model, indicating its base family.
num_attention_heads32Number of attention heads for each attention layer in the Transformer encoder.
num_hidden_layers36Number of hidden layers in the Transformer encoder.
num_key_value_heads8Number of key-value heads.
rms_norm_eps1e-06The epsilon used by the RMS normalization layers.
rope_scalingnullRoPE scaling configuration.
rope_theta1000000RoPE theta value.
sliding_windownullSliding window configuration.
tie_word_embeddingsfalseWhether to tie the word embeddings with the output layer.
torch_dtype"bfloat16"The data type used for the model parameters.
transformers_version"4.51.0"The version of the Hugging Face Transformers library used.
use_cachetrueWhether or not the model should return the last key/values attentions (not used by all models).
use_sliding_windowfalseWhether to use sliding window attention.
vocab_size151936Vocabulary size of the model.

Generation Configuration

ParameterValueDescription
do_sampletrueWhether or not to use sampling; use greedy decoding otherwise.
pad_token_id151643Padding token ID.
temperature0.6The value used to modulate the next token probabilities.
top_k20The number of highest probability vocabulary tokens to keep for top-k-filtering.
top_p0.95If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation.
transformers_version"4.51.0"The version of the Hugging Face Transformers library used for generation.

Merge Strategy

The Khawarizmi-SPI-MLP-8B model employs a sophisticated Selective Parameter Interpolation (SPI) strategy specifically targeting the MLP layers. This method allows for a nuanced integration of two distinct models: Qwen3-8B and DeepSeek-R1. The core idea is to selectively interpolate parameters within the MLP layers, achieving a blend that harnesses the strengths of both base models while maintaining the structural integrity of Qwen's attention and normalization layers. This approach ensures that the model benefits from DeepSeek-R1's reasoning capabilities without compromising Qwen3-8B's established linguistic prowess.

For each weight tensor $Wk$: $$ Wk^{\text{merged}} = \begin{cases} 0.6 \cdot Wk^{\text{(DeepSeek)}} + 0.4 \cdot Wk^{\text{(Qwen)}} & \text{if "mlp" in } k \\ W_k^{\text{(Qwen)}} & \text{otherwise} \end{cases} $$

How to Use

To utilize the Khawarizmi-SPI-MLP-8B model, follow the instructions below. Ensure you have the necessary dependencies installed.

Installation

First, install the required Python packages using pip:

bash
pip install -q transformers accelerate safetensors sentencepiece torch

Model Loading and Inference

Once the dependencies are installed, you can load the model and tokenizer using the Hugging Face transformers library and perform text generation:

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "khawarizmiai/Khawarizmi-SPI-MLP-8B"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto",
    trust_remote_code=True
)

# Example usage (you can expand on this with more detailed examples)
# prompt = "Write a short story about a robot learning to feel."
# input_ids = tokenizer(prompt, return_tensors="pt").to(model.device)
# generated_ids = model.generate(**input_ids, max_new_tokens=100)
# print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))

Evaluation

While specific benchmark results for Khawarizmi-SPI-MLP-8B are not detailed in the provided files, the model's design, which integrates DeepSeek-R1's reasoning patterns, suggests a focus on improving performance in areas such as:

  • —Reasoning: Enhanced logical reasoning and problem-solving capabilities.
  • —Code Generation: Improved ability to generate accurate and efficient code.
  • —Multilingual Tasks: Stronger performance in understanding and generating text in multiple languages, particularly Arabic and English.

Further evaluations would be necessary to quantify the model's performance across standard benchmarks (e.g., MMLU, GSM8K, HumanEval) to provide a comprehensive understanding of its capabilities.

Limitations

As with all large language models, Khawarizmi-SPI-MLP-8B may exhibit certain limitations inherent to current AI technology:

  • —Hallucination: The model might generate factually incorrect or nonsensical information.
  • —Bias: Potential biases present in the training data could be reflected in the model's outputs.
  • —Lack of Common Sense: The model may occasionally lack human-like common sense reasoning, leading to unexpected or illogical responses.

Users are advised to exercise caution and verify critical information generated by the model.

License

The licensing information for Khawarizmi-SPI-MLP-8B is available in the LICENSE file within the repository. Users should refer to this file for detailed terms and conditions regarding the use and distribution of the model.

Citation

If you find Khawarizmi-SPI-MLP-8B useful in your research or applications, please consider citing it. A formal citation will be provided upon publication of the research paper detailing the SPI-MLP algorithm and the model's development.

Acknowledgements

We extend our gratitude to the open-source community and the developers of Qwen3-8B and DeepSeek-R1, whose foundational work has been instrumental in the creation of Khawarizmi-SPI-MLP-8B. Their contributions continue to drive innovation in the field of artificial intelligence.

Contact

For inquiries, collaborations, or feedback regarding Khawarizmi-SPI-MLP-8B, please reach out to the Khawarizmi AI team through the Hugging Face platform or official channels as they become available.

Disclaimer

Khawarizmi-SPI-MLP-8B is provided for research and experimental purposes. While efforts have been made to ensure its quality and performance, Khawarizmi AI does not guarantee its suitability for any specific application. Users are responsible for assessing the model's outputs and ensuring compliance with all applicable laws and regulations.

live