Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
12beb0e
feat(llama-cpp): route Score through the slot loop
richiejp Jul 13, 2026
046212d
feat(realtime): classifier wire types and pipeline config
richiejp Jul 13, 2026
2d7cd51
feat(realtime): classifier response flow
richiejp Jul 13, 2026
3f1e274
fix(realtime): bound the VAD tick's scan window and buffer retention
richiejp Jul 13, 2026
b5665a3
fix(backend): let per-model threads override the global default
richiejp Jul 13, 2026
44a0aee
chore(gallery): single-thread the silero VAD
richiejp Jul 13, 2026
000afce
docs(realtime): classifier mode, VAD scan window, threads precedence
richiejp Jul 13, 2026
aa20d83
chore: ratchet coverage baseline to 52.8
richiejp Jul 13, 2026
3d3312b
perf(llama-cpp): score all candidates in one batched decode
richiejp Jul 13, 2026
625f9a9
fix(realtime): gate scoring capacity by model usecase
richiejp Jul 15, 2026
3df4335
fix(ci): honor APT mirrors in the prebuilt llama-cpp compile step
richiejp Jul 15, 2026
56dad27
feat(realtime): classifier argument slots via constrained completion
richiejp Jul 15, 2026
fd16d57
chore: ratchet coverage baseline to 52.9
richiejp Jul 15, 2026
f59afbd
feat(realtime): splice filled slot values into classifier replies
richiejp Jul 16, 2026
f25dc5a
fix(realtime): harden classifier slot completion
richiejp Jul 16, 2026
5261691
feat(realtime): prewarm the classifier scoring prompt on registration
richiejp Jul 17, 2026
86c84bc
chore: ratchet coverage baseline to 53.8
richiejp Jul 17, 2026
7a27f3c
perf(llama-cpp): checkpoint scoring at the caller-declared stable prefix
richiejp Jul 17, 2026
6f7cf0d
fix(realtime): align classifier cache guidance
richiejp Jul 19, 2026
6903324
fix(llama-cpp): guard score task for fork backends
richiejp Jul 20, 2026
6342599
fix(dev): generate gRPC code before commit lint
richiejp Jul 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .docker/llama-cpp-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if [ -z "${BUILD_TYPE:-}" ]; then
# variants with it (the host never *selects* SME unless it has it, but every variant must
# still compile).
if [ "${TARGETARCH}" = "arm64" ]; then
# The prebuilt base inherits default ports.ubuntu.com sources; honor the
# APT_*_MIRROR build args here like the from-source path does, so this
# apt step survives a mirror outage.
sh /LocalAI/.docker/apt-mirror.sh || true
apt-get update -qq && apt-get install -y -qq gcc-14 g++-14
export CC=gcc-14 CXX=g++-14
fi
Expand Down
3 changes: 3 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ if [ "$go_changed" -eq 0 ] && [ "$ui_changed" -eq 0 ] && [ "$rt_changed" -eq 0 ]
fi

if [ "$go_changed" -eq 1 ]; then
echo "pre-commit ▶ gRPC generation (make protogen-go)"
make protogen-go

# Resolve the ref golangci-lint's new-from-merge-base should compare
# against. .golangci.yml pins origin/master, which is correct in CI
# (origin == the canonical repo) but wrong from a fork clone, where
Expand Down
4 changes: 4 additions & 0 deletions backend/Dockerfile.llama-cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ RUN make -BC /LocalAI/backend/cpp/llama-cpp package
# ============================================================================
FROM ${BUILDER_BASE_IMAGE} AS builder-prebuilt

ARG APT_MIRROR
ENV APT_MIRROR=${APT_MIRROR}
ARG APT_PORTS_MIRROR
ENV APT_PORTS_MIRROR=${APT_PORTS_MIRROR}
ARG BUILD_TYPE
ENV BUILD_TYPE=${BUILD_TYPE}
ARG CUDA_DOCKER_ARCH
Expand Down
12 changes: 12 additions & 0 deletions backend/backend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ message ScoreRequest {
// candidates differ in length and the consumer wants a per-token
// measure comparable across them (PMI-style scoring).
bool length_normalize = 4;
// Byte length of the prompt prefix that stays identical across
// repeated scoring calls (e.g. a classifier's option-list system
// prompt — everything before the per-turn probe text). Backends that
// snapshot state (hybrid/recurrent models cannot rewind otherwise)
// use it to place a reuse point exactly at the boundary, so the next
// call re-processes only the tokens after it. 0 means unknown.
int32 stable_prefix_len = 5;
}

// CandidateScore is one row in the ScoreResponse, matching by index
Expand Down Expand Up @@ -448,6 +455,11 @@ message ModelOptions {
// Proxy carries the cloud-proxy backend's per-model configuration.
// Empty for non-proxy backends.
ProxyOptions Proxy = 74;

// EnableScore reserves backend resources for the Score RPC. It is derived
// from the model's explicit `known_usecases: [score]` declaration so models
// that never score retain their ordinary serving footprint.
bool EnableScore = 75;
}

// ProxyOptions configures the cloud-proxy backend. UpstreamURL and
Expand Down
2 changes: 2 additions & 0 deletions backend/cpp/bonsai/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ define bonsai-build
# and are applied by apply-patches.sh below.
rm -rf $(CURRENT_MAKEFILE_DIR)/../bonsai-$(1)-build/patches
$(MAKE) -C $(CURRENT_MAKEFILE_DIR)/../bonsai-$(1)-build purge
bash $(LLAMA_CPP_DIR)/disable-score-task.sh $(CURRENT_MAKEFILE_DIR)/../bonsai-$(1)-build/grpc-server.cpp
$(info $(GREEN)I bonsai build info:$(1)$(RESET))
LLAMA_REPO=$(LLAMA_REPO) LLAMA_VERSION=$(BONSAI_VERSION) \
$(MAKE) -C $(CURRENT_MAKEFILE_DIR)/../bonsai-$(1)-build llama.cpp
Expand Down Expand Up @@ -77,6 +78,7 @@ bonsai-cpu-all:
# and are applied by apply-patches.sh below.
rm -rf $(CURRENT_MAKEFILE_DIR)/../bonsai-cpu-all-build/patches
$(MAKE) -C $(CURRENT_MAKEFILE_DIR)/../bonsai-cpu-all-build purge
bash $(LLAMA_CPP_DIR)/disable-score-task.sh $(CURRENT_MAKEFILE_DIR)/../bonsai-cpu-all-build/grpc-server.cpp
$(info $(GREEN)I bonsai build info:cpu-all-variants$(RESET))
LLAMA_REPO=$(LLAMA_REPO) LLAMA_VERSION=$(BONSAI_VERSION) \
$(MAKE) -C $(CURRENT_MAKEFILE_DIR)/../bonsai-cpu-all-build llama.cpp
Expand Down
43 changes: 43 additions & 0 deletions backend/cpp/llama-cpp/disable-score-task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# Mark a copied gRPC server as targeting a llama.cpp fork that does not carry
# LocalAI's slot-based Score patches. The RPC remains present in the shared
# protobuf service, but responds with UNIMPLEMENTED instead of referencing
# server task types and common_params fields absent from those forks.

set -euo pipefail

if [[ $# -ne 1 ]]; then
echo "usage: $0 <grpc-server.cpp>" >&2
exit 2
fi

SRC=$1

if [[ ! -f "$SRC" ]]; then
echo "grpc-server.cpp not found at $SRC" >&2
exit 2
fi

if grep -q '^#define LOCALAI_LLAMA_CPP_NO_SCORE_TASK' "$SRC"; then
echo "==> $SRC already disables the LocalAI score task, skipping"
exit 0
fi

awk '
!done && /^#include/ {
print "#define LOCALAI_LLAMA_CPP_NO_SCORE_TASK 1"
print "// ^ injected by disable-score-task.sh for an unpatched llama.cpp fork"
print ""
done = 1
}
{ print }
END {
if (!done) {
print "disable-score-task.sh: no #include anchor found" > "/dev/stderr"
exit 1
}
}
' "$SRC" > "$SRC.tmp"
mv "$SRC.tmp" "$SRC"

echo "==> LocalAI score task disabled in $SRC"
Loading