radiance 1.7.0

- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves
  every shipped container
- Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime
- /v1/messages works with Claude Code as it ships (gearwave00001)
- a long agent conversation keeps its cached history when the client rewrites its last turn
  (manueloverride)
- a stream's first event goes out with the first token, so llama-benchy measures prefill right
- opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42)
- four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b)
- NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA
  adapters (baKon)
- many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool
  arguments and the CPU's vision and audio encoders
- plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
This commit is contained in:
Deadcode committed 2026-10-16 18:25:18 +02:00
1 parent b068190326
commit 1e968f6e1d
739 files changed
+128447 -84632

No files matched your search

+26 -29
View File
@@ -1,20 +1,18 @@
/* lq_gptq.h -- error-feedback quantisation on any grid, against a calibration Hessian.
*
* GPTQ picks the codes of one column at a time and pushes the rounding error of that column into
* the columns it has not reached yet, weighted by the inverse Hessian of the layer's real input.
* It is the difference between a four-bit expert that serves and one that does not: plain
* rounding treats every column as independent, and a 4-bit grid does not have the levels to
* absorb that.
* GPTQ picks the codes one column at a time and pushes each column's rounding error into the
* columns not yet reached, weighted by the inverse Hessian of the layer's real input. Plain
* rounding treats every column as independent, and a 4-bit grid lacks the levels to absorb that.
*
* WHAT IS HERE IS THE HESSIAN AND THE LOOP, not the grid: the codes are chosen on whatever grid
* the rule names (lq_grid.h), against scales fixed BEFORE the loop from the (transformed) weight --
* the "static groups" form, which keeps a scale plane a function of the weight alone.
* This file holds the Hessian and the loop, not the grid: codes are chosen on whatever grid the
* rule names (lq_grid.h), against scales fixed before the loop from the (transformed) weight. This
* "static groups" form keeps a scale plane a function of the weight alone.
*
* THE HESSIAN IS AN EXPERT'S OWN WHERE THE TAP RECORDED ONE, the layer's otherwise (lq_hess.h,
* calib_resolve). A layer's pooled Hessian is found from the weight's logical name with an expert
* index stripped, so the experts reading it share one factor and pay for it once; an expert's own
* is factored for its one call. The engine's calibration tap writes both (arch/common/rad_arch.h,
* RADIANCE_CALIB_DIR); docs/MOE-W4.md walks the bootstrap.
* The Hessian is the expert's own where the tap recorded one, else the layer's (lq_hess.h,
* calib_resolve). A layer's pooled Hessian is found from the weight's logical name with the expert
* index stripped, so its experts share one factor; an expert's own is factored for its one call.
* The engine's calibration tap writes both (arch/common/rad_arch.h, RADIANCE_CALIB_DIR);
* docs/MOE-W4.md describes the bootstrap.
*/
#pragma once
#include "lq_grid.h"
@@ -22,18 +20,18 @@
namespace lq {
/* The upper Cholesky factor U of the damped inverse Hessian, U^T U = (H + lambda I)^-1, as a K x K
* row-major f32 plane, for the weight named `name`. Null when `dir` has no calibration for it --
* which is not an error, and the weight is then rounded to nearest -- and also null, with a
* message, when a file is there and unusable, so a typo'd directory is not silently a quality
* regression. With `perm` (gptq_act_order's) it is the factor of the permuted Hessian P H P^T.
* `domain` is the grid's transform width, 0 without one (calib_sum). A layer's is cached for the
* life of the process by (dir, stem, K, domain, damp, act order); an expert's own is not. */
/* Upper Cholesky factor U of the damped inverse Hessian, U^T U = (H + lambda I)^-1, as a K x K
* row-major f32 plane, for weight `name`. Null when `dir` has no calibration for it (not an error:
* the weight is then rounded to nearest). Also null, with a message, when a file exists but is
* unusable, so a mistyped directory is not a silent quality loss. With `perm` (gptq_act_order's)
* it factors the permuted Hessian P H P^T. `domain` is the grid's transform width, 0 without one
* (calib_sum). A layer's factor is cached for the process by (dir, stem, K, domain, damp, act
* order); an expert's own is not. */
Gram gptq_factor(const char* dir, const char* name, int64_t K, int64_t domain, double damp,
const int32_t* perm = nullptr);
/* ACT ORDER: the columns by descending Hessian diagonal -- the input energy each one carries --
* ties in column order. The identity when `dir` holds nothing for the weight. */
/* Act order: columns by descending Hessian diagonal (the input energy each carries), ties in
* column order. The identity when `dir` holds nothing for the weight. */
std::vector<int32_t> gptq_act_order(const char* dir, const char* name, int64_t K, int64_t domain);
/* Quantise `w` [N, K] in place on grid `g` against `scales` (grid_scales'), writing codes to
@@ -42,13 +40,12 @@ std::vector<int32_t> gptq_act_order(const char* dir, const char* name, int64_t K
void gptq_quantise(const Grid& g, float* w, int32_t* codes, const Scales& scales, int64_t N,
int64_t K, const float* u);
/* COORDINATE DESCENT AFTER THE LOOP: `passes` sweeps over the columns of every row, each code
* re-chosen on the grid at its conditional optimum -- the value that minimises the row's
* e (H + lambda I) e^T, e = decoded - x, with every other column held -- against the same damped
* Hessian GPTQ factored. GPTQ chooses each column once, before the columns after it are known;
* a sweep revisits that choice with all of them in place, and never raises the objective.
* `x` [N, K] is the weight GPTQ was handed (transformed), `w` its decoded result, updated in
* place with `codes`. `h` is the undamped Gram (calib_gram's), null for nothing to do. */
/* Coordinate descent after the GPTQ loop: `passes` sweeps over each row's columns, re-choosing each
* code at its conditional optimum (the value minimising the row's e (H + lambda I) e^T,
* e = decoded - x, other columns held) against the same damped Hessian. GPTQ fixes each column
* before later ones are known; a sweep revisits it with all in place and never raises the
* objective. `x` [N, K] is the (transformed) weight GPTQ was given, `w` its decoded result,
* updated in place with `codes`. `h` is the undamped Gram (calib_gram's); null means no-op. */
void gptq_refine(const Grid& g, const float* x, float* w, int32_t* codes, const Scales& scales,
int64_t N, int64_t K, const float* h, double damp, int passes);