Skip to content
North-Shore-AIPublic

About

Batch IR for standardized data interchange across training and inference backends. Covers text/token/chat/instruct batch types with encoding, validation, and portable schemas.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

BatchIR

BatchIR Logo

Hex.pm Documentation CI License

BatchIR is a standardized batch encoding for training and inference interchange across backends. It provides typed batch structs, explicit schema tags, JSON/Msgpack serialization, and validation helpers for safe data transport and storage.

Highlights

  • Typed batch structs for text, tokens, labels, chat, and instructions
  • Explicit schema tags embedded in every encoded payload
  • JSON + Msgpack encoding/decoding helpers
  • Validation for batch shapes, lengths, and required fields
  • Compatibility helpers for Kitchen and TrainingIR payloads

Installation

Add to your mix.exs:

def deps do
  [
    {:batch_ir, "~> 0.1.0"}
  ]
end

Or from GitHub:

def deps do
  [
    {:batch_ir, git: "https://github.com/North-Shore-AI/batch_ir.git"}
  ]
end

Batch Types

Struct Purpose
BatchIR.TextBatch Raw text samples
BatchIR.TokenBatch Tokenized sequences
BatchIR.LabeledBatch Labeled inputs for supervision
BatchIR.ChatBatch Conversation-style batches
BatchIR.InstructBatch Instruction-following samples

Quick Start

Encode / Decode

alias BatchIR.TextBatch

batch = TextBatch.from_strings(["hello", "world"])
{:ok, json} = TextBatch.encode(batch, :json)
{:ok, decoded} = TextBatch.decode(json, :json)

Schema Tags

alias BatchIR.Schema

Schema.tag(:text)
# => "batch_ir/text@1"

Validation

alias BatchIR.Validation

Validation.valid?(batch)
Validation.errors(batch)

Compatibility

alias BatchIR.Compat

{:ok, batch} = Compat.from_kitchen_batch(["hello", "world"])
training_payload = Compat.to_training_payload(batch)

Development

mix deps.get
mix format
mix test
mix credo --strict
mix dialyzer

License

MIT License - Copyright (c) 2026 North-Shore-AI

See LICENSE for details and CHANGELOG for release history.

About

Batch IR for standardized data interchange across training and inference backends. Covers text/token/chat/instruct batch types with encoding, validation, and portable schemas.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages