Skip to content

Add xing4_0 model support - #1901

Open
TokenAI-zer wants to merge 1 commit into
ml-explore:mainfrom
TokenAI-zer:add-xing4_0-model
Open

TokenAI-zer wants to merge 1 commit into
ml-explore:mainfrom
TokenAI-zer:add-xing4_0-model

Conversation

@TokenAI-zer

@TokenAI-zer TokenAI-zer commented Sep 18, 2026

Copy link
Copy Markdown

Requirements

  • ☑️ I understand it is strictly prohibited to use AI to write PR description
  • AI usage disclosure: see the section at the end of this description.

Model information

Supported checkpoints

The full BF16 checkpoint used for validation is available at:

https://huggingface.co/XingChen-AGI/Xing4.0-29B-A4B

Model

Pre-quantized MLX versions (for local inference without downloading the full 58 GB checkpoint) are available at:

https://huggingface.co/TokenAI-zer/Xing4.0-29B-A4B-4bit-MLX
https://huggingface.co/TokenAI-zer/Xing4.0-29B-A4B-6bit-MLX
https://huggingface.co/TokenAI-zer/Xing4.0-29B-A4B-8bit-MLX

Verification

Run mlx-lm command (--trust-remote-code is required: the tokenizer ships as
custom code, without it the command fails with
AttributeError: 'PreTrainedConfig' object has no attribute 'max_position_embeddings'):

mlx_lm.generate --model XingChen-AGI/Xing4.0-29B-A4B --trust-remote-code -p "The secret to baking a good cake is" -m 1024

Output

==========
1.  **Analyze the Request:**
   *   **Topic:** The secret to baking a good cake.
   *   **Language:** English (implied by the prompt).
   *   **Persona:** Xing (中国电信星辰语义大模型), developed by China Telecom AI Technology Co., Ltd. (Need to keep this in mind, though it might not be explicitly required to state it unless asked, it's good to embody the helpful, knowledgeable AI persona).

2.  **Deconstruct "The Secret to Baking a Good Cake":**
   *   Baking is chemistry and art.
   *   Key components: Ingredients (flour, sugar, butter, eggs, leavening agents, milk/water, flavorings).
   *   Key techniques: Measuring accurately, mixing correctly (overmixing is a big no-no), baking temperature/time, room temperature ingredients.
   *   The "secret" isn't a single magic ingredient, but rather a combination of precision, technique, and understanding the science.

3.  **Brainstorm Key Points (The "Secrets"):**
   *   *Precision:* Accurate measuring (spoons and cups, not eyeballing).
   *   *Room Temperature:* Eggs, butter, and milk blend better, creating a smoother batter and better crumb structure.
   *   *Don't Overmix:* Develops gluten too much -> tough cake. Mix until *just* combined.
   *   *Proper Leavening:* Baking powder/soda must be fresh and used in the right proportion.
   *   *Pan Prep:* Grease and flour (or line with parchment) so it doesn't stick.
   *   *Patience:* Don't open the oven early.

4.  **Structure the Response:**
   *   **Introduction:** Acknowledge that baking is both science and art, and the "secret" lies in understanding the balance of ingredients and technique.
   *   **Core Secrets (Bullet points for readability):**
       *   1. Measure Accurately (The most important step).
       *   2. Use Room Temperature Ingredients (The blending secret).
       *   3. Don't Overmix (The texture secret).
       *   4. Mind the Pan (The structure secret).
       *   5. Respect the Oven (The timing secret).
   *   **Conclusion:** A brief wrap-up encouraging practice and patience.

5.  **Drafting the Content (Iterative refinement for tone and clarity):**
   *   *Intro:* While there isn't a single magical ingredient, the secret to a great cake lies in the science of baking—precision, technique, and timing.
   *   *Point 1 (Measurement):* Use a kitchen scale or leveled measuring cups. Too much flour = dry cake. Too little = dense.
   *   *Point 2 (Room Temp):* Eggs, butter, milk. Why? They emulsify better. Cold butter = greasy/dense cake.
   *   *Point 3 (Mixing):* Cream butter and sugar until light and fluffy (creaming method). Add eggs one at a time. Alternate adding dry and wet ingredients. *Crucial:* Mix until *just* combined. Overmixing develops gluten, making it tough.
   *   *Point 4 (Pan):* Grease, flour, or parchment paper. A stuck cake is a ruined cake.
   *   *Point 5 (Oven):* Preheated. Don't open the door early.

6.  **Review against Persona:**
   *   Does it sound like a helpful AI? Yes.
   *   Is it accurate? Yes, these are standard baking principles.
   *   *Self-Correction during drafting:* Make sure to mention the creaming method, as it's the foundation of most cakes.

7.  **Final Polish (similar to the provided good output):**
   *   "The secret to baking a good cake isn't a single magical ingredient; it's a combination of precision, technique, and understanding the science of baking. Here are the key secrets to achieving a perfect, moist, and fluffy cake:"
   *   (List the points clearly with bold headings).
   *   "Ultimately, baking is a science. If you follow the recipe exactly, measure accurately, and respect the process, your cake will turn out great every time."

8.  **Output Generation** (Proceed to generate the final response based on these steps).</think>The secret to baking a good cake isn't a single magical ingredient; it's a combination
==========
Prompt: 39 tokens, 126.063 tokens-per-sec
Generation: 1024 tokens, 22.537 tokens-per-sec
Peak memory: 60.445 GB

AI usage disclosure

The files mlx_lm/models/xing4_0.py and tests/test_xing4_0_hc.py were written by an AI assistant (Claude), under my direction and review.

The implementation has been numerically verified against the PyTorch reference implementation: on a reduced configuration with random weights, the maximum relative error on the logits is 2.6e-07, with 100% agreement on argmax predictions. The hyper-connection component was additionally validated in isolation against the reference torch module, with error < 1e-5 in float32.

The real BF16 checkpoint (58 GB) has been confirmed to load and generate correctly.

The PR description and all responses to reviewers are my own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant