Archived
vocabulary: hc_project -- a control vector's direction, projected out of the wide stream
h[s] -= scale * (h[s] . v) * v for each of the hyper-connection streams s llama.cpp's --cvec-mode project semantics: the dot is per stream, because the patch applies it to the [n_embd, hc, tokens] view where mul_mat(v, cur) reduces over dim 0. v is one layer's unit direction (f32), scale is the norm its file stored, and 'on' is a per-row int32 switch: a zero row is skipped without a read or a write, so an unprojected request is byte-identical to a deployment with no vector loaded. libref is the oracle and the host fallback, libavx carries it at every ISA level, libr4d (one workgroup per (row, stream), LDS reduction) serves the card. docs/OPS.md gains the row and the operation's three facts.
This commit is contained in:
1 parent
64adee3ece
commit
459dd4f42d
14 files changed
+362
-11
No files matched your search
@@ -199,6 +199,7 @@ at once. Run it before adding a kernel plugin; the loader names only the first c
|
||||
| `mhc_contract` | `M`(range) `n` `hc` `dtype` | `h` → `x` |
|
||||
| `hc_read` | `M`(range) `n` `hc` `lowrank` `eps`:f64 `dtype` `wadd`:f64/opt `inject`/opt `group`/opt `rotate`/opt `mix`/opt | `h`, `w`w, `mix_down`w, `mix_up`w, `inject_w`w? → `x`, `inj`?, `q`?, `scale`?, `rq`?, `rscale`? |
|
||||
| `hc_write` | `M`(range) `n` `hc` `dtype` | `y`, `inj`, `h`:inout |
|
||||
| `hc_project` | `M`(range) `n` `hc` `scale`:f64 `dtype` | `h`:inout, `v`, `on` |
|
||||
| `layernorm` | `M`(range) `n` `eps`:f64 `dtype` | `x`, `w`w, `b`w? → `y` |
|
||||
| `grid_embed` | `M`(range) `n` `side` `dtype` | `x`:inout, `table`w, `coord` |
|
||||
| `grid_embed_aa` | `M`(range) `n` `side` `dtype` | `x`:inout, `table`w, `coord` |
|
||||
@@ -307,6 +308,13 @@ so a different op rather than a mode a library could ignore.
|
||||
|
||||
### Hyper-connections
|
||||
|
||||
`hc_project` is the control vector's projection (core/cvec.h): `h[s] -=
|
||||
scale * (h[s] . v) * v` for each of the `hc` streams of a row whose `on` flag (an int32 per row) is
|
||||
1, `v` being that layer's unit direction and `scale` the norm the file stored. It is llama.cpp's
|
||||
`--cvec-mode project`, applied after a layer's write into the stream. A row whose flag is 0 is
|
||||
neither read nor written, so an unprojected request's stream is the stock model's; the direction table is f32 and the op is issued only by an architecture that was
|
||||
declared with one (`RadBuildCtx::cvec`).
|
||||
|
||||
`hc_read` and `hc_write` are the gated residual pair a hyper-connection model has instead of a
|
||||
pre-norm and a residual add. The stream is `hc` times the model width; every block reads a mix of
|
||||
the `hc` sub-streams and writes back into all of them, both gated by data:
|
||||
|
||||
Reference in new issue
Block a user