Repository navigation
Releases
Releases · agentica-lang/ml
whisper-0.8.0
- Breaking: whisper asks for Agentica 0.40.0 (ml#302).
- whisper keeps its modules in
src/;pkg/whisper/NAMEimports are unchanged (ml#302).
vision-0.8.0
- Breaking: vision asks for Agentica 0.40.0 (ml#302).
- vision keeps its modules in
src/;pkg/vision/NAMEimports are unchanged (ml#302).
transformers-0.8.0
- Breaking: transformers asks for Agentica 0.40.0 and keeps its modules in
src/:pkg/transformers/NAMEimports are unchanged, andpkg/transformers/src/NAME(Llama) becomespkg/transformers/NAME(ml#302). - On XLA a step's plan is one per batch width and KV room: caches grow to their room before a step, and
Generate.step_batch(g, rows, width:)pads a batch with dropped rows;Servingpads batches to the next power of two, up to the rows that can be active, and counts them inpadded_runs(ml#477). - A prompt step compiles as
Trace.Phase.Promptand every step over a cache asTrace.Phase.Decode, so a NeuronCore compiles each with its own flags (ml#490). Generate.counters(g)reports what the compiled steps of a generator cost: compiles, plan hits, and the ms of compiling, running, uploading, fetching and picking (Stepping.Counters, ml#477).- Fix: speculative decoding no longer fails with
add needs two tensors of one shapewhen a verification step grew the KV cache and a rejected draft rolled it back under the old capacity (ml#478). - Generation runs on
Backend.Xla(Device.Neuron(0)), batched rows included;tools/bench_qwen.agctakesBATCH=n(ml#375, ml#476). Generateofpkg/transformers/generate_qwen4_expgenerates with Qwen4-Exp over a cache (attention and QSA indexer keys, delta and PLE states, the n-gram context), with the greedy ids of Hugging Face'sgenerate;KvDecoder.Steppertakesinputsthe host makes from the ids fed so far (ml#436).Qwen4Expreads the configs Hugging Face accepts (nolayer_types, no expert sizes, noindexer_*fields without indexed layers, an emptyeos_token_idwithout PLE, n-gram shards of any sizes), and is tested on XLA and libtorch (ml#466).Qwen4Exp(pkg/transformers/qwen4_exp) loads and runs the text model of a Qwen4-Exp checkpoint (the architecture of Qwen3.8-Flash-Next), with QSA, the hashed n-gram PLE, the hyper-connections and the experts, matching Hugging Face's logits (ml#436).- Qwen3.8-27B loads with
Qwen3_5.open: its config isqwen3_5, and the fields it adds (output_gate_type, the multi-token-prediction fields) change nothing, as in Hugging Face (ml#436). Serving.Limits(reuse_prefixes: true)names the full blocks of each sequence that ends, so a later prompt that starts with them prefills only the rest;Serving.Statscountsreused_tokensandprefilled_tokens(ml#422).Serving.Limits(kv_blocks:, kv_block_size:)serves every sequence from one paged pool, with the ids of a cache per sequence; a request waits for the blocks it may hold and fails when the pool could never hold it; the server takes--kv-blocksand--kv-block-size(ml#92).Generate.step_batch_pageddecodes many sequences of one pool in one graph, with the ids ofstep_batchover their contiguous caches, on the reference backend, ggml's CPU engine and Vulkan (ml#92).Generate.prefill_pagedreuses the published blocks a prompt starts with and feeds the rest in one step;KvDecoder.fork_pagedshares a sequence, a shared or published block is copied before a write, and a paged cache on XLA or libtorch is refused until it is tested (ml#92).- A paged KV cache for Qwen3:
Generate.open_pool(g, blocks, size)makes one pool for many sequences, andGenerate.step_pagedandstep_paged_logitsstep a sequence through its block table with the logits of the contiguous cache exactly, on the reference backend, ggml's CPU engine and Vulkan; a model with recurrent states andPlacement.Kv.Hostare refused (ml#92). LlamaGguf.opentakesllama.rope.scaling.typedefaultlikenone, and allama.rope.dimension_countother than the head size is an error (ml#303).LlamaGguf.openreads the GGUF files of llama.cpp's converter: the reordered query and key rows andrope_freqs.weight(thellama3scaling); before, such a file gave wrong ids. Breaking: thellama.rope.scaling.*keys are no longer read, and allama.rope.scaling.typeother thannoneis an error (ml#303).tools/generate_llama_check.agcchecks the greedy ids of Llama 3.2 1B Instruct against Hugging Face, from safetensors and GGUF, on ggml CPU and Vulkan (ml#303).Qwen3.open(dir, xla, BF16)keeps abfloat16checkpoint's big matrices as they are stored, and gives the logits of the same checkpoint read asF32.tools/bench_qwen.agctakesxla; on an RTX 4060 the estimated unique weight storage of Qwen3-0.6B is 1.19 GB against 2.38 GB, at the same decode speed (benchmarks/README.md).tools/minilm_finetune.agctakestorch, which fine-tunes MiniLM on libtorch, every weight (ml#203, ml#394).WordPiecereads a tokenizer file with a fixed padding ("strategy": {"Fixed": 128}) as the padding to the longest, sosentence-transformers/all-MiniLM-L6-v2opens; no tokenizer here pads (ml#377).tools/fetch_minilm.shfetches all-MiniLM-L6-v2 at a pinned revision and sha256, andtools/minilm_finetune.agcloads it and fine-tunes it for a few steps on ggml CPU or Vulkan (ml#377).- A BERT fine-tunes on
Backend.Xla(Device.Cpu): the gradients of the cosine loss match the reference andTrain.fit_batcheslowers the loss, andtools/minilm_finetune.agctakesxla(all-MiniLM-L6-v2: the loss falls from 0.01137 to 0.00236 in six steps, as on ggml) (ml#243). tools/finetune_stsb.agcfine-tunes all-MiniLM-L6-v2 on the scored pairs of STS-B oncpu,vulkan,xlaortorch, withtools/fetch_stsb.shfor the pinned files; the guide is the pagetrain/finetune-minilm.md. It trains every weight on libtorch too (ml#394).tools/finetune_stsb.agcand its guide train throughLoop(aLoop.spearmanmetric on a seeded validation sample, a step-and-loss handler) and take the epochs, the validation sample size and an optional time budget in seconds as arguments (ml#397).Generateof Qwen3 runs onBackend.Xla(Device.Cpu): the steps of the cache are compiled by XLA, andLift.stagedcompiles the forward there too (ml#243). Checked on the tiny model of the tests; the check against Hugging Face on Qwen3-0.6B and the speed are not done yet.Bert.weights,Bert.with_weightsandBert.pooledname the weights of a BERT as the checkpoint does and run its mean embedding inside a trace, soTrain.fitandParamsfine-tune it (sentence-transformers/all-MiniLM-L6-v2sized models);DistilBertshares the helpers (ml#377).GraniteMoe.open(dir, backend, weights, layers_on_device): the layers from thenth on, with their experts and keys, run on the CPU under a Vulkan device, as for Qwen3 (ml#331).Lfm3.open(dir, backend, weights, layers_on_device): the layers from thenth on, with their convolution states and keys, run on the CPU under a Vulkan device, as for Qwen3 (ml#331).Qwen3_5.open(dir, backend, weights, layers_on_device): the layers from thenth on, with their keys and states, run on the CPU under a Vulkan device, with the table and the head placed as for Qwen3 (ml#331).Qwen3.layers_that_fitandQwen3.layers_withintakekv: Placement.Kv.Hostand then count no KV cache on the card (ml#331).Qwen3.layers_that_fit(dir, backend, weights, max_device_bytes)gives thelayers_on_devicethat fills the free memory of a Vulkan device (less a reserve, up to a cap), andAGENTICA_ML_MAX_DEVICE_BYTESsets the cap forbench_qwen(ml#331).Placement.footprint(c, ...)counts theFootprintof a model from its checkpoint (ml#331).Placement.fit(footprint, budget)gives the largestlayers_on_devicewhose layout fits a budget in bytes, andPlacement.budget(free, reserve, cap)the budget; both are pure, the first step of a memory budget forlayers_on_device(ml#331).
train-0.8.0
- Breaking: train asks for Agentica 0.40.0 (ml#302).
- train keeps its modules in
src/;pkg/train/NAMEimports are unchanged (ml#302). Loop.checkpoint(dir, every:, keep:)writes the weights, the optimizer state and the position of a run to a new folder, whole or not at all, and keeps the last few;Loop.checkpointsandLoop.read_checkpointread them, andLoop.Infocarries thestateand theseed(ml#402).Loop.resume(trainer, dir)goes on from the last checkpoint ofdir, at its epoch and batch, with the same shuffle;Train.fitandTrain.fit_batchestakeskip:for it (ml#402).- A run emits
telemetryevents for handlers that an app attaches:train.step(loss, learning rate, step),train.epoch(mean loss) andtrain.metric(eachLoop.metricvalue), with the run name from the newrunargument ofTrain.fit,Train.fit_batchesandLoop.trainer;traindepends on thetelemetrypackage (ml#400). Optim.saveandOptim.loadwrite and read the step count and the moments of an optimizer state,Train.fitandfit_batchestake astartstate that the schedule goes on from, andTrain.EpochandStepInfocarry the run'sstate(ml#402).Loop.handle(event, f, every:)calls a function atStarted,StepCompletedorEpochCompleted, andLoop.stop(info)ends a run early with itsFit, andTrain.fittakes an optionalon_step. Breaking:on_epochandon_stepanswer aResult[Train.Control](Continue,Stopor anerror), and a failed metric stops the run at the end of its epoch (ml#397).Loop.trainerandLoop.run(Loop.run_batchesfor a batch function) run a training as a pipe overTrain.fit, andOptim.sgd,Optim.adamandOptim.adamware short optimizer constructors (ml#397).Loop.metricmeasures aLoop.Metricat the end of every epoch intoFit.metrics;Loop.meanandLoop.spearmanreduce its rows, andTrain.Epochcarries the epoch'sparams;finetune_stsb.agcmoves toLoop.spearmanin a later step (ml#397).Table.read(path)reads a CSV file (thecsvpackage) into named columns, andData.from_table(table, inputs, target, backend, target_dtype)makes aDatasetof its numeric columns for aLoader(ml#318).Table.readreads a.parquetfile too (theparquetpackage), andData.from_tablemakes aDatasetof its columns (ml#318).- A Parquet column with a NaN or an infinity is an error that names the column and the row, as a CSV cell that is not finite keeps its column text;
train/examples/has a CSV and a Parquet example with goldens, andtrain/data.mdthe text-column path withTrain.fit_batches(ml#318). - Breaking: train, transformers, vision and tools/skills ask for Agentica 0.40.0-beta.2 (the
parquetpackage needs it); CI already ran on it (ml#318). Table.readreads a CSV or Parquet file over 1 MiB, in chunks (ml#378).
tensor-0.8.0
- Breaking: tensor asks for Agentica 0.40.0 and keeps its modules in
src/:pkg/tensor/tensorandpkg/tensor/traceare unchanged, an import ofpkg/tensor/src/NAMEbecomespkg/tensor/NAME(ml#302). - On XLA a program is compiled once for every device and runs on the device of its call (a portable PJRT program), so the NeuronCores of a process share their programs; a plugin that refuses a portable program, or
AGENTICA_ML_XLA_PORTABLE=0, compiles one per device, as before (ml#508). - On a NeuronCore the prompt and decode phases add
--internal-hlo2tensorizer-options=--modular-flow-mac-threshold=10, and every program is compiled for the scratchpad page of the runtime (NEURON_SCRATCHPAD_PAGE_SIZE);Tensor.xla_scratchpad(bytes)sets the page before the plugin opens, andQwen3.openasks for one that holds a layer's KV cache of one sequence (ml#508). The programs in Neuron's compile cache compile once more under the new flags. - On a NeuronCore each compiled program gets the compiler flags of its phase:
Trace.compile(specs, f, phase)takesTrace.Phase.Prompt,DecodeorAny(the default). A prompt adds--model-type=transformer -O1toNEURON_CC_FLAGSand a decode step--model-type=transformer -O2, as NxD Inference does;AGENTICA_ML_NEURON_PROMPT_FLAGSandAGENTICA_ML_NEURON_DECODE_FLAGSreplace them. The flags are part of what a program is, so the same text with other flags compiles again (ml#490). - On XLA, a compiled function writes a
set_rowsinto its cache in place when the cache is an input that nothing else reads and the result is an output, as ggml does: the run consumes the old cache tensor, even when it fails, and answers the new one. Any other cache is copied, as before (ml#491). Backend.Xlaserves every NeuronCore the process sees,Neuron(0),Neuron(1)and up (Tensor.xla_devices()); a compiled function runs on the core of its inputs, andto_devicecopies between cores; two cores have run with our CPU plugin standing in, not yet on an inf2 (ml#477).- On a NeuronCore,
top_idscompiles (chlo.top_k),to_dtypefrom a float to an integer truncates, an index ofscatter_addorset_rowsoutside the rows is the usual error, and half weights compute asF32(ml#475). In the text ofTrace.stablehlothose indices are clamped into the rows, so an index outside them writes the nearest row where XLA dropped it. - Breaking:
Tensor.Devicehas a new variant,Neuron(Int), so an exhaustivecaseover it needs its arm (ml#241). Backend.Xlaruns on an AWS NeuronCore:AGENTICA_ML_NEURON_PLUGINnames Neuron's PJRT plugin,Tensor.xla_device()givesNeuron(0)then, and the site has a guide (ml#241).- On ggml a
gatherreads the rows of anF16cache that aset_rowswrote, widened toF32: how a paged cache reads its pool (ml#92). exponBackend.Torchflushes a denormal result to 0 on purpose (an input below -87.33 inF32, -708.39 inF64; libtorch is 3 to 10 times slower on them), so a masked softmax and the gradient ofgelu_erfrun faster; every result of 1.18e-38 or more is kept. The finite checks of the torch ops are oneaminmaxreduction instead of a boolean temporary and a scan, sosigmoidandgelu_erfrun in half the time (ml#407).Dtype.BF16: ggml, libtorch and XLA keep checkpoint weights in 16-bit buffers.Tensor.from_file(..., dtype: BF16)preserves BF16 file values and rounds F32 or F16 sources to nearest even. Products with F32 activations widen BF16 weights at compute time, and embeddings can widen only the selected rows.Backend.XlaholdsF16tensors:Tensor.from_file(..., dtype: F16),from_bytesandfrom_listmake half weights in 16-bit buffers, and a compiled product or lookup widens them toF32inside the program;Qwen3.open(dir, xla, F16)and the otherweights: F16models load on XLA (ml#386).- The StableHLO emitter builds every op with
agc-ir, soTrace.stablehloand the programs XLA compiles are in MLIR's generic form ("stablehlo.reduce"(...) ({...}) {dimensions = array<i64: 1>}), each reduction's, sort's and scatter's combiner an explicit region; only the module, its function and the gated-delta call stay text. The programs compute the same: the IREE goldens oftrain/are unchanged (ml#417). Tensor.adam_steponBackend.Torchis one native pass over the weight and its moments, where it was ten libtorch kernels per weight (ml#407).- The default build of the optional
torchmodule, without libtorch, stops with one clear error (no libtorch found, and how to find it) instead of errors aboutpreadandO_CLOEXEC(ml#379). - A traced run on
Backend.Torchfrees each node's tensor after its last reader, and the Adam step of a computing backend makes one statement at a time: a MiniLM step with every weight trained peaks at 1.4 GiB of resident memory (it was killed at 2.5 GB), and aTrace.evalof 16 sentences of 64 tokens no longer keeps 660 MB per call (ml#394). Torch.memoryreads the bytes of the live libtorch tensors and their peak, for the tests of what a run frees (ml#394).Tensor.batch_matmulruns onBackend.Torch(Cpu), so the gradient ofTensor.attention(written with it) runs on libtorch too: 51 of the 52 primitives (ml#203).- The StableHLO emitter (so
Backend.Xla) compilessigmoid,pow,clamp,to_dtype,permute,concat,stack,squeeze,unsqueeze,batch_matmulandargmax(ml#243). - The StableHLO emitter compiles
layer_norm,rms_norm,gelu_erfandropetoo (ml#243). - The StableHLO emitter compiles
attentionandscatter_add(the gradient of an embedding) too, and a program with ascatter_addchecks its indices as one with agatherdoes (ml#243). - The StableHLO emitter compiles
top_idstoo (ml#243). Tensor.from_fileandTensor.from_bytesonBackend.Xlaread and widen the range in C, straight into the buffer, as ggml does (no list of floats): Qwen3-0.6B opens in 2.8 GB instead of over 6 GB (ml#243).Tensor.device_memory(backend)gives the free and total bytes of the device of a ggml backend (ggml_backend_dev_memory), for a memory budget oflayers_on_device(ml#331).
server-0.8.0
- Breaking: server asks for Agentica 0.40.0 (ml#302).
- Breaking: server keeps its modules in
src/: run it asagentica src/server.agcfromserver/;pkg/server/NAMEimports are unchanged (ml#302). --warm-context Ncompiles the plans of prompts and answers up toNtokens before the server listens, on XLA and without--kv-blocks, each logged with its ms (ml#477).--log-level debug(orAGENTICA_ML_SERVING_DEBUG=1) prints a line per scheduler step with its device, rows, positions, KV room, plan (compiled or found) and the split of its time;/metricsadds each replica's compiles, plan hits, compile, execute and transfer ms, and the p50 and p95 step time (ml#477).--backend xlaserves a replica per device of the XLA plugin (each NeuronCore underAGENTICA_ML_NEURON_PLUGIN, run so far with our CPU plugin standing in), and the requests go round them in turn;Server.starttakes thebackends, and/metricssums the replicas and lists each underreplicas(ml#477).--api-key-env NAMEturns on an API key from the environment: every route needsAuthorization: Bearer <key>, compared in constant time, and anything else is a 401; a host that is not loopback needs the key or--no-auth(ml#457).- A message whose content holds the text of a special token of the tokenizer, such as
<|im_start|>, is a 400 in both routes (ml#422). POST /v1/responsesstreams an answer in the Responses API shape, andprevious_response_idcontinues the stored tokens of a response of the same client; with--kv-blocksand the new--reuse-prefixesthe continuation reuses the KV of the turns before it (ml#422).
nn-0.8.0
- Breaking: nn asks for Agentica 0.40.0 and keeps its modules in
src/;pkg/nn/NAMEimports are unchanged (ml#302). Delta.GatedDeltaNettakessigmoid_gate, theoutput_gate_type: sigmoidof Qwen4-Exp (ml#436).NGram(pkg/nn/ngram) computes the hashed n-gram ids of Qwen4-Exp (Qwen3.8-Flash-Next) and embeds them, with the ids of Hugging Face'sQwen4ExpTextNGramEmbedding(ml#436).Nn.Ropewithinv_freqtakesneox: false, which turns the columns2iand2i + 1together (ml#303).Paged(pkg/nn/paged) keeps the blocks of a paged KV cache: a pool of blocks with ref counts, a table of blocks per sequence, copy-on-write of a shared block, and the pool rows a step writes and reads; no tensors yet (ml#92).Hyper(pkg/nn/hyper) andPle(pkg/nn/ple) are the hyper-connections and the per-layer embedding of Qwen4-Exp (Qwen3.8-Flash-Next), andNn.LayerNormtakes agroup, the grouped RMS norm they use, as Hugging Face'sQwen4ExpTextGatedResidual,Qwen4ExpTextPLELayerandQwen4ExpTextRMSNormcompute them (ml#436).Paged.publishnames the full blocks of a table by a hash of their tokens andPaged.reusegives a new prompt the named blocks it starts with; a named block no table holds stays idle until a block is needed, the least recently idle first, and is copied before a write (ml#92).Qsa.masktakesquery_at, the position of each query over a padded cache, andPle.pletakes aDelta.padding(Ple.span) for a padded prompt (ml#436).Qsa(pkg/nn/qsa) is the token selection of the indexed attention of Qwen4-Exp (Qwen3.8-Flash-Next): the mask of the keys each query reads, as Hugging Face'sQwen4ExpTextQSAIndexerselects them (ml#436).
hub-0.8.0
- Breaking: hub asks for Agentica 0.40.0 (ml#302).
- hub keeps its modules in
src/;pkg/hub/NAMEimports are unchanged (ml#302). weights: BF16keeps the big matrices of a checkpoint asBF16weights on Torch and XLA, and asF16on ggml, asweights: F16does, where a value beyond 65504 is an error (ggml would multiply aBF16weight through anF32copy in every step);Load.weights_from_envreadsWEIGHTS=bf16(ml#444).Load.max_device_bytes_from_envreadsAGENTICA_ML_MAX_DEVICE_BYTESfor the tools (ml#331).Load.held_bytes(c, name, weights)counts the bytes a weight takes on a ggml device underweights, without reading it (ml#331).
asr-0.8.0
agc-ir-0.8.0
- Breaking: agc-ir asks for Agentica 0.40.0 (ml#302).
Element.BF16(bf16).Element.I8,I16andU8(ui8), andAttr.DenseLiteral(payload, type), a dense attribute whose payload the dialect formats; an emptyAttr.I64Arrayprints asarray<i64>, the form MLIR parses (ml#417).