SMILE is a comprehensive, high-performance machine learning engine for the JVM. From classic algorithms to GPU-accelerated deep learning and LLaMA-3 inference — all in pure Java, Scala, or Kotlin. Get started in 5 minutes →

Speed

Advanced data structures and algorithms deliver state-of-the-art performance.

Compared to a third-party benchmark, SMILE outperforms R, Python, Spark, H2O, and XGBoost significantly — often by several times while using far less memory. If you can train advanced models on a laptop, why buy a cluster?

Training Time (seconds)

Ease of Use

Write applications quickly in Java, Scala, Kotlin, Clojure, or Groovy. Data scientists and engineers can now speak the same language.

SMILE provides hundreds of algorithms behind a clean, consistent API. The Scala and Kotlin bindings add high-level operators and DSL builders. Use it interactively from the SMILE shell or embed it in any JVM application.


var iris = Read.arff("iris.arff");

var model = RandomForest.fit(Formula.lhs("class"), iris);

println(model.metrics());
          
DataFrame, Model Fitting, and Metrics

val iris = read.arff("iris.arff")

val model = randomForest("class" ~, iris)

println(model.metrics)
          
DataFrame, Model Fitting, and Metrics

val iris = read.arff("iris.arff")

val model = randomForest(Formula.lhs("class"), iris)

println(model.metrics())
          
DataFrame, Model Fitting, and Metrics

(let [iris (read-arff
            "data/weka/iris.arff")
      model (random-forest
             (Formula/lhs "class") iris)]
  (.metrics model))
          
DataFrame, Model Fitting, and Metrics

var iris = Read.arff("iris.arff")

var model = RandomForest.fit(Formula.lhs("class"), iris)

println model.metrics()
          
DataFrame, Model Fitting, and Metrics

Large Language Models

Run LLaMA-3 inference natively on the JVM — no Python bridge required.

SMILE ships a complete LLaMA-3 stack backed by LibTorch: tiktoken BPE tokenizer, grouped-query attention (GQA), rotary positional encoding (RoPE), SwiGLU feed-forward, and KV-cache. An OpenAI-compatible REST server with Server-Sent Events (SSE) streaming is included for production deployment. See Large Language Models.


var llama = Llama.build(
    "model/Meta-Llama-3-8B-Instruct",
    "model/.../tokenizer.model",
    4, 2048, (byte) 0);

int[][] prompts = llama.tokenizer.encode(
        "Once upon a time", true, false);

var result = llama.generate(prompts, 200,
    0.6, 0.9, false, 42L, null);
          
Text Generation

var reply = llama.chat(
    new Message[]{
        Message.system("Be concise."),
        Message.user(
            "What is RoPE?")
    },
    128, 0.7, 0.9, false, 0L, null);

System.out.println(reply.content());
          
Chat Completion

Deep Learning & Computer Vision

GPU-accelerated neural networks — build, train, and deploy on LibTorch.

The smile-deep module exposes LibTorch tensors, all standard layer types (linear, Conv2d, pooling, BN/GN/RMS norm, dropout, embedding), loss functions, and optimizers (SGD, Adam, AdamW, RMSprop) through a clean Java API. Pretrained EfficientNet-V2 (S/M/L) models for ImageNet classification are available with a single method call. See Deep Learning.


// Pretrained EfficientNet-V2-S
var model = EfficientNet.V2S();
var img = ImageIO.read(
    new File("dog.jpg"));

// Auto-preprocesses the image
try (var logits = model.forward(img)) {
    var probs = logits.softmax(1);
    int cls = probs.argmax(1, false)
        .intValue();
}
          
ImageNet Classification

var mlp = new SequentialBlock(
    Layer.relu(784, 256),
    Layer.relu(256, 128),
    Layer.logSoftmax(128, 10));

var opt = Optimizer.adam(
    mlp.asTorch().parameters(), 1e-3);

mlp.train(10, dataset,
    Loss.nll(), opt,
    new Accuracy(), testDataset);
          
Training Loop

Comprehensive

The most complete machine learning engine on the JVM.

SMILE covers every aspect of machine learning — LLM, computer vision, deep learning, classification, regression, clustering, association rule mining, manifold learning, nearest-neighbor search, feature engineering, missing-value imputation, time series, NLP, and more. See the sidebar for a full list of algorithms.

Natural Language Processing

From classic text processing to state-of-the-art LLM inference.

SMILE includes classic NLP building blocks — sentence splitter, word tokenizer, Porter/Lancaster stemmers, HMM POS tagger, bigram/phrase extraction, keyword detection, BM25 relevance ranking, and Word2Vec embeddings — alongside the full LLaMA-3 inference stack. See NLP and LLM.

Mathematics & Statistics

A complete numerical computing environment inside the JVM.

Dense, band, and sparse matrices; LU, Cholesky, QR, EVD, SVD decompositions; BFGS / L-BFGS optimizers; wavelets; interpolation (linear, cubic spline, bilinear, bicubic); probability distributions; hypothesis tests (t-test, chi-squared, ANOVA, KS); and even a Scala-based computer algebra system with symbolic differentiation. See Linear Algebra and Statistics.


var A = Matrix.randn(3, 3);
double[] x = {1.0, 2.0, 3.0};
var lu = A.lu();
lu.solve(x);
lu.inverse().mm(A);
          
Linear Algebra

int[] bins1 = {8, 13, 16, 10, 3};

int[] bins2 = {4,  9, 14, 16, 7};

Hypothesis.chisq.test(bins1, bins2);
          
Statistics

val x = Var("x")
val y = Var("y")
val e = x**2 + y**3 + x**2 * cot(y**3)
val dx = e.d(x)
println(dx)
          
Computer Algebra System

Data Visualization

Interactive 2D/3D Swing plots and declarative Vega-Lite charts.

Scatter plot, line plot, bar plot, box plot, heatmap, hexmap, histogram, QQ plot, surface, contour, dendrogram, wireframe, and more. SMILE also supports declarative visualization that compiles to Vega-Lite for browser and Jupyter rendering. See Visualization and Declarative Visualization.

Fork me on GitHub