| | --- |
| | library_name: transformers |
| | tags: |
| | - text-generation-inference |
| | - meta |
| | license: fair-noncommercial-research-license |
| | language: |
| | - en |
| | base_model: |
| | - facebook/MobileLLM-R1-950M |
| | pipeline_tag: text-generation |
| | --- |
| | |
| |  |
| |
|
| | # **MobileLLM-R1-950M-Radiation** |
| |
|
| | > **MobileLLM-R1-950M-Radiation** is a reasoning-focused model based on **facebook/MobileLLM-R1-950M**, fine-tuned for **Abliterated Reasoning** and **polished token probabilities**, enhancing balanced **multilingual generation** across mathematics and general-purpose reasoning. |
| | > It specializes in **event-driven logic**, **structured analysis**, and precise probabilistic modeling—making it ideal for research, education, and lightweight deployment in constrained environments. |
| |
|
| | --- |
| |
|
| | ## **Key Features** |
| |
|
| | 1. **Abliterated Reasoning** |
| | Enhanced reasoning precision through polished token probability distributions, ensuring accurate and context-aware outputs. |
| |
|
| | 2. **Event Simulation & Logical Analysis** |
| | Models random events, probability-driven reasoning, and logical decision-making reliably. |
| |
|
| | 3. **Multilingual Mathematical & General-Purpose Problem Solving** |
| | Delivers strong performance in **math**, **probability**, and **structured multilingual tasks**, supporting global research and educational use. |
| |
|
| | 4. **Hybrid Symbolic-Probabilistic Thinking** |
| | Combines structured logic, probabilistic inference, and chain-of-thought reasoning for robust uncertainty-driven problem-solving. |
| |
|
| | 5. **Structured Output Mastery** |
| | Generates well-structured outputs in **LaTeX**, **Markdown**, **JSON**, **CSV**, and **YAML**, suitable for technical workflows and research documentation. |
| |
|
| | 6. **Optimized Lightweight Footprint** |
| | Compact **950M parameter size**, deployable on **edge devices**, **offline clusters**, and **mid-range GPUs**, balancing reasoning capability with efficiency. |
| |
|
| | --- |
| |
|
| | ## **Quickstart with Transformers🤗** |
| |
|
| | ```python |
| | !pip install transformers gradio |
| | ``` |
| |
|
| | ```python |
| | import gradio as gr |
| | from transformers import pipeline |
| | import torch |
| | |
| | # Initialize the model pipeline |
| | model_id = "prithivMLmods/MobileLLM-R1-950M-Radiation" |
| | pipe = pipeline( |
| | "text-generation", |
| | model=model_id, |
| | torch_dtype=torch.float16, |
| | device_map="auto", |
| | ) |
| | |
| | def respond(message, history): |
| | # Build prompt from history |
| | prompt = "" |
| | for user_msg, assistant_msg in history: |
| | if user_msg: |
| | prompt += f"User: {user_msg}\n" |
| | if assistant_msg: |
| | prompt += f"Assistant: {assistant_msg}\n" |
| | |
| | # Add current message |
| | prompt += f"User: {message}\nAssistant: " |
| | |
| | # Generate response with streaming |
| | streamer = pipe.tokenizer.decode |
| | |
| | # Generate tokens |
| | inputs = pipe.tokenizer(prompt, return_tensors="pt").to(pipe.model.device) |
| | |
| | with torch.no_grad(): |
| | outputs = pipe.model.generate( |
| | **inputs, |
| | max_new_tokens=10000, |
| | temperature=0.7, |
| | do_sample=True, |
| | pad_token_id=pipe.tokenizer.eos_token_id, |
| | ) |
| | |
| | # Decode the generated tokens, skipping the input tokens |
| | generated_tokens = outputs[0][inputs['input_ids'].shape[-1]:] |
| | |
| | # Stream the output token by token |
| | response_text = "" |
| | for i in range(len(generated_tokens)): |
| | token = generated_tokens[i:i+1] |
| | token_text = pipe.tokenizer.decode(token, skip_special_tokens=True) |
| | response_text += token_text |
| | yield response_text |
| | |
| | # Create the chat interface |
| | demo = gr.ChatInterface( |
| | fn=respond, |
| | examples=[ |
| | "Compute: 1-2+3-4+5- ... +99-100.", |
| | ], |
| | ) |
| | |
| | if __name__ == "__main__": |
| | demo.launch(share=True) |
| | ``` |
| |
|
| | --- |
| |
|
| | ## **Intended Use** |
| |
|
| | * Balanced multilingual reasoning and probability modeling |
| | * Event simulation, uncertainty analysis, and structured problem solving |
| | * Educational and research-focused reasoning tasks |
| | * Lightweight deployment on edge devices and offline clusters |
| | * Technical content and structured data generation |
| |
|
| | --- |
| |
|
| | ## **Limitations** |
| |
|
| | * Focused on reasoning and mathematics—less suited for creative writing |
| | * limit performance on very complex multi-step reasoning tasks |
| | * Prioritizes structured reasoning and probabilistic accuracy over conversational or emotional tone |
| | * May produce inconsistent outputs for **very long contexts** or cross-domain multi-document tasks |