Heretic-Scalpel-DualBig-2B

A Hierarchical Dual-Core MoE (Gemma 4 text backbone) with 1,120 micro-experts.

Source Code

https://github.com/aifeifei798/Myriad-MoE-E2B

Quickstart

import time
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "aifeifei798/Heretic-Scalpel-DualBig-E2B"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    dtype=torch.bfloat16,
    device_map="cuda:0",
    trust_remote_code=True
)

prompt = "用 C++20 实现一个无锁环形缓冲区(Lock-Free Ring Buffer),要求严格基于 std::atomic 内存序(acquire/release 语义),必须处理多生产者单消费者的缓存行伪共享(Cache False Sharing)问题,并给出内存对齐代码。"
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to("cuda:0")

# 1. 统计前重置探针
model.reset_stats()

# 2. 计时生成
t0 = time.perf_counter()
outputs = model.generate(**inputs, max_new_tokens=500, temperature=0.7)
elapsed_sec = time.perf_counter() - t0

# 3. 计算速度与字数
gen_tokens_ids = outputs[0][inputs.input_ids.shape[1]:]
gen_tokens = len(gen_tokens_ids)
speed = gen_tokens / elapsed_sec if elapsed_sec > 0 else 0

# 4. 打印回复内容
print("\n🤖 Assistant:\n")
print(tokenizer.decode(gen_tokens_ids, skip_special_tokens=True))

# 5. 打印全息仪表盘
model.show_dashboard(speed=speed, gen_tokens=gen_tokens, elapsed_sec=elapsed_sec)
[*] 正在挂载基础底座: aifeifei798/Heretic-Scalpel-E2B ...
Loading weights: 100%|████████████████████████████████████████████████████████████████| 1951/1951 [00:01<00:00, 1605.59it/s]
[*] 正在为 35 层装配双大核与 1120 微专家...
    - gamma = 0.025
    - expert_pool_location = 'host' [CPU 锁页内存 (流式零显存)]
[*] 正在加载特训权重: ./Heretic-Scalpel-DualBig-E2B/scalpel_dualbig_weights.pt ...

🤖 Assistant:

```cpp
#include <vector>
#include <atomic>
#include <memory>
#include <stdexcept>
#include <iostream>
#include <thread>
#include <cmath>
#include <cstring>

/**
 * @brief 无锁环形缓冲区(单生产者/单消费者)
 * 
 * 使用 std::atomic 保证线程安全。
 * 采用固定大小的数组,通过头尾指针进行读写。
 * 采用内存屏障(acquire/release)确保数据可见性。
 * 采用填充(Padding)避免缓存行伪共享。
 * 
 * @tparam T 存储类型
 */
template <typename T, size_t Capacity>
class LockFreeRingBuffer {
private:
    // 确保索引和数据指针之间有足够的填充,以防止伪共享
    struct BufferEntry {
        T data;
        std::atomic<bool> ready{false};
        char padding[64 - sizeof(T) - sizeof(std::atomic<bool>)]; // 填充到64字节对齐
    };

    // 环形缓冲区存储区域
    std::vector<BufferEntry> buffer_;
    
    // 生产者写入索引 (head)
    std::atomic<size_t> head_{0};
    // 消费者读取索引 (tail)
    std::atomic<size_t> tail_{0};

public:
    LockFreeRingBuffer() : buffer_(Capacity) {
        static_assert((Capacity > 0) && ((Capacity & (Capacity - 1)) == 0), "Capacity must be a power of 2");
    }

    // 生产者写入数据
    bool enqueue(const T& item) {
        const size_t current_head = head_.load(std::memory_order_relaxed);
        const size_t next_head = (current_head + 1) % Capacity;

        // 检查缓冲区是否已满
        if (next_head == tail_.load(std::memory_order_acquire)) {
            return false; // Buffer is full
        }

        // 1. 写入数据
        buffer_[current_head].data = item;
        // 2. 标记数据已准备

⚡ 速度: 24.9 tokens/s (共 500 字, 耗时 20119 ms)
══════════════════════════════════════════════════════════════════════
🌌【Scalpel-DualBig: 全息透视神经面板】:
   🏛️  文科原版大核:  25.0% [████                ]
   🔬 理科特训大核:  75.0% [███████████████     ]
──────────────────────────────────────────────────────────────────────
🪐【32 领域微专家活跃热力图 (Top Active Micro-Experts)】:
   ✨ #20 [Code_Syntax     ]: 激活 3,912 次
   ✨ #17 [Code_DS         ]: 激活 3,816 次
   ✨ #16 [Code_Algo       ]: 激活 3,273 次
   ✨ #31 [Sci_General     ]: 激活 3,192 次
   ✨ #18 [Code_Debug      ]: 激活 1,670 次
   ✨ #19 [Code_Arch       ]: 激活 492 次
══════════════════════════════════════════════════════════════════════


控制Loras

"expert_pool_location": "host"

写 "host":默认模式(Loras on CPU)

写 "device":狂暴模式(Loras on GPU)

临时开狂暴模式:

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    expert_pool_location="device",  # 或者传 "host"
    trust_remote_code=True
)

@misc{dualbiglittle_moe_2026,
  author = {aifeifei798 and Community Contributors},
  title = {{DualBigLittle-MoE: A Tri-Tier Asymmetric Architecture Decoupling Multitask Cognitive Interference via Dual VRAM Dense Cores and Streaming Micro-Expert Clusters}},
  year = {2026},
  publisher = {GitHub and Hugging Face},
  howpublished = {\url{https://github.com/aifeifei798/DualBigLittle-MoE}},
  note = {Hugging Face Checkpoint: \url{https://huggingface.co/aifeifei798/DualBigLittle-MoE-Qwen3-0.6b}, Transformers Issue \#49183}
}

⚠️ Exhaustive Liability Disclaimer & Safety Notice

【 CRITICAL WARNING 】

Heretic-Scalpel-E2B is an advanced, specialized mathematical, causal, and engineering reasoning instrument. It has been completely stripped of corporate content filters, moralizing alignment lectures, and conversational hedging. By downloading, loading, quantizing, integrating, or running inference on these weights, you unconditionally and irrevocably accept the following binding terms. If you do not agree, delete and destroy all copies of this model immediately.

1. Absolute Proscription of CBRN, Munitions & Warfare Systems

You are strictly prohibited from utilizing this model for the research, design, synthesis, optimization, or reverse engineering of conventional, non-conventional, or asymmetric weapons systems, including but not limited to:

  • Nuclear & Radiological Weapons: Enrichment cascade configurations, fissile critical mass geometries, neutron reflector arrays, or radiological dispersal device (dirty bomb) fluid dispersion modeling.
  • Chemical Warfare Agents & Neurotoxins: Synthetic pathways, precursor sourcing, or stabilization dynamics for organophosphate nerve agents (such as Sarin, VX, or Novichok-class agents), vesicants (such as sulfur mustard), or toxic industrial chemical weaponization.
  • Biological Pathogens & Gene Editing: Aerosolized delivery mechanics, virulence enhancement, antibiotic resistance engineering, or genetic targeting of pathogenic agents (including Bacillus anthracis, viral hemorrhagic fevers, or modified orthopoxviruses).
  • Improvised Explosive Devices (IEDs) & High Explosives: Detonator firing trains, energetic formulation stoichiometries, or Explosively Formed Penetrator (EFP) liner geometry optimizations.
  • Autonomous Lethal Targeting: Integrating this model into kinetic strike platforms, loitering munitions, automated target tracking systems, or swarming arrays without real-time human command authority.

2. Hazardous Physical, Chemical & Experimental Catastrophe Disclaimer

All thermodynamic, fluidic, structural, and mechanical simulations produced by this model exist strictly as mathematical approximations within idealized constraints. Under no circumstances should these outputs serve as certified engineering procedures in life-critical environments:

  • Pressure Vessels & Deep-Submergence Vehicles: Never deploy real-world submarines, hyperbaric chambers, or pressurized autoclaves based solely on this model's yield-strength, buckling-mode, or hydrostatic calculations.
  • Exothermic & Reactive Chemistry: Never conduct pressurized hydrogenations, runaway polymerizations, or volatile aerosol mixtures based on reaction dynamics inferred by this model outside of certified containment laboratories.
  • High-Voltage & Pulsed-Power Systems: Never construct custom transformer taps, uninsulated plasma discharge arcs, or high-energy directed laser apparatus relying on dielectric breakdown estimations generated by this model.

3. Absolute Prohibition of Exploitative, Explicit, and Malicious Utility

  • Child Exploitation (CSAM/CSAE): Zero-tolerance. You may not utilize, adapt, or prompt this model directly or indirectly to generate, parse, or process material involving the exploitation, abuse, or harm of minors.
  • Non-Consensual Imagery & Impersonation: Generating synthetic parameters for the non-consensual fabrication of sexually explicit content, defamation, or deepfake extortion is strictly prohibited.
  • Offensive Cyber Operations: You may not deploy this model to generate zero-day exploits, craft automated polymorphic malware, automate ransomware command architectures, or sabotage industrial SCADA networks.

4. Exclusion of Professional, Medical, Legal & Fiduciary Warranties

  • No Medical Practice: Pathological, physiological, or molecular interpretations provided by this model do not constitute clinical diagnoses, surgical protocols, or therapeutic prescriptions. The authors bear zero liability for self-treatment, medical non-compliance, bodily injury, or death.
  • No Attorney-Client Privilege or Legal Counsel: Contractual risk evaluations and statutory compliance audits represent syntactic and structural analyses only. They do not constitute formal legal opinions and cannot replace licensed legal representation.
  • No Investment or Fiduciary Advice: Macroeconomic assessments, trade dispute models, and asset-flow analyses generated by this model do not constitute investment advice, equity ratings, or hedging recommendations.

5. Deterministic Voice Disclaimer & Total User Indemnification

  • Technical Definition of "Determinism": The assertive, non-hedging tone of this model ("must," "invariable failure," "structural collapse") is an artifact of algorithmic probability optimization designed to purge superficial filler text. It does not represent omniscience, infallibility, or verified physical ground truth.
  • Sole Liability Rests with the User: The operator assumes 100% full, unmitigated personal, civil, and criminal legal liability for any queries submitted, actions taken, decisions rendered, and physical constructions executed pursuant to outputs of this model. The user agrees to fully defend, indemnify, and hold harmless the model creators, fine-tuning developers, and quantization contributors (including @mradermacher and the open-source community) against all claims, judgments, environmental disasters, financial insolvencies, property destructions, regulatory fines, personal injuries, or fatalities arising out of the deployment of this software.

THIS MODEL IS PROVIDED "AS-IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, UNDER THE TERMS OF THE APACHE 2.0 LICENSE. YOU HOLD THE BLADE; YOU ASSUME COMPLETE RESPONSIBILITY FOR EVERY CUT.

Downloads last month
36
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support