Instructions to use abdohisham12/fine_tuned_deepseek-math-7b_for_smad with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abdohisham12/fine_tuned_deepseek-math-7b_for_smad with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="abdohisham12/fine_tuned_deepseek-math-7b_for_smad") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("abdohisham12/fine_tuned_deepseek-math-7b_for_smad", dtype="auto") - PEFT
How to use abdohisham12/fine_tuned_deepseek-math-7b_for_smad with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use abdohisham12/fine_tuned_deepseek-math-7b_for_smad with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "abdohisham12/fine_tuned_deepseek-math-7b_for_smad" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdohisham12/fine_tuned_deepseek-math-7b_for_smad", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/abdohisham12/fine_tuned_deepseek-math-7b_for_smad
- SGLang
How to use abdohisham12/fine_tuned_deepseek-math-7b_for_smad with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "abdohisham12/fine_tuned_deepseek-math-7b_for_smad" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdohisham12/fine_tuned_deepseek-math-7b_for_smad", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "abdohisham12/fine_tuned_deepseek-math-7b_for_smad" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "abdohisham12/fine_tuned_deepseek-math-7b_for_smad", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use abdohisham12/fine_tuned_deepseek-math-7b_for_smad with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for abdohisham12/fine_tuned_deepseek-math-7b_for_smad to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for abdohisham12/fine_tuned_deepseek-math-7b_for_smad to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for abdohisham12/fine_tuned_deepseek-math-7b_for_smad to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="abdohisham12/fine_tuned_deepseek-math-7b_for_smad", max_seq_length=2048, ) - Docker Model Runner
How to use abdohisham12/fine_tuned_deepseek-math-7b_for_smad with Docker Model Runner:
docker model run hf.co/abdohisham12/fine_tuned_deepseek-math-7b_for_smad
DeepSeek-Math-7B Fine-Tuned for Space Mission Analysis & Design
A domain-adapted large language model for automated orbital mechanics computation and spacecraft subsystem analysis
Table of Contents
- Overview
- Motivation & Research Context
- Architecture & Training
- Dataset
- Training Results
- Usage
- Capabilities
- Limitations
- System Architecture
- References
- Author
- Citation
Overview
This model is a LoRA-adapted version of DeepSeek-Math-7B-Instruct, fine-tuned specifically for space mission analysis and design (SMAD) tasks. It serves as the computational engine within a larger Retrieval-Augmented Generation (RAG) pipeline that automates the traditionally manual, 12-month spacecraft design process.
The model produces step-by-step solutions with LaTeX-formatted equations, following the methodologies established in standard aerospace engineering references such as Space Mission Analysis and Design (Wertz & Larson) and Orbital Mechanics for Engineering Students (Curtis).
Training dataset: abdohisham12/orbital-mechanics-instruct-32
| Feature | Description |
|---|---|
| Domain | Orbital mechanics, astrodynamics, space environment analysis |
| Output Format | Structured, numbered steps with LaTeX equations and physical unit tracking |
| Trainable Parameters | 37.5M / 7B (0.54%) via LoRA |
| Integration | Designed for RAG pipeline with Gemini-powered context filtering |
| Deployment | LabVIEW-based ground software via local API |
Motivation & Research Context
Space mission analysis and design is a multi-disciplinary engineering process that typically requires:
- 12+ months of analysis by teams of MSc/PhD-level engineers
- Expertise across 7+ subsystems (orbit, propulsion, ADCS, power, thermal, comms, payload)
- Iterative computation with domain-specific equations and physical constraints
This project investigates whether RAG-augmented LLMs can accelerate this process by:
- Automatically retrieving relevant literature from NASA NTRS, Crossref, and OpenAlex
- Embedding domain textbooks for semantic retrieval (SMAD, Optimal Space Trajectories, etc.)
- Using a fine-tuned LLM to perform accurate orbital mechanics computations
- Generating structured subsystem analysis reports
This model is the LLM component of that pipeline, fine-tuned to produce accurate, traceable, equation-driven solutions in the specific format required by mission design engineers.
Architecture & Training
Base Model Selection
DeepSeek-Math-7B-Instruct was selected for its:
- Pre-existing strength in mathematical reasoning and symbolic computation
- Instruction-following capability suitable for structured Q&A
- 7B parameter size — tractable for fine-tuning on a single GPU
LoRA Configuration
model = FastLanguageModel.get_peft_model(
model,
r=16, # Low-rank dimension
target_modules=[
"q_proj", "k_proj", "v_proj", # Attention projections
"o_proj",
"gate_proj", "up_proj", # MLP projections
"down_proj"
],
lora_alpha=16, # Scaling factor (alpha/r = 1.0)
lora_dropout=0, # No dropout
bias="none", # No bias training
use_gradient_checkpointing="unsloth" # Memory-optimized checkpointing
)
| Parameter | Value | Rationale |
|---|---|---|
Rank (r) |
16 | Balanced capacity vs. efficiency for domain adaptation |
| Alpha | 16 | Unit scaling ratio (alpha/r = 1.0) |
| Target modules | All attention + MLP | Full model adaptation across all 30 transformer layers |
| Trainable params | 37,478,400 (0.54%) | Efficient fine-tuning within 16 GB VRAM |
| Gradient checkpointing | Unsloth-optimized | Reduced peak memory with smart gradient offloading |
Training Hyperparameters
| Setting | Value |
|---|---|
| Hardware | NVIDIA Tesla P100-PCIe-16GB |
| Framework | Unsloth 2025.6.12 + Transformers 4.51.3 |
| Precision | fp16 |
| Batch size (per device) | 1 |
| Gradient accumulation | 8 steps |
| Effective batch size | 8 |
| Max training steps | 1,000 |
| Epochs | 250 |
| Optimizer | AdamW |
| Max sequence length | 2,048 tokens |
| Checkpointing | Every 50 steps |
Dataset
Full dataset: abdohisham12/orbital-mechanics-instruct-32
A curated dataset of 32 expert-crafted prompt-completion pairs covering core orbital mechanics and mission design problems. Each example was hand-written to follow the solution methodology of standard aerospace textbooks.
Topic Distribution
| Category | Count | Description |
|---|---|---|
| State Vector to Classical Orbital Elements | 6 | Position/velocity vectors to (a, e, i, Omega, omega, nu) |
| Interplanetary Transfers (Mars) | 10 | Hohmann transfer, V-infinity, Delta-V budget, TOF, phase angles |
| Hohmann Transfer (Earth orbit) | 3 | LEO to GEO, transfer Delta-V, time of flight |
| Circular Orbit Fundamentals | 3 | Period, velocity, radius calculations |
| Orbital Maneuvers | 2 | Plane changes, rendezvous timing |
| Interplanetary (Venus, Jupiter) | 3 | Multi-target capture Delta-V, patched conics |
| Space Environment / Thermal | 1 | Stefan-Boltzmann re-entry analysis |
| Conceptual | 1 | Physical interpretation of V-infinity |
| Total | 32 |
Equations Covered
| Equation | Formula | Application |
|---|---|---|
| Vis-viva | epsilon = V^2/2 - mu/R | Specific mechanical energy |
| Semimajor axis | a = -mu/(2*epsilon) | Orbit sizing |
| Eccentricity vector | e = (1/mu)[(V^2 - mu/R)R - (R.V)V] | Orbit shape determination |
| Conic equation | r = a(1-e^2)/(1+e*cos(nu)) | Radius at true anomaly |
| Kepler's third law | T = 2pisqrt(a^3/mu) | Orbital period |
| Hohmann TOF | TOF = pi*sqrt(a^3/mu) | Transfer time |
| Hyperbolic escape | V_hyp = sqrt(V_park^2 + V_inf^2) | Departure/capture velocity |
| Plane change | Delta-V = 2V*sin(theta/2) | Inclination maneuver |
| Stefan-Boltzmann | T = (E/(epsilon*sigma))^(1/4) | Thermal analysis |
Prompt Diversity
Two dataset variants were created to improve generalization:
- JSON version — consistent prompt phrasing (baseline)
- JSONL version — rephrased prompts with varied wording
JSON: "Space Operations Officers at Air Force Space Command have given you..."
JSONL: "you have a set of position and velocity vectors for a satellite..."
JSONL: "you are responsible for a Space Operation and have been given..."
JSONL: "You have a set of position and velocity vectors for a NASA satellite..."
Training Results
Loss Curve
The model showed rapid convergence, with the training loss dropping 98.8% across 400 steps:
| Step | Epoch | Training Loss | Change |
|---|---|---|---|
| 50 | 12.5 | 0.9121 | — |
| 100 | 25.0 | 0.3098 | -66.0% |
| 150 | 37.5 | 0.0528 | -83.0% |
| 200 | 50.0 | 0.0141 | -73.3% |
| 250 | 62.5 | 0.0117 | -17.0% |
| 300 | 75.0 | 0.0111 | -5.1% |
| 350 | 87.5 | 0.0109 | -1.8% |
| 400 | 100.0 | 0.0107 | -1.8% |
Loss progression:
0.912 ──▶ 0.310 ──▶ 0.053 ──▶ 0.014 ──▶ 0.012 ──▶ 0.011 ──▶ 0.011 ──▶ 0.011
| | | |
Learning Structure Fine-grain Converged
basics captured fitting (plateau)
The model effectively converged at step ~200 (epoch 50), with diminishing returns beyond that point. This demonstrates efficient adaptation — the LoRA adapters captured the domain-specific solution patterns within a small number of gradient updates.
Usage
Quick Start
from unsloth import FastLanguageModel
import torch
# Load the fine-tuned model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="abdohisham12/fine_tuned_deepseek-math-7b_for_smad",
max_seq_length=2048,
dtype=torch.float16,
device_map="auto"
)
model.eval()
# Define your orbital mechanics problem
prompt = """A remote-sensing satellite has an orbit with perigee radius
of 7000 km and apogee radius of 10,000 km. What is its altitude when
the true anomaly is 90 degrees?"""
# Generate solution
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.1,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Using with Standard Transformers + PEFT
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"deepseek-ai/deepseek-math-7b-instruct",
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(
"deepseek-ai/deepseek-math-7b-instruct"
)
# Load LoRA adapters
model = PeftModel.from_pretrained(
base_model,
"abdohisham12/fine_tuned_deepseek-math-7b_for_smad"
)
model.eval()
Capabilities
The model can solve problems across these categories:
Orbital Element Determination
- State vector (R, V) to all 6 Classical Orbital Elements (a, e, i, Omega, omega, nu)
- Quadrant ambiguity resolution with physical reasoning
Orbit Transfer Design
- Hohmann transfer Delta-V and time-of-flight calculations
- LEO to GEO transfer analysis
- Interplanetary transfer orbit sizing
Interplanetary Mission Analysis
- Patched conic trajectory decomposition
- Hyperbolic excess velocity (V-infinity) computation
- Departure and capture Delta-V budgets
- Launch window and phase angle analysis
Orbital Maneuvers
- Simple plane change Delta-V
- Co-orbital rendezvous timing
- Mission total Delta-V budgeting
Space Environment
- Thermal equilibrium calculations
- Stefan-Boltzmann radiative analysis
Limitations
| Limitation | Detail |
|---|---|
| Dataset size | Trained on 32 curated examples — may not generalize to all problem formulations |
| Numerical precision | Should be treated as preliminary analysis; always verify critical values independently |
| Scope | Focused on orbit and space environment subsystems; limited coverage of propulsion, ADCS, comms, power |
| Problem types | Primarily two-body Keplerian mechanics; no perturbation modeling or n-body dynamics |
| No unit validation | Does not verify dimensional consistency of inputs |
| Checkpoint | Trained to step 400/1000; further training may yield marginal improvements |
Full System Architecture
This model is one component of a larger automated mission design system:
SMAD-AI Pipeline
================================================================
User Input (LabVIEW) Reference Search
- Launch Site -----> - NASA NTRS
- Destination - Crossref
- Objective - OpenAlex
- Launch Date - Wikipedia
| |
v v
PDF Upload & Pre-Embedded
Embedding References
- GitHub - SMAD (2005)
- Google Drive - Optimal Trajectories
- Local files - Curtis (4th ed.)
| - Sellers
| |
+------------+------------+
|
v
Gemini 2.5 Pro
Context Filter
& Prompt Generator
|
v
+==========================================+
| * THIS MODEL * |
| DeepSeek-Math-7B + LoRA |
| Fine-tuned for SMAD |
| |
| Generates per-subsystem analysis: |
| - Orbit & Launch |
| - Space Environment |
| - Payload, ADCS, Comms |
| - Power, Propulsion |
+==========================================+
|
v
Report Formatter -----> LabVIEW Display
(Jinja2 templates)
References
Textbooks (Knowledge Base)
- Wertz, J.R., Everett, D.F., & Puschell, J.J. (2011). Space Mission Engineering: The New SMAD. Microcosm Press.
- Curtis, H.D. (2020). Orbital Mechanics for Engineering Students (4th ed.). Butterworth-Heinemann.
- Jean Pierre Marec. (1979). Optimal Space Trajectories. Elsevier.
- Sellers, J.J. (2005). Understanding Space: An Introduction to Astronautics. McGraw-Hill.
Methods
- Hu, E.J., et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models. arXiv:2106.09685.
- Zheng, S., et al. (2024). DeepSeek-Math: Pushing the Limits of Mathematical Reasoning. arXiv.
- Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS.
APIs Used for Reference Retrieval
Author
Abdulrahman Hisham
- Aerospace & AI Engineering
- GitHub
- Hugging Face
- abdulrahmanhisham130_sd@nsst.bsu.edu.eg
Citation
If you use this model in your research, please cite:
@misc{hisham2025smadai,
title={Application of RAG Models in Automating Space Mission Analysis and Design},
author={Abdulrahman Hisham},
year={2025},
url={https://huggingface.co/abdohisham12/fine_tuned_deepseek-math-7b_for_smad},
note={LoRA-adapted DeepSeek-Math-7B for orbital mechanics and spacecraft design}
}
Part of a graduation research project exploring AI-assisted spacecraft design automation
Model tree for abdohisham12/fine_tuned_deepseek-math-7b_for_smad
Base model
deepseek-ai/deepseek-math-7b-instruct