Skip to main content

ArcLM

ArcLM is a compact Python framework for causal language-model workflows. The vNext direction is ArcLM-owned: model architecture, tokenizer contracts, model loading, training, fine-tuning, runtime behavior, and .arcmodel artifacts are defined by ArcLM rather than by Hugging Face Transformers.

PyTorch is currently used as the tensor/autograd/runtime backend. safetensors is used for model and adapter tensor storage.

Install

pip install -e .

For development and documentation work:

pip install -e ".[dev]"

ArcLM supports Python >=3.9,<3.13.

Student / Lab API

from arclm import Lab

lab = Lab()
dataset = lab.dataset(text="alpha beta gamma delta alpha beta gamma delta")
model = lab.model(data=dataset, size="tiny")
history = lab.train(epochs=1, steps=1, shuffle=False)

Professional API

from arclm import Dataset, Model, Runtime, Tokenizer, Trainer
from arclm.training import FineTuningConfig, TrainingConfig

dataset = Dataset.load([{"text": "alpha beta gamma delta alpha beta gamma delta"}])
tokenizer = Tokenizer(strategy="word", max_vocab=16).build(dataset.text())
runtime = Runtime.auto(prefer="cpu")
model = Model.create(
    architecture="arclm-native",
    tokenizer=tokenizer,
    runtime=runtime,
    embed_dim=8,
    block_size=4,
    num_blocks=1,
)

config = TrainingConfig(epochs=1, steps_per_epoch=1, save_artifact=True, artifact_path="model.arcmodel")
history = Trainer(model=model, dataset=dataset, config=config, fine_tuning=FineTuningConfig(method="pretrain")).train()

Research API

from arclm.research import BaseStrategy, NextTokenLoss, TrainingConfig, Trainer

class MyLoss:
    def __call__(self, *, model, batch, engine):
        return NextTokenLoss()(model=model, batch=batch, engine=engine) * 0.5

strategy = BaseStrategy(name="half_loss", loss_function=MyLoss())
history = Trainer(model=model, dataset=dataset, config=TrainingConfig(epochs=1, steps_per_epoch=1), strategy=strategy).train()

Current Support

  • Native compact causal language model architecture: arclm-native-causal-lm.
  • Unified Tokenizer facade with native word and character engines.
  • Optional lazy SentencePiece tokenizer engine.
  • ArcLM-owned training engine with deterministic per-epoch steps, validation, checkpoint/resume, callbacks, metrics, progress display, gradient accumulation, and early stopping.
  • Full fine-tuning and native LoRA-style adapter fine-tuning.
  • .arcmodel model artifacts and .arcadapter adapter artifacts.
  • Three API levels over the same engine: Student, Professional, Research.

Planned

  • Optional Hugging Face compatibility adapters.
  • Additional ArcLM-native model families.
  • ArcLM-native BPE, WordPiece, and Unigram tokenizer engines.
  • Richer artifact migration/version policies.

Examples

The files in examples/ are executable and covered by tests:

  • 01_student_lab.py
  • 02_professional_training.py
  • 03_lora_finetuning.py
  • 04_save_load_arcmodel.py
  • 05_research_custom_loss.py

Development

python -m pytest tests
python -m mkdocs build --strict

License

ArcLM is released under the Apache License 2.0.

Metadata

Release files for arclm 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arclm 1.0.0
File Size Uploaded
arclm-1.0.0.tar.gz 84.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arclm 1.0.0
File Interpreter ABI Platform
arclm-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 160.6 kB

Release files / arclm-1.0.0.tar.gz

Download URL arclm-1.0.0.tar.gz
Size 84.1 kB
Tags Source
SHA-256 checksum
How to use checksums
421f0ced99c8e8bbc6c8e90b1fb7bb2f49073201e800007612d03dff6f139ea8
BLAKE2b-256 checksum
How to use checksums
9c855568f39a167faf4579d3940178d45c2ad771d846b29b2017df7e73190dc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / arclm-1.0.0-py3-none-any.whl

Download URL arclm-1.0.0-py3-none-any.whl
Size 76.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
138e2fa34789b969dcb5a308099016eb4a2e69af035e37a71cabeff6be28f35f
BLAKE2b-256 checksum
How to use checksums
5c1c75f90c11f54672443d3ded816059472a7bd3b68dcb7d52aed54b77b30a9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

2.0.0

2 release files

This release

1.0.0 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.6.1

2 release files

0.5.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page