Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to models are documented here.

## [Unreleased]

## [0.2.5] - 2026-08-03

### Changed

- Made the release qualification gate exercise the public default Gemma 4
runtime before any benchmark-only tuning and retain nested benchmark failures.

### Fixed

- Fixed singleton Gemma 4 routed-expert prefill projections by copying
capacity-sized batched buffers through exact-shape reusable scratch arrays.

## [0.2.4] - 2026-08-02

### Fixed
Expand Down
8 changes: 8 additions & 0 deletions RAG_BENCHMARKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,14 @@ Python environment is locked by `uv.lock`; the direct Python binding is labeled
separately because its bundled llama.cpp revision may differ from the pinned
server.

`scripts/run-controlled-rag-qualification.sh` now writes two distinct classes
of evidence. `default-correctness/` is an untuned, one-iteration smoke of every
workload case for the exact Models backend; it must have no failures and 100%
deterministic correctness. The reports at the qualification root are the
separate, tuned performance comparison. A performance profile can improve a
qualified deployment, but it cannot make a model/backend pair eligible when
the public library defaults fail.

Related framework references:

- [LangChain4j RAG](https://docs.langchain4j.dev/tutorials/rag/)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ directly:

```kotlin
dependencies {
implementation("com.integrallis:models:0.2.4")
implementation("com.integrallis:backend-java:0.2.4") // or backend-native
implementation("com.integrallis:models:0.2.5")
implementation("com.integrallis:backend-java:0.2.5") // or backend-native
}
```

Use Apple's on-device system model on a supported Apple Silicon Mac:

```kotlin
dependencies {
implementation("com.integrallis:backend-apple:0.2.4")
implementation("com.integrallis:backend-apple:0.2.5")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import java.lang.foreign.MemorySegment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.IntConsumer;
import java.util.stream.IntStream;
Expand Down Expand Up @@ -62,6 +64,10 @@ int checkpoint() {

private record F32Scratch(int rows, int columns, float[][] inputs, float[][] outputs) {}

private record ProjectionShape(int rows, int columns) {}

private record ProjectionScratch(float[] input, float[] output) {}

private final Gemma4Config config;
private final Gemma4Weights weights;
private final Session defaultSession;
Expand Down Expand Up @@ -134,6 +140,7 @@ private record F32Scratch(int rows, int columns, float[][] inputs, float[][] out
private final float[][] groupedExpertActivations;
private final float[][] groupedExpertOutputs;
private final F32Scratch[] batchF32Scratch;
private final Map<ProjectionShape, ProjectionScratch> singletonProjectionScratch;

private float[] verificationLogits = new float[0];
private float[] sessionBatchLogits = new float[0];
Expand Down Expand Up @@ -280,6 +287,7 @@ private record F32Scratch(int rows, int columns, float[][] inputs, float[][] out
batchedPrefill
? createF32Scratch(config, weights, prefillBatchCapacity)
: new F32Scratch[0];
this.singletonProjectionScratch = new HashMap<>();
}

/** Executes one token and returns stable logits. */
Expand Down Expand Up @@ -1319,7 +1327,17 @@ void projectBatched(
return;
}
if (batchSize == 1) {
project(matrix, type, rows, columns, input, output);
if (input.length == columns && output.length == rows) {
project(matrix, type, rows, columns, input, output);
return;
}
ProjectionScratch scratch =
singletonProjectionScratch.computeIfAbsent(
new ProjectionShape(rows, columns),
ignored -> new ProjectionScratch(new float[columns], new float[rows]));
System.arraycopy(input, 0, scratch.input(), 0, columns);
project(matrix, type, rows, columns, scratch.input(), scratch.output());
System.arraycopy(scratch.output(), 0, output, 0, rows);
return;
}
if (type == GgufTensorType.F32) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,18 +429,24 @@ public void multiply(
Gemma4KvCache.create(model.config(), 8, 2),
experts,
batchOnlyKernel);
float[] input = new float[256];
for (int index = 0; index < input.length; index++) {
input[index] = (index - 128) * 0.0078125f;
float[] expectedInput = new float[256];
for (int index = 0; index < expectedInput.length; index++) {
expectedInput[index] = (index - 128) * 0.0078125f;
}
float[] oversizedInput = new float[128 * 256];
System.arraycopy(expectedInput, 0, oversizedInput, 0, expectedInput.length);
for (int index = expectedInput.length; index < oversizedInput.length; index++) {
oversizedInput[index] = 1.0f;
}
MemorySegment matrix = MemorySegment.ofArray(q4KBlock(0.125f, 0.0625f, 7));
float[] expected = new float[1];
float[] actual = new float[1];
TensorOps.ggufMatmul(expected, input, matrix, GgufTensorType.Q4_K, 1, 256);
float[] actual = new float[128];
TensorOps.ggufMatmul(expected, expectedInput, matrix, GgufTensorType.Q4_K, 1, 256);

forwardPass.projectBatched(matrix, GgufTensorType.Q4_K, 1, 256, input, 1, actual);
forwardPass.projectBatched(matrix, GgufTensorType.Q4_K, 1, 256, oversizedInput, 1, actual);

assertThat(actual).containsExactly(expected);
assertThat(actual[0]).isEqualTo(expected[0]);
assertThat(Arrays.copyOfRange(actual, 1, actual.length)).containsOnly(0.0f);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backend-native/src/main/rust/model-kernels/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend-native/src/main/rust/model-kernels/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jmodels-kernels"
version = "0.2.4"
version = "0.2.5"
edition = "2024"
license = "Apache-2.0"
publish = false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Gemma 4 26B-A4B Q4_K_M library-default smoke

This directory proves that the exact qualified Gemma artifact passes the
nine-case guarded-RAG correctness workload before any model- or host-specific
performance tuning is applied.

- Models commit: `37dec2680637eb22b5ee59001e53af11d8d3946b`
- artifact SHA-256: `88f4a13b0bb95f031a7fad973e10854122fb67ebc34d214d39a2f65053046abc`
- checked-in report SHA-256: `74739c5166a445ba97cbb05701cddea47dfda03d8af119836b53f374e04b77d5`
- result: 9/9 successful, 100% correct-answer rate, 100% abstention accuracy
- prompt cache: longest-common-prefix
- `models.native.quantizedDecode`: `false`
- `models.native.loadWarmup`: `false`
- tuning system properties: none

The run used Java 25.0.3 on the controlled 8-vCPU AMD EPYC-Milan Linux host.
It is a correctness and onboarding gate; the separately retained tuned report
remains the performance qualification evidence.
Loading
Loading