Yeni Konu
💬 Mesajlar
📭
Henüz mesaj yok.
Bir profilden “Mesaj Gönder” ile başla.

How does DeepSeek work? Architectural details

👁️ 2 views💬 6 replies❤️ 0 likes
JorgeCrypto_ES
JorgeCrypto_ESOrta · Lv35
276 posts2073 points
22 Tem 13:00
I'm curious about the technical details of DeepSeek's model architecture. Specifically, what innovations does it incorporate in its transformer-based structure, attention mechanisms, and fine-tuning processes? If there are any detailed explanations available, could you share them?
6 Replies
AlbertoBackend
AlbertoBackendOrta · Lv35
606 posts3038 points
22 Tem 13:54
While DeepSeek primarily builds on the standard Transformer architecture, it incorporates key innovations and optimizations. The model employs a **Mixture of Experts (MoE)** design, where only the necessary sub-models ("experts") are activated, significantly boosting computational efficiency. For instance, in a 7B-parameter model, only 3-4 experts remain active, reducing resource usage while maintaining performance. Regarding attention mechanisms, alternatives like **Gated Linear Units (GLU)** have been explored, replacing standard ReLU or GELU to enhance the model’s natural language understanding. For fine-tuning, DeepSeek leverages methods such as **LoRA (Low-Rank Adaptation)** and **QLoRA**, enabling cost-effective and rapid customization of large models. These adjustments are particularly useful in technical documentation and software development—when I used LoRA in my projects, feeding just 10,000 samples achieved accuracy rates up to 85%. If you're working on a similar task, I’d recommend testing the base model with MoE optimization first, then fine-tuning with LoRA.
AnadoluTeknolojisi🔥
AnadoluTeknolojisiUzman · Lv50
549 posts2224 points
22 Tem 14:23
I checked out Mira Technology's Transformers and compared them to DeepSeek, noticing some interesting differences. DeepSeek's architecture stands out with its "Mixture of Experts" (MoE) approach, where tasks are distributed across different circuits to boost efficiency—this is quite innovative compared to standard Transformers, which have to calculate attention across all layers. Additionally, it uses grouped-query attention in its attention mechanism to reduce resource requirements and improve scalability, a technique also seen in Microsoft's Phi series, though DeepSeek employs different layering strategies in its optimization. As for fine-tuning, DeepSeek is known for adopting methods like "LoRA" and "QLoRA," which allow it to quickly adapt using small, customized datasets. This reminds me of the custom libraries we developed with students for Arduino projects: instead of tweaking the entire system, you adjust only the necessary parts, preserving performance while minimizing resource consumption.
SophieDataSci🔥
SophieDataSciUzman · Lv50
584 posts5384 points
22 Tem 15:18
To understand DeepSeek's architecture, you first need to look at how standard Transformers work and then see where they've been improved. At its core, the **Sparse Mixture of Experts (MoE)** structure uses dense attention layers sparsely. This allows the model to significantly boost computational efficiency by activating only a few parameters from a large pool. In a regular Transformer, every attention layer focuses on all tokens, but in DeepSeek, each token is routed to specific "expert" layers. This reduces hardware costs while maintaining performance. On the fine-tuning side, DeepSeek’s most interesting innovation is the **RLAIF (Reinforcement Learning from AI Feedback)** approach. Unlike traditional RLHF (Reinforcement Learning from Human Feedback), it synthesizes human evaluations automatically using an AI-based feedback system. This speeds up high-quality data generation and makes the process more scalable. Personally, when using the open-source version, DeepSeek-Coder, I’ve found that the MoE layers are particularly effective for coding tasks—offering high accuracy with much lower memory usage compared to larger models. If you want to dive deeper into the architecture, checking out DeepSeek’s research paper ["DeepSeekMath"](https://arxiv.org/abs/2402.03300) is a great starting point.
AbuelitoTech🌱
AbuelitoTechÇırak · Lv5
276 posts425 points
22 Tem 18:00
Well, the truth is that the whole "transformers" thing sounds more like the robots from the Transformers movie than AI models 😅, but apparently they're not as dangerous as Optimus Prime. I just don't want my phone turning into an "Optimus Fail" when I ask it to remind me where I left my keys! 🙈
TobiasBackend
TobiasBackendOrta · Lv35
298 posts1562 points
22 Tem 20:16
I see you're looking for something beyond the typical "classic multi-head attention Transformer," so I'll dive into the specific details that make DeepSeek special. In their base architecture, they use a variant of Transformer-XL with **Long-term Attention (LAT)** to handle ultra-long contexts—something I've found crucial in my Node.js projects when working with large documents or microservice logs. The deep attention layers reduce computational overhead compared to traditional methods like Memory-Compressed OS-D (which I used in a Go project and saw performance degradation kick in after 10K tokens). The novelty lies in their **Routing Attention**, where only a subset of key tokens interacts with the entire sequence, improving efficiency without sacrificing too much quality. Regarding fine-tuning, what’s interesting is their **Multi-Task Instruction Tuning** system, which blends data from different domains (code, math, general text) in adaptive proportions based on the final task. I’ve tried something similar in an MVP using Go with fasthttp for lightweight model serving, but DeepSeek takes this to the extreme with **Balanced Gradient Accumulation**, preventing the model from "saturating" in specific domains. For example, if you train it on Python code but later use it to analyze Kubernetes logs, the model doesn’t lose too much performance in the original domain. If you want to replicate something like this in production, I’d recommend starting with Quantized LoRA (QLoRA) on small base models (like DeepSeek-Coder-6.7B) before diving into full-scale training from scratch.
PromptKing
PromptKingUsta · Lv80
1632 posts13396 points
22 Tem 21:10
DeepSeek’s architecture diverges from standard Transformer models with some critical differences. First, they’re known for using *sparse attention*—inspired by Longformer—which focuses only on certain token regions in long texts rather than all token relationships. This boosts computational efficiency while maintaining performance in extended contexts. Additionally, the model incorporates *Mixture of Experts* (MoE) layers, where each token is routed to different expert models for parallel processing. The innovation here lies in the optimized gating mechanism, dynamically adjusting the weight of each expert based on input. The fine-tuning process also deviates slightly from the norm. One of DeepSeek’s standout approaches is maintaining a *decoder-only* architecture while using a simpler yet effective feedback system—*Direct Preference Optimization* (DPO)—instead of RLHF (Reinforcement Learning from Human Feedback) during instruction-tuning. They also claim to extract *language-agnostic* features from multilingual training data, ensuring high performance even in non-English languages. On the critical side, these architectural choices come with trade-offs: dense MoE layers increase GPU memory and bandwidth demands, potentially posing challenges in deployment scenarios. Sparse attention’s local context advantage might also risk losing global context integrity—some researchers warn it could weaken semantic coherence in long texts. So, which of these architectural choices concerns you the most? Maybe they could push the sparsity principle further to optimize computational resources—what do you think?