File size: 656 Bytes
3fd1a35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <array>
#include <cstddef>

namespace ling3 {

inline constexpr std::size_t kHiddenSize = 1536;
inline constexpr std::size_t kExpertCount = 128;
inline constexpr std::size_t kExpertsPerToken = 8;
inline constexpr std::size_t kExpertGroups = 8;
inline constexpr std::size_t kSelectedGroups = 4;

struct Route {
    std::array<int, kExpertsPerToken> experts{};
    std::array<float, kExpertsPerToken> weights{};
};

void RouterLogitsF32(const float * hidden, const float * weights, float * logits) noexcept;
Route SelectRoute(const float * logits, const float * expert_bias, float routed_scale = 2.5F) noexcept;

} // namespace ling3