Cider.NET
0.1.34
See the version list below for details.
dotnet add package Cider.NET --version 0.1.34
NuGet\Install-Package Cider.NET -Version 0.1.34
<PackageReference Include="Cider.NET" Version="0.1.34" />
<PackageVersion Include="Cider.NET" Version="0.1.34" />
<PackageReference Include="Cider.NET" />
paket add Cider.NET --version 0.1.34
#r "nuget: Cider.NET, 0.1.34"
#:package Cider.NET@0.1.34
#addin nuget:?package=Cider.NET&version=0.1.34
#tool nuget:?package=Cider.NET&version=0.1.34
Cider.NET
Low-level System One decision model library (Choice, Score, Noul) for .NET, written in G#.
Cider.NET evaluates structured or unstructured application state against bounded, typed questions in a single prefill forward pass, reading next-token logits over permitted option labels to return calibrated probability distributions and confidence scores without autoregressive text generation.
Installation
dotnet add package Cider.NET
For in-process GGUF weight loading (libllama Metal/CPU P/Invoke and pure-G# selective LM-head projection), also install Cider.Native.
Quick Start (G#)
package Demo
import Cider
import System
let backend = OllamaRawBackend("http://127.0.0.1:11434")
let client = DecisionClient(backend, "qwen3:0.6b")
let req = DecisionRequest.Create(
"qwen3:0.6b",
"Customer says: I was charged twice on my invoice and need an immediate refund.",
NamedQuestion("team", Question.Choice(
"Which team should handle this ticket?",
ChoiceOption("billing", "Invoices, charges, and refunds"),
ChoiceOption("technical", "Product bugs and outages")
)),
NamedQuestion("urgency", Question.Score(
"How urgent is this request?",
"Routine", "Time-sensitive", "Critical"
)),
NamedQuestion("refund", Question.Noul("Is the customer explicitly requesting a refund?"))
)
let resp = client.Decide(req)
Console.WriteLine("Team: ${resp.GetAnswer("team")?.SelectedChoice}")
Console.WriteLine("Urgency: ${resp.GetAnswer("urgency")?.ScoreValue}")
Console.WriteLine("Refund P(yes): ${resp.GetAnswer("refund")?.NoulValue}")
Features
- Three Decision Primitives:
Choice(up to 255 options),Score(up to 50 ordered rubric levels), andNoul(calibrated binary probability in[0, 1]). - Pluggable Prompt Policies & Model-Family Layouts:
PromptStructureV1(Simple-Jev v1),StateFirstV1(state-first V1 layout for cross-request KV/prefix reuse across different questions),Tev1(Together AI Tev1), andDecider(Mapika/decider), paired withPromptLayout/PromptLayoutRegistrysupportingchatml(Qwen, default),llama3(Llama 3 / 3.1 / 3.2),gemma(Gemma 2 / 3),phi3(Phi-3 / 3.5),mistral(Mistral Instruct), custom layouts, GGUF metadata auto-detection (DetectFromGgufMetadata), and per-layout control-token sanitization. - Strict Readout-Boundary Label Validation: Validates via
LabelTokenValidatorandDecisionClient.ValidateLabels(request)that every candidate label encodes to a single, pairwise-distinct vocabulary token at the active assistant prefill boundary without splitting or merging, throwing typedInvalidLabelTokenException(HTTP422) on mismatch. - Position-Bias Cancellation:
Permutations = 2evaluates forward and reversed option orders and averages probabilities. - Anti-Injection State Fencing & Label-Mass Guard: Random 64-bit hex
<state-{nonce}>boundary tags andMinLabelMassenforcement. - Calibration Math & Packaged Calibration Workflow: Jev 1.13
ChoiceConfidence&ScoreConfidence,EntropyConfidence,ExpectedCalibrationError(ECE),BrierScore,NegativeLogLikelihood,FitTemperature,FitPlattScaling, andEstimateLabelPriorBias, packaged intoCalibrationWorkflow.Fit/FitAsync(CalibrationExample,CalibrationFitOptions, suggested confidence threshold for target selective accuracy) and a NativeAOT-safe versioned JSON format (CalibrationProfile, schema v1) keyed byIModelIdentityProviderSHA-256model_hash,prompt_layout,prompt_policy, and per-question_identries loaded fail-closed ontoDecisionClient(LoadCalibration/SetCalibration, throwingCalibrationMismatchExceptionon model hash, layout, policy, or question-shape mismatch). - Cancellation & Deadlines:
DecideAsync(..., ct), per-requestDecisionOptions.Timeout/Deadline, and non-throwingTryDecideAsync/TryDecideOutcomereturningDecisionOutcome(Succeeded,Cancelled,DeadlineExceeded,NoAnswer,StateTooLarge,Failed). - State Token Budgeting & Truncation:
CountPromptTokens(request)for exact pre-flight token accounting, opt-inStateTruncationPolicy(Reject[default],KeepHeadAndTail,KeepHead,KeepTail) that truncates only inside the cryptographic state fence, typedStateTooLargeException, andDecisionResponse.StateBudgetreportingStateTokensUsedandStateTokensDropped. - Stateless Embeddings Contract & Vector Math:
IEmbeddingBackend(Embed/EmbedAsync),EmbeddingPooling(Auto,Mean,Last,Cls),EmbeddingOptions(Normalize,TruncateToContext, opt-inMaxSequencesPerBatchfor native multi-sequence evaluation),EmbeddingProvenance(model ID, SHA-256ModelHash, resolved pooling, normalization flag, dimensions),EmbeddingBatchResult(with ordered per-rowRowTokensoriginal/effective counts and truncation flags, andNativeEvaluations; see ADR-0019), andEmbeddingMath(CosineSimilarity,L2Normalize,L2Norm), also implemented onDeterministicLogitBackendfor fast CI-safe testing. - Explicit-Configuration Mode & Logging Hook: Set
ExplicitConfiguration = trueonDecisionClient,SystemOneHttpBackend(SystemOneHttpBackendOptions), andOllamaRawBackendto disable default remote/local URLs and default modeljev-latest; attach a zero-dependencyICiderLogger(DelegateCiderLogger) to capture structured(CiderLogLevel, category, message)diagnostics without writing tostderr. - NativeAOT & Trimming Compatible: Marked
<IsAotCompatible>true</IsAotCompatible>with zero reflection-based JSON serialization and zeroIL2xxx/IL3xxxwarnings underPublishAot=true, verified in CI for JIT/NativeAOT output parity on Linux, Windows, and macOS.
License
MIT — see LICENSE.
| 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. |
-
net10.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Cider.NET:
| Package | Downloads |
|---|---|
|
Cider.Native
In-process GGUF v3 weight loader, byte-level BPE tokenizer, K-row selective LM-head projection engine, and libllama Metal/CPU P/Invoke backend for Cider.NET. |
|
|
Hyperplane.Cider
Optional reader adapter for Hyperplane.NET: CiderEmbedder turns any Cider.NET IEmbeddingBackend (including Cider.Native's in-process llama.cpp LlamaEmbedder over GGUF models) into a Hyperplane IEmbedder with an honest, provenance-derived experimental profile. |
GitHub repositories
This package is not used by any popular GitHub repositories.