Building And Testing

Prerequisites

  • JDK 25 or newer

  • the repository Gradle wrapper

  • network access for tests that download pinned model fixtures

Standard Checks

./gradlew build
./gradlew test
./gradlew unitTest
./gradlew integrationTest
./gradlew spotlessCheck
./gradlew complianceCheck

Use spotlessApply to apply Google Java Format:

./gradlew spotlessApply

Publish a local development build with:

./gradlew publishToMavenLocal

Run one test class with:

./gradlew :backend-java:test \
  --tests "com.integrallis.models.backend.purejava.gguf.GgufParserTest"

Strict Real-Model Tests

Integration tests resolve immutable model revisions through ModelJars, download missing files, verify file size and SHA-256, and execute the real weights. A missing or unloadable required fixture fails the task; it is not reported as a successful skipped test.

The integration suite covers:

  • GGUF parsing

  • tokenizer behavior

  • finite forward-pass outputs

  • sampling

  • generation

  • deterministic greedy-token references

  • backend diagnostics and selected profile

Run the default real-model suite with:

./gradlew integrationTest

Download Individual Fixtures

Pure Java is the default and carries no suffix. Tasks for a different execution path identify it explicitly, for example Gemma31BQ4KMNative.

./gradlew :models:Qwen306BQ40
./gradlew :models:SmolLm2360MQ80
./gradlew :models:TinyLlama11BChatV10Q40
./gradlew :models:DeepSeekCoder13BQ4KM
./gradlew :models:DeepSeekCoder67BQ4KM
./gradlew :models:MiniCpm51BQ4KM
./gradlew :models:Qwen38BQ4KM
./gradlew :models:DeepSeekR1DistillQwen7BQ4KM
./gradlew :models:Qwen25Math15BQ4KMNative
./gradlew :models:SqlCoder7B2Q5KM
./gradlew :models:Gemma426BA4BQ4KM

Run ./gradlew :models:tasks --group "model acquisition" for the complete list. Downloaded artifacts are cached under ~/.jvllm/models.

Large-Model Tasks

Large fixtures run as dedicated strict tasks so CI workers do not cache several multi-gigabyte artifacts at once:

./gradlew :backend-java:qwen25Coder7BSlowTest
./gradlew :backend-java:deepSeekCoder67BSlowTest
./gradlew :backend-java:qwen38BSlowTest
./gradlew :backend-java:deepSeekR1DistillQwen7BSlowTest
./gradlew :backend-java:sqlCoder7B2SlowTest
./gradlew :backend-java:gemma426BA4BSlowTest
./gradlew :backend-native:gemma426BA4BNativeSlowTest
./gradlew :models-rag-bench:gemma426BA4BFrameworkSlowTest
./gradlew :backend-java:slowTest

Determinism

Selected Qwen, TinyLlama, DeepSeek, MiniCPM, math, and SQL fixtures compare exact greedy token sequences with pinned reference outputs. Kernel optimizations must pass these checks before their performance results can qualify a model profile.

Native routes are additionally compared with the Java reference behavior at their FFM boundary. Performance gains alone are not sufficient.

Continuous Integration

CI separates:

  • unit and static-analysis checks

  • strict default model integration

  • isolated large-model integration

  • deterministic reference tests

  • native kernels on every supported operating system and architecture

  • Apple bridge compilation and stub behavior

  • release dependency and publication verification

The release workflow must resolve released Vectors artifacts rather than a sibling source checkout. Published POMs may not contain snapshot or composite build dependencies.

Qualification Benchmarks

Controlled inference and RAG qualification require a recorded host, JVM, compiler arguments, model SHA, comparator revision, prompt hash, and raw report. The scripts are:

scripts/run-controlled-inference-benchmarks.sh
scripts/run-controlled-rag-qualification.sh

RAG qualification is ordered deliberately. The exact model/backend pair must first pass every workload case with library-default Models properties, one measured iteration, prefix-cache reuse, no generation failures, and perfect deterministic correctness. Only after that gate passes does the script enable recorded performance tuning and compare Models with Ollama and llama.cpp. For a supported Safetensors checkpoint that those engines cannot load, the pinned Transformers reference provides the authoritative same-artifact comparator. Tuned evidence cannot qualify a pair that fails the default-correctness smoke. Set RAG_MODELS_BACKEND to pure-java or rust-ffm; do not put -Dmodels.* settings in JAVA_OPTS during a qualification run.

The controlled inference script is a performance measurement harness. It does not replace the default-correctness gate in the RAG qualification script.

The benchmark preserves ModelPrompt segment boundaries for in-process generation. Template markers are trusted controls; retrieved evidence and the question remain ordinary text even if they spell a special token. An exact Qwen2.5 tokenizer oracle checks the same full ChatML prompt used by the Transformers comparison.

Embedding Equivalence

We test that Models produces the same vectors as llama.cpp:

./gradlew :models-bench:run --args="embedding-equivalence \
  --model /path/to/model.gguf \
  --report benchmark-results/embedding/model.json"

Exit 0 reproduced, 1 not reproduced, 2 usage or integrity problem. It runs in seconds: the llama.cpp reference vectors are committed. See Equivalence Gating for the floors.

Acceptance policy and reproduction details live in: