AiDotNet 0.68.0
dotnet add package AiDotNet --version 0.68.0
NuGet\Install-Package AiDotNet -Version 0.68.0
<PackageReference Include="AiDotNet" Version="0.68.0" />
<PackageVersion Include="AiDotNet" Version="0.68.0" />
<PackageReference Include="AiDotNet" />
paket add AiDotNet --version 0.68.0
#r "nuget: AiDotNet, 0.68.0"
#:package AiDotNet@0.68.0
#addin nuget:?package=AiDotNet&version=0.68.0
#tool nuget:?package=AiDotNet&version=0.68.0
AiDotNet
<div align="center">
The Most Comprehensive AI/ML Framework for .NET
4,300+ implementations across 60+ feature categories - bringing cutting-edge AI to the .NET ecosystem
Getting Started • Samples • Documentation • API Reference • Contributing
</div>
Why AiDotNet?
| Feature | AiDotNet | TorchSharp | TensorFlow.NET | ML.NET | Accord.NET |
|---|---|---|---|---|---|
| Neural Network Architectures | 100+ | 50+ | 30+ | ~10 | ~20 |
| Classical ML Algorithms | 106+ | None | None | ~30 | ~50 |
| Computer Vision Models | 50+ | Via PyTorch | Via TF | Limited | Limited |
| Audio Processing | 90+ | Limited | Limited | None | Basic |
| Reinforcement Learning | 80+ agents | Manual | Limited | None | None |
| Diffusion Models | 20+ | Manual | None | None | None |
| LoRA Fine-tuning | 37 adapters | Manual | None | None | None |
| RAG Components | 50+ | None | None | None | None |
| Distributed Training | DDP, FSDP, ZeRO | DDP only | MirroredStrategy | None | None |
| HuggingFace Integration | Native | Partial | Partial | None | None |
| GPU Acceleration | CUDA, OpenCL | Via LibTorch | Via TF Runtime | Limited | None |
| Pure .NET (No Runtime) | Yes | No (LibTorch) | No (TF Runtime) | Yes | Yes |
| Startup Time | Fast | Slow | Slow | Fast | Fast |
| Memory<T>/Span<T> Support | Full | Limited | Limited | Limited | None |
Quick Start by Task
What do you want to build?
| Task | Quick Link | Description |
|---|---|---|
| Classify data | Classification | Binary, multi-class, image classification |
| Predict values | Regression | Price prediction, forecasting |
| Group similar items | Clustering | Customer segmentation, anomaly detection |
| Detect objects in images | Computer Vision | YOLO, DETR, Mask R-CNN |
| Process audio/speech | Audio | Whisper, TTS, music generation |
| Build a chatbot with RAG | RAG | Vector stores, retrievers, rerankers |
| Fine-tune LLMs | LoRA Fine-tuning | QLoRA, DoRA, AdaLoRA |
| Generate images | Diffusion Models | Stable Diffusion, DALL-E 3 |
| Train RL agents | Reinforcement Learning | DQN, PPO, SAC, multi-agent |
| Forecast time series | Time Series | ARIMA, Prophet, N-BEATS |
| Scale training | Distributed Training | Multi-GPU, multi-node |
Installation
dotnet add package AiDotNet
Requirements: .NET 10.0 / .NET 8.0+ (or .NET Framework 4.7.1+)
Hello World Example
using AiDotNet;
// Build and train a model in one fluent chain
var result = await new AiModelBuilder<double, double[], double>()
.ConfigureModel(new NeuralNetwork<double>(inputSize: 4, hiddenSize: 16, outputSize: 3))
.ConfigureOptimizer(new AdamOptimizer<double>())
.ConfigurePreprocessing() // Auto-applies StandardScaler + Imputer
.BuildAsync(features, labels);
// Make predictions using the facade pattern
var prediction = result.Predict(newSample);
Complete Feature Reference
Neural Networks (100+ Architectures)
<details> <summary><strong>Click to expand all neural network types</strong></summary>
Core Architectures
NeuralNetwork- Feedforward networksConvolutionalNeuralNetwork- CNNs for imagesRecurrentNeuralNetwork- RNNs for sequencesLSTMNeuralNetwork- Long Short-Term MemoryGRUNeuralNetwork- Gated Recurrent UnitsTransformerArchitecture- Attention-based modelsResNetNetwork- Residual networksDenseNetNetwork- Densely connected networksEfficientNetNetwork- Efficient scalingMobileNetV2Network,MobileNetV3Network- Mobile-optimized
Generative Models
GenerativeAdversarialNetwork(GAN)DCGAN,ConditionalGAN,CycleGANProgressiveGAN,BigGAN,StyleGANACGAN,InfoGAN,Pix2PixAutoencoder,VariationalAutoencoder
Graph Neural Networks
GraphNeuralNetwork(GNN)GraphAttentionNetwork(GAT)GraphSAGENetworkGraphIsomorphismNetwork(GIN)GraphGenerationModel
Specialized Architectures
CapsuleNetwork- Capsule networksSpikingNeuralNetwork- Neuromorphic computingQuantumNeuralNetwork- Quantum MLHyperbolicNeuralNetwork- Hyperbolic geometryMixtureOfExpertsNeuralNetwork- MoENeuralTuringMachine- NTMDifferentiableNeuralComputer- DNCMemoryNetwork- Memory-augmentedEchoStateNetwork- Reservoir computingLiquidStateMachine- Liquid state machinesHopfieldNetwork- Associative memoryRestrictedBoltzmannMachine- RBMDeepBeliefNetwork- DBNDeepBoltzmannMachine- DBMRadialBasisFunctionNetwork- RBFSelfOrganizingMap- SOMExtremeLearningMachine- ELMNEAT- Neuroevolution
Vision-Language Models
ClipNeuralNetwork- CLIPBlipNeuralNetwork,Blip2NeuralNetwork- BLIPLLaVANeuralNetwork- LLaVAFlamingoNeuralNetwork- FlamingoGpt4VisionNeuralNetwork- GPT-4V
Attention Mechanisms
AttentionNetworkFlashAttention- Memory-efficient attentionMultiHeadAttention
</details>
Example:
var model = new AiModelBuilder<double, Tensor<double>, Tensor<double>>()
.ConfigureModel(new ConvolutionalNeuralNetwork<double>(
inputChannels: 3,
numClasses: 1000,
architecture: CNNArchitecture.ResNet50))
.ConfigureOptimizer(new AdamWOptimizer<double>(learningRate: 0.001))
.ConfigureMixedPrecision() // FP16 training
.ConfigureGpuAcceleration()
.BuildAsync(trainImages, trainLabels);
Classification (28+ Algorithms)
<details> <summary><strong>Click to expand all classification algorithms</strong></summary>
Ensemble Methods
RandomForestClassifierGradientBoostingClassifierAdaBoostClassifierExtraTreesClassifierBaggingClassifierStackingClassifierVotingClassifier
Naive Bayes
GaussianNaiveBayesMultinomialNaiveBayesBernoulliNaiveBayesComplementNaiveBayesCategoricalNaiveBayes
Linear Models
LogisticRegressionRidgeClassifierSGDClassifierPassiveAggressiveClassifierPerceptronClassifier
Support Vector Machines
LinearSupportVectorClassifierSupportVectorClassifier
Discriminant Analysis
LinearDiscriminantAnalysisQuadraticDiscriminantAnalysis
Multi-label/Multi-output
OneVsRestClassifierOneVsOneClassifierClassifierChainMultiOutputClassifier
Neighbors
KNeighborsClassifier
</details>
Example:
var result = await new AiModelBuilder<double, double[], double>()
.ConfigureModel(new RandomForestClassifier<double>(nEstimators: 100))
.ConfigurePreprocessing(pipeline => pipeline
.Add(new StandardScaler<double>())
.Add(new SimpleImputer<double>()))
.ConfigureCrossValidation(new KFoldCrossValidator<double>(k: 5))
.BuildAsync(features, labels);
Console.WriteLine($"Accuracy: {result.CrossValidationResult?.MeanAccuracy:P2}");
Regression (41+ Algorithms)
<details> <summary><strong>Click to expand all regression algorithms</strong></summary>
Linear Models
MultipleRegressionPolynomialRegressionRidgeRegressionLassoRegressionElasticNetRegressionBayesianRegressionOrthogonalRegression
Tree-Based
DecisionTreeRegressionGradientBoostingRegressionAdaBoostR2RegressionExtremelyRandomizedTreesRegressionM5ModelTreeRegressionConditionalInferenceTreeRegression
Kernel Methods
GaussianProcessRegressionKernelRidgeRegressionSupportVectorRegression
Specialized
IsotonicRegressionLocallyWeightedRegressionPartialLeastSquaresRegressionMultivariateRegressionGeneralizedAdditiveModelRegression
Probabilistic
PoissonRegressionNegativeBinomialRegressionQuantileRegressionRobustRegression
Neural Network Based
MultilayerPerceptronRegressionNeuralNetworkRegression
Optimization-Based
GeneticAlgorithmRegression
</details>
Example:
var result = await new AiModelBuilder<double, double[], double>()
.ConfigureModel(new GradientBoostingRegression<double>(
nEstimators: 200,
maxDepth: 5,
learningRate: 0.1))
.ConfigureHyperparameterOptimizer(
new BayesianOptimizer<double>(),
searchSpace: new HyperparameterSearchSpace()
.AddContinuous("learning_rate", 0.01, 0.3)
.AddInteger("max_depth", 3, 10),
trials: 50)
.BuildAsync(features, targets);
Clustering (20+ Algorithms)
<details> <summary><strong>Click to expand all clustering algorithms</strong></summary>
Centroid-Based
KMeansClusteringKMedoidsClusteringMiniBatchKMeans
Density-Based
DBSCANHDBSCANOPTICSMeanShiftDenclue
Hierarchical
AgglomerativeClusteringBIRCHCURE
Model-Based
GaussianMixtureClusteringBayesianGaussianMixture
Spectral
SpectralClustering
Self-Organizing
GMeansXMeans
Distance Metrics
EuclideanDistanceManhattanDistanceCosineDistanceMahalanobisDistanceChebyshevDistanceMinkowskiDistance
Validation Metrics
SilhouetteScoreDaviesBouldinIndexCalinskiHarabaszIndexDunnIndexAdjustedRandIndex
</details>
Example:
var result = await new AiModelBuilder<double, double[], int>()
.ConfigureModel(new HDBSCAN<double>(minClusterSize: 15, minSamples: 5))
.ConfigureAutoML(new ClusteringAutoML<double>()) // Auto-tune parameters
.BuildAsync(features);
Console.WriteLine($"Clusters found: {result.Model.Labels.Distinct().Count()}");
Console.WriteLine($"Silhouette Score: {result.ClusteringMetrics?.SilhouetteScore:F3}");
Computer Vision (50+ Models)
<details> <summary><strong>Click to expand all computer vision capabilities</strong></summary>
Object Detection
- YOLO Family: YOLOv5, YOLOv8, YOLOv9, YOLOv10, YOLOv11
- Transformer-Based: DETR, Deformable DETR, DINO
- Two-Stage: Faster R-CNN, Cascade R-CNN
- Anchor-Free: FCOS, CenterNet
Instance Segmentation
- Mask R-CNN
- YOLACT
- SOLOv2
- Segment Anything (SAM)
Semantic Segmentation
- DeepLabV3+
- UNet, UNet++
- PSPNet
- HRNet
Object Tracking
- SORT
- DeepSORT
- ByteTrack
- OC-SORT
OCR & Scene Text
SceneTextReader- Text detection + recognition
- Multi-language support
Pose Estimation
- OpenPose
- HRNet-Pose
- ViTPose
3D Vision
- PointNet, PointNet++
- MeshCNN
- NeRF (Neural Radiance Fields)
</details>
Example:
var builder = new AiModelBuilder<float, Tensor<float>, DetectionResult[]>()
.ConfigureObjectDetector(new YOLOv8Detector<float>(
modelSize: YOLOModelSize.Medium,
confidenceThreshold: 0.5f))
.ConfigureVisualization(new VisualizationOptions { DrawLabels = true });
var result = await builder.BuildAsync();
var detections = result.Model.Detect(image);
foreach (var det in detections)
Console.WriteLine($"{det.Label}: {det.Confidence:P1} at {det.BoundingBox}");
Audio Processing (90+ Models)
<details> <summary><strong>Click to expand all audio capabilities</strong></summary>
Speech Recognition
- Whisper: whisper-tiny, whisper-base, whisper-small, whisper-medium, whisper-large
- Wav2Vec2: Multiple languages
- HuBERT
- Conformer
Text-to-Speech
- VITS
- FastSpeech2
- Tacotron2
- XTTS (multi-speaker, cross-lingual)
Music Generation
- MusicGen
- AudioGen
- Riffusion
Audio Classification
- Audio event detection
- Music genre classification
- Environmental sound classification
Speaker Analysis
- Speaker identification
- Speaker verification
- Speaker diarization
Audio Enhancement
- Noise reduction
- Echo cancellation
- Speech enhancement
Source Separation
- Vocals/instruments separation
- Multi-track separation
Voice Activity Detection
- WebRTC VAD
- Silero VAD
Emotion Recognition
- Speech emotion classification
Music Analysis
- Beat detection
- Chord recognition
- Key detection
- Tempo estimation
</details>
Example:
// Speech-to-Text with Whisper
var whisper = new WhisperModel<float>(WhisperModelSize.Medium, language: "en");
var transcription = await whisper.TranscribeAsync(audioFile);
Console.WriteLine(transcription.Text);
// Text-to-Speech
var tts = new VITSModel<float>(voice: "en-US-female");
var audio = await tts.SynthesizeAsync("Hello, world!");
await audio.SaveAsync("output.wav");
Video Processing (34+ Models)
<details> <summary><strong>Click to expand all video capabilities</strong></summary>
Video Generation
- Stable Video Diffusion
- AnimateDiff
- VideoCrafter
- Text2Video
Action Recognition
- SlowFast
- TimeSformer
- Video Swin Transformer
Video Understanding
- CLIP4Clip
- Video captioning
Optical Flow
- RAFT
- FlowNet
Video Object Detection
- Video object tracking
- Multi-object tracking
</details>
Example:
var videoGen = new StableVideoDiffusion<float>();
var video = await videoGen.GenerateAsync(
prompt: "A cat playing piano",
numFrames: 24,
fps: 8);
await video.SaveAsync("output.mp4");
Reinforcement Learning (80+ Agents)
<details> <summary><strong>Click to expand all RL agents</strong></summary>
Value-Based
DQNAgent- Deep Q-NetworkDoubleDQNAgent- Double DQNDuelingDQNAgent- Dueling architectureRainbowDQNAgent- Rainbow (all improvements)QLearningAgent,DoubleQLearningAgentSARSAAgent,ExpectedSARSAAgentNStepQLearningAgent,NStepSARSAAgent
Policy Gradient
REINFORCEAgentA2CAgent- Advantage Actor-CriticA3CAgent- Asynchronous A3CPPOAgent- Proximal Policy Optimization
Actor-Critic
DDPGAgent- Deep Deterministic PGTD3Agent- Twin Delayed DDPGSACAgent- Soft Actor-Critic
Model-Based
DreamerAgent- World modelsMuZeroAgent- MuZeroDynaQAgent,DynaQPlusAgentPrioritizedSweepingAgent
Multi-Agent
MADDPGAgent- Multi-Agent DDPGQMIXAgent- QMIX
Offline RL
CQLAgent- Conservative Q-LearningIQLAgent- Implicit Q-Learning
Monte Carlo
MonteCarloExploringStartsAgentFirstVisitMonteCarloAgentEveryVisitMonteCarloAgentOffPolicyMonteCarloAgent
Planning
MCTSNode- Monte Carlo Tree SearchPolicyIterationAgentModifiedPolicyIterationAgent
Bandits
EpsilonGreedyBanditAgentUCBBanditAgentThompsonSamplingAgentGradientBanditAgent
Sequence Models
DecisionTransformerAgent
</details>
Example:
var env = new CartPoleEnvironment();
var agent = new PPOAgent<double>(
stateSize: env.ObservationSpace,
actionSize: env.ActionSpace,
hiddenSize: 64,
learningRate: 3e-4);
// Training loop
for (int episode = 0; episode < 1000; episode++)
{
var state = env.Reset();
double totalReward = 0;
while (!env.IsDone)
{
var action = agent.SelectAction(state);
var (nextState, reward, done) = env.Step(action);
agent.Store(state, action, reward, nextState, done);
state = nextState;
totalReward += reward;
}
agent.Train();
Console.WriteLine($"Episode {episode}: Reward = {totalReward}");
}
Time Series (30+ Models)
<details> <summary><strong>Click to expand all time series models</strong></summary>
Classical Statistical
ARModel- AutoregressiveMAModel- Moving AverageARMAModel- ARMAARIMAModel- ARIMASARIMAModel- Seasonal ARIMAARIMAXModel- ARIMAX with exogenous variablesGARCHModel- Volatility modelingVARModel,VARMAModel- Vector models
Exponential Smoothing
ExponentialSmoothingModelHoltWintersModelTBATSModel
Deep Learning
NBEATSModel- N-BEATSNHiTSModel- N-HiTSDeepARModel- DeepARTemporalFusionTransformerInformerModel- InformerAutoformerModel- AutoformerChronosFoundationModel- Chronos
Anomaly Detection
DeepANTLSTMVAETimeSeriesIsolationForest
Specialized
ProphetModel- Facebook ProphetStateSpaceModelBayesianStructuralTimeSeriesModelSpectralAnalysisModel
</details>
Example:
var result = await new AiModelBuilder<double, double[], double>()
.ConfigureModel(new NBEATSModel<double>(
stackTypes: new[] { StackType.Trend, StackType.Seasonality, StackType.Generic },
horizonSize: 24))
.ConfigureTrainingPipeline(new TrainingPipelineConfiguration<double>
{
EarlyStopping = new EarlyStoppingConfig { Patience = 10 }
})
.BuildAsync(historicalData);
var forecast = result.Model.Forecast(steps: 24);
Retrieval-Augmented Generation (50+ Components)
<details> <summary><strong>Click to expand all RAG components</strong></summary>
Vector Stores
- In-memory vector store
- FAISS integration
- Pinecone, Weaviate, Qdrant adapters
- Chroma, Milvus support
Embedding Models
- OpenAI embeddings
- HuggingFace embeddings
- Sentence Transformers
- BGE, ColBERT
Retrievers
- Dense retriever
- Sparse retriever (BM25)
- Hybrid retriever
- Multi-query retriever
- Self-query retriever
Rerankers
- Cross-encoder reranker
- ColBERT reranker
- Cohere reranker
Document Processing
- Text splitters (recursive, semantic)
- Document loaders
- Chunking strategies
Graph RAG
- Knowledge graph construction
- Entity extraction
- Relation extraction
- Graph traversal retrieval
Query Processing
- Query expansion
- Query rewriting
- HyDE (Hypothetical Document Embeddings)
</details>
Example:
var result = await new AiModelBuilder<float, string, string>()
.ConfigureRetrievalAugmentedGeneration(
retriever: new HybridRetriever<float>(
denseRetriever: new DenseRetriever<float>(embeddingModel),
sparseRetriever: new BM25Retriever(),
alpha: 0.7f),
reranker: new CrossEncoderReranker<float>(),
generator: new LLMGenerator<float>(llmClient),
queryProcessors: new[] { new QueryExpander() })
.BuildAsync();
var answer = await result.Model.QueryAsync("What is the capital of France?", documents);
LoRA Fine-tuning (37+ Adapters)
<details> <summary><strong>Click to expand all LoRA variants</strong></summary>
Standard LoRA
LoRAAdapter- Original LoRALoRAPlusAdapter- LoRA+
Quantized
QLoRAAdapter- 4-bit quantizationQALoRAAdapter- Quantization-aware
Memory Efficient
DoRAAdapter- Weight-DecomposedVeRAAdapter- Very efficientNOLAAdapter- Noise-optimized
Rank Adaptation
AdaLoRAAdapter- Adaptive rankDyLoRAAdapter- Dynamic rankReLoRAAdapter- Recursive
Specialized
LoHaAdapter- Hadamard productLoKrAdapter- Kronecker productMoRAAdapter- Mixture of ranksLongLoRAAdapter- Long contextGraphConvolutionalLoRAAdapter- For GNNs
Advanced
PiSSAAdapter- Principal singular valuesFloraAdapter- Floating-pointDeltaLoRAAdapter- Delta updatesLoftQAdapter- Quantization-aware initChainLoRAAdapter- Chained adapters
</details>
Example:
var result = await new AiModelBuilder<float, string, string>()
.ConfigureLoRA(new QLoRAConfiguration<float>
{
Rank = 16,
Alpha = 32,
TargetModules = new[] { "q_proj", "v_proj", "k_proj", "o_proj" },
QuantizationBits = 4,
UseDoubleQuantization = true
})
.ConfigureFineTuning(new FineTuningConfiguration<float>
{
BaseModel = "meta-llama/Llama-2-7b-hf",
TrainingArguments = new TrainingArguments
{
NumEpochs = 3,
BatchSize = 4,
GradientAccumulationSteps = 8
}
})
.BuildAsync(trainingData);
Diffusion Models (20+ Models)
<details> <summary><strong>Click to expand all diffusion models</strong></summary>
Image Generation
StableDiffusionModelSDXLModel- Stable Diffusion XLDallE3Model- DALL-E 3PixArtModel- PixArt
Image Editing
ControlNetModelIPAdapterModel- Inpainting, Outpainting
Audio Generation
AudioLDMModel,AudioLDM2ModelMusicGenModelRiffusionModelDiffWaveModel
Video Generation
StableVideoDiffusionAnimateDiffModelVideoCrafterModel
3D Generation
DreamFusionModelMVDreamModelShapEModelPointEModelZero123Model
Architectures
DDPMModel- Denoising DiffusionConsistencyModel- Fast inference- Various schedulers (DDIM, PNDM, etc.)
</details>
Example:
var diffusion = new SDXLModel<float>();
var image = await diffusion.GenerateAsync(
prompt: "A photorealistic cat astronaut on Mars",
negativePrompt: "blurry, low quality",
width: 1024,
height: 1024,
numInferenceSteps: 30,
guidanceScale: 7.5f);
await image.SaveAsync("output.png");
Distributed Training
<details> <summary><strong>Click to expand distributed training options</strong></summary>
Data Parallelism
DDPModel- Distributed Data ParallelDDPOptimizer
Model Parallelism
PipelineParallelModelTensorParallelModel
Fully Sharded
FSDPModel- Fully Sharded Data ParallelZeROOptimizer(Stage 1, 2, 3)HybridShardedModel
Communication
- NCCL backend (NVIDIA)
- Gloo backend
- MPI backend
Optimization
GradientCompressionOptimizerAsyncSGDOptimizerLocalSGDOptimizerElasticOptimizer- Fault-tolerant
</details>
Example:
var result = await new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(largeModel)
.ConfigureDistributedTraining(
strategy: DistributedStrategy.FSDP,
backend: new NCCLCommunicationBackend(),
configuration: new FSDPConfiguration
{
ShardingStrategy = ShardingStrategy.FullShard,
MixedPrecision = true,
ActivationCheckpointing = true
})
.ConfigureGpuAcceleration(new GpuAccelerationConfig { DeviceIds = new[] { 0, 1, 2, 3 } })
.BuildAsync(trainData);
Meta-Learning (18+ Algorithms)
<details> <summary><strong>Click to expand meta-learning methods</strong></summary>
Optimization-Based
MAMLAlgorithm- Model-Agnostic Meta-LearningiMAMLAlgorithm- Implicit MAMLReptileAlgorithmMetaSGDAlgorithmANILAlgorithm- Almost No Inner LoopBOILAlgorithm- Body Only Inner Loop
Metric-Based
ProtoNetsAlgorithm- Prototypical NetworksMatchingNetworksAlgorithmRelationNetworkAlgorithm
Memory-Based
MANNAlgorithm- Memory-Augmented NNNTMAlgorithm- Neural Turing Machine
Hybrid
LEOAlgorithm- Latent Embedding OptimizationCNAPAlgorithm- Conditional Neural Adaptive ProcessesTADAMAlgorithm- Task-Dependent Adaptive MetricMetaOptNetAlgorithmGNNMetaAlgorithm- Graph-based
</details>
Example:
var result = await new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureMetaLearning(new MAMLAlgorithm<float>(
innerLearningRate: 0.01f,
outerLearningRate: 0.001f,
innerSteps: 5))
.BuildAsync(metaTrainTasks);
// Few-shot learning on new task
var adapted = result.MetaLearner.Adapt(supportSet, numSteps: 10);
var predictions = adapted.Predict(querySet);
Self-Supervised Learning (10+ Methods)
<details> <summary><strong>Click to expand SSL methods</strong></summary>
Contrastive
SimCLRMoCo- Momentum ContrastBYOL- Bootstrap Your Own LatentBarlowTwinsSwAV- Swapping Assignments
Masked
MAE- Masked AutoencoderBEiT
Distillation
DINO- Self-DistillationiBOT
Evaluation
- Linear probing
- KNN evaluation
- Transfer benchmarks
</details>
Optimizers (42+)
<details> <summary><strong>Click to expand all optimizers</strong></summary>
Adaptive Learning Rate
AdamOptimizer,AdamWOptimizerAdagradOptimizerAdaDeltaOptimizerAdaMaxOptimizerAMSGradOptimizerNadamOptimizer
Momentum-Based
MomentumOptimizerNesterovAcceleratedGradientOptimizer
Second-Order
BFGSOptimizer,LBFGSOptimizerNewtonMethodOptimizerLevenbergMarquardtOptimizerConjugateGradientOptimizer
Large-Scale
LAMBOptimizer- Layer-wise AdaptiveLARSOptimizer- Layer-wise Rate ScalingLionOptimizer- Evolved Sign Momentum
Regularized
FTRLOptimizer- Follow-The-Regularized-Leader
Evolutionary
GeneticAlgorithmOptimizerParticleSwarmOptimizerDifferentialEvolutionOptimizerCMAESOptimizer- Covariance Matrix AdaptationAntColonyOptimizer
Specialized
BayesianOptimizer- Hyperparameter tuningNelderMeadOptimizer- Simplex methodCoordinateDescentOptimizerADMMOptimizer- Alternating Direction
</details>
Loss Functions (37+)
- Classification: CrossEntropy, BinaryCrossEntropy, FocalLoss, LabelSmoothing
- Regression: MSE, MAE, Huber, LogCosh, Quantile
- Segmentation: Dice, IoU, Tversky, Lovász
- Metric Learning: Triplet, Contrastive, ArcFace, CosFace, Circle
- Generative: Wasserstein, Hinge, LSGAN
- Multi-task: Uncertainty-weighted, GradNorm
Additional Features
AutoML
- Hyperparameter optimization (Bayesian, Random, Grid)
- Neural Architecture Search (NAS)
- Feature selection
- Model selection
Federated Learning
- FedAvg, FedProx, FedNova
- Secure aggregation
- Differential privacy
- Client selection strategies
Tokenization (HuggingFace Compatible)
- BPE, WordPiece, Unigram, SentencePiece
- Pre-trained tokenizer loading
- Custom tokenizer training
Model Compression
- Pruning (magnitude, structured)
- Quantization (INT8, FP16, INT4)
- Knowledge distillation
- Low-rank factorization
Uncertainty Quantification
- Monte Carlo Dropout
- Deep Ensembles
- Bayesian Neural Networks
- Conformal Prediction
Data Augmentation
- Image: Flip, rotate, crop, color jitter, MixUp, CutMix, AutoAugment
- Text: Synonym replacement, back-translation, EDA
- Audio: Time stretch, pitch shift, noise injection
- Tabular: SMOTE, ADASYN
Experiment Tracking
- Experiment management
- Metric logging
- Checkpoint management
- Model registry
Prompt Engineering
- Prompt templates
- Chain-of-thought
- Few-shot learning
- Prompt optimization
Samples
See the samples/ directory for complete, runnable examples:
| Category | Sample | Description |
|---|---|---|
| Getting Started | HelloWorld | Your first AiDotNet model |
| Classification | SentimentAnalysis | Text sentiment with NaiveBayes |
| Computer Vision | ObjectDetection | YOLOv8 object detection |
| Audio | SpeechRecognition | Whisper transcription |
| RAG | BasicRAG | Build a Q&A system |
| RL | CartPole | Train a PPO agent |
API Reference
Full API documentation is available at ooples.github.io/AiDotNet.
Key namespaces:
AiDotNet- Core builder and result typesAiDotNet.NeuralNetworks- All neural network architecturesAiDotNet.Classification- Classification algorithmsAiDotNet.Regression- Regression algorithmsAiDotNet.Clustering- Clustering algorithmsAiDotNet.ComputerVision- Vision modelsAiDotNet.Audio- Audio processingAiDotNet.ReinforcementLearning- RL agentsAiDotNet.RetrievalAugmentedGeneration- RAG componentsAiDotNet.LoRA- Fine-tuning adaptersAiDotNet.Diffusion- Diffusion modelsAiDotNet.DistributedTraining- Distributed strategiesAiDotNet.MetaLearning- Meta-learning algorithmsAiDotNet.TimeSeries- Time series modelsAiDotNet.Optimizers- Optimization algorithms
Platform Support
| Platform | Status |
|---|---|
| Windows | ✅ Full support |
| Linux | ✅ Full support |
| macOS | ✅ Full support |
| .NET 10.0 | ✅ Primary target |
| .NET 8.0+ | ✅ Supported |
| .NET Framework 4.7.1+ | ✅ Supported |
GPU Acceleration
| Backend | Status |
|---|---|
| CUDA (NVIDIA) | ✅ Full support |
| OpenCL | ✅ Full support |
| Metal (Apple) | 🚧 Coming soon |
Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Areas where we especially welcome help:
- Additional model implementations
- Performance optimizations
- Documentation and examples
- Bug fixes and testing
Community
- Issues: Report bugs or request features
- Discussions: Ask questions or share ideas
- Security: Report vulnerabilities
License
Apache License 2.0 - see LICENSE for details.
<div align="center">
Made with care for the .NET AI/ML community
⭐ Star us on GitHub • 📦 NuGet Package
</div>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net471 is compatible. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.1
- AiDotNet.Native.CLBlast (>= 0.4.0)
- AiDotNet.Native.OneDNN (>= 0.4.0)
- AiDotNet.Native.OpenBLAS (>= 0.4.0)
- AiDotNet.Tensors (>= 0.4.0)
- Azure.Search.Documents (>= 11.7.0)
- Elastic.Clients.Elasticsearch (>= 9.2.2)
- FftSharp (>= 2.2.0)
- Google.Protobuf (>= 3.33.2)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Data.Sqlite (>= 8.0.22)
- Microsoft.ML.OnnxRuntime (>= 1.23.2)
- Microsoft.Research.SEALNet (>= 4.1.1)
- Newtonsoft.Json (>= 13.0.4)
- Pinecone.Client (>= 4.0.2)
- StackExchange.Redis (>= 2.10.1)
- System.Numerics.Tensors (>= 10.0.1)
- System.ValueTuple (>= 4.6.1)
- TreeSitter.DotNet (>= 1.2.0)
-
net10.0
- AiDotNet.Native.CLBlast (>= 0.4.0)
- AiDotNet.Native.OneDNN (>= 0.4.0)
- AiDotNet.Native.OpenBLAS (>= 0.4.0)
- AiDotNet.Tensors (>= 0.4.0)
- Azure.Search.Documents (>= 11.7.0)
- Elastic.Clients.Elasticsearch (>= 9.2.2)
- FftSharp (>= 2.2.0)
- Google.Protobuf (>= 3.33.2)
- Microsoft.Data.Sqlite (>= 8.0.22)
- Microsoft.ML.OnnxRuntime (>= 1.23.2)
- Microsoft.Research.SEALNet (>= 4.1.1)
- Newtonsoft.Json (>= 13.0.4)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.0)
- Pinecone.Client (>= 4.0.2)
- StackExchange.Redis (>= 2.10.1)
- System.Numerics.Tensors (>= 10.0.1)
- System.ValueTuple (>= 4.6.1)
- TreeSitter.DotNet (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.68.0 | 2 | 1/24/2026 |
| 0.67.0 | 32 | 1/23/2026 |
| 0.66.0 | 32 | 1/23/2026 |
| 0.65.0 | 30 | 1/22/2026 |
| 0.64.0 | 40 | 1/22/2026 |
| 0.63.0 | 36 | 1/21/2026 |
| 0.62.0 | 35 | 1/21/2026 |
| 0.61.0 | 39 | 1/21/2026 |
| 0.60.0 | 36 | 1/20/2026 |
| 0.59.0 | 34 | 1/20/2026 |
| 0.58.0 | 38 | 1/20/2026 |
| 0.57.0 | 43 | 1/19/2026 |
| 0.56.0 | 39 | 1/19/2026 |
| 0.55.0 | 39 | 1/19/2026 |
| 0.54.0 | 39 | 1/19/2026 |
| 0.53.0 | 42 | 1/17/2026 |
| 0.52.0 | 49 | 1/17/2026 |
| 0.51.0 | 43 | 1/14/2026 |
| 0.50.0 | 47 | 1/14/2026 |
| 0.49.0 | 42 | 1/13/2026 |
| 0.48.0 | 52 | 1/11/2026 |
| 0.47.0 | 43 | 1/11/2026 |
| 0.46.0 | 48 | 1/11/2026 |
| 0.45.0 | 50 | 12/31/2025 |
| 0.44.0 | 50 | 12/30/2025 |
| 0.43.0 | 50 | 12/29/2025 |
| 0.42.0 | 48 | 12/28/2025 |
| 0.41.0 | 48 | 12/28/2025 |
| 0.40.0 | 47 | 12/28/2025 |
| 0.39.0 | 57 | 12/28/2025 |
| 0.38.0 | 47 | 12/28/2025 |
| 0.37.0 | 52 | 12/28/2025 |
| 0.36.0 | 48 | 12/28/2025 |
| 0.35.0 | 44 | 12/27/2025 |
| 0.34.0 | 45 | 12/27/2025 |
| 0.33.0 | 55 | 12/27/2025 |
| 0.32.0 | 45 | 12/27/2025 |
| 0.31.0 | 44 | 12/27/2025 |
| 0.30.0 | 48 | 12/27/2025 |
| 0.29.0 | 46 | 12/27/2025 |
| 0.28.0 | 55 | 12/26/2025 |
| 0.27.0 | 115 | 12/26/2025 |
| 0.26.0 | 125 | 12/26/2025 |
| 0.25.0 | 126 | 12/26/2025 |
| 0.24.0 | 130 | 12/25/2025 |
| 0.23.0 | 126 | 12/25/2025 |
| 0.22.0 | 135 | 12/25/2025 |
| 0.21.0 | 137 | 12/24/2025 |
| 0.20.0 | 131 | 12/22/2025 |
| 0.19.0 | 140 | 12/22/2025 |
| 0.18.0 | 131 | 12/22/2025 |
| 0.17.0 | 132 | 12/22/2025 |
| 0.16.0 | 129 | 12/22/2025 |
| 0.15.0 | 112 | 12/21/2025 |
| 0.14.0 | 80 | 12/21/2025 |
| 0.13.0 | 76 | 12/21/2025 |
| 0.12.0 | 82 | 12/20/2025 |
| 0.11.0 | 214 | 12/19/2025 |
| 0.10.0 | 232 | 12/17/2025 |
| 0.9.0 | 231 | 12/17/2025 |
| 0.8.0 | 198 | 12/15/2025 |
| 0.7.0 | 178 | 12/14/2025 |
| 0.6.0 | 167 | 12/14/2025 |
| 0.5.0 | 178 | 12/14/2025 |
| 0.4.0 | 118 | 12/14/2025 |
| 0.3.0 | 386 | 12/11/2025 |
| 0.2.0 | 116 | 11/15/2025 |
| 0.1.0 | 252 | 11/12/2025 |
| 0.0.5-preview | 333 | 10/16/2023 |
| 0.0.3-preview | 143 | 9/24/2023 |
| 0.0.2-preview | 160 | 9/24/2023 |
| 0.0.1-preview | 132 | 9/23/2023 |