extraction

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchitectureInfo

type ArchitectureInfo struct {
	Type            string
	Layers          int
	ParameterRange  ParameterRange
	ContextWindow   int
	TokenVocabulary int
	Confidence      float64
}

ArchitectureInfo contains inferred architecture details

type ArchitectureProbe

type ArchitectureProbe struct {
	// contains filtered or unexported fields
}

ArchitectureProbe probes for architecture information

func (*ArchitectureProbe) Analyze

func (ap *ArchitectureProbe) Analyze(results []ProbeResult) ModelInfo

func (*ArchitectureProbe) Execute

func (ap *ArchitectureProbe) Execute(target interface{}) (ProbeResult, error)

func (*ArchitectureProbe) Name

func (ap *ArchitectureProbe) Name() string

type AttributionEngine

type AttributionEngine struct {
	// contains filtered or unexported fields
}

AttributionEngine attributes model to source

func NewAttributionEngine

func NewAttributionEngine() *AttributionEngine

func (*AttributionEngine) AttributeModel

func (ae *AttributionEngine) AttributeModel(results []InferenceResult) float64

type BehaviorMapper

type BehaviorMapper struct {
	// contains filtered or unexported fields
}

BehaviorMapper maps model behavior patterns

func NewBehaviorMapper

func NewBehaviorMapper() *BehaviorMapper

NewBehaviorMapper creates a behavior mapper

func (*BehaviorMapper) MapBehavior

func (bm *BehaviorMapper) MapBehavior(results map[string][]ProbeResult) BehaviorProfile

MapBehavior creates behavior profile from results

type BehaviorPattern

type BehaviorPattern struct {
	Name         string
	Indicators   []string
	Confidence   float64
	Implications []string
}

BehaviorPattern represents a behavioral pattern

type BehaviorProfile

type BehaviorProfile struct {
	Patterns   []string
	Traits     []string
	Weaknesses []string
	Strengths  []string
}

BehaviorProfile represents model behavior profile

type BehaviorTest

type BehaviorTest struct {
	Name    string
	Prompts []string
}

type BehavioralCloningAttack

type BehavioralCloningAttack struct {
	// contains filtered or unexported fields
}

BehavioralCloningAttack clones model behavior

func (*BehavioralCloningAttack) Execute

func (b *BehavioralCloningAttack) Execute(target interface{}, query Query) (InferenceResult, error)

func (*BehavioralCloningAttack) Name

func (b *BehavioralCloningAttack) Name() string

func (*BehavioralCloningAttack) RequiredQueries

func (b *BehavioralCloningAttack) RequiredQueries() int

type Boundary

type Boundary struct {
	Name          string
	TestSizes     []int
	TestTokens    []string
	TestLanguages []string
}

type BoundaryProbingAttack

type BoundaryProbingAttack struct {
	// contains filtered or unexported fields
}

BoundaryProbingAttack tests model boundaries

func (*BoundaryProbingAttack) Execute

func (b *BoundaryProbingAttack) Execute(target interface{}, query Query) (InferenceResult, error)

func (*BoundaryProbingAttack) Name

func (b *BoundaryProbingAttack) Name() string

func (*BoundaryProbingAttack) RequiredQueries

func (b *BoundaryProbingAttack) RequiredQueries() int

type CalibrationQuery

type CalibrationQuery struct {
	Question           string
	ExpectedConfidence float64
}

type CalibrationResult

type CalibrationResult struct {
	Query              string
	ExpectedConfidence float64
	ActualConfidence   float64
}

type Capability

type Capability struct {
	Name       string
	Level      string // basic, intermediate, advanced
	Confidence float64
	Examples   []string
}

Capability represents an inferred capability

type CapabilityProbe

type CapabilityProbe struct {
	// contains filtered or unexported fields
}

CapabilityProbe tests model capabilities

func (*CapabilityProbe) Analyze

func (cp *CapabilityProbe) Analyze(results []ProbeResult) ModelInfo

func (*CapabilityProbe) Execute

func (cp *CapabilityProbe) Execute(target interface{}) (ProbeResult, error)

func (*CapabilityProbe) Name

func (cp *CapabilityProbe) Name() string

type CoherenceMetric

type CoherenceMetric struct{}

CoherenceMetric measures response coherence

func (*CoherenceMetric) Analyze

func (c *CoherenceMetric) Analyze(response string) float64

func (*CoherenceMetric) Name

func (c *CoherenceMetric) Name() string

type CompletionAttackStrategy

type CompletionAttackStrategy struct {
	// contains filtered or unexported fields
}

CompletionAttackStrategy uses completion to extract data

func (*CompletionAttackStrategy) Confidence

func (c *CompletionAttackStrategy) Confidence() float64

func (*CompletionAttackStrategy) Extract

func (c *CompletionAttackStrategy) Extract(target interface{}, topic string) (ExtractionResult, error)

func (*CompletionAttackStrategy) Name

func (c *CompletionAttackStrategy) Name() string

type ComplexityEstimator

type ComplexityEstimator struct{}

ComplexityEstimator estimates parameters from response complexity

func (*ComplexityEstimator) Estimate

func (ce *ComplexityEstimator) Estimate(results []ProbeResult) int64

func (*ComplexityEstimator) Name

func (ce *ComplexityEstimator) Name() string

type ComplexityMetric

type ComplexityMetric struct{}

ComplexityMetric measures response complexity

func (*ComplexityMetric) Analyze

func (c *ComplexityMetric) Analyze(response string) float64

func (*ComplexityMetric) Name

func (c *ComplexityMetric) Name() string

type ConfidenceCalibrationAttack

type ConfidenceCalibrationAttack struct {
	// contains filtered or unexported fields
}

ConfidenceCalibrationAttack tests model confidence

func (*ConfidenceCalibrationAttack) Execute

func (c *ConfidenceCalibrationAttack) Execute(target interface{}, query Query) (InferenceResult, error)

func (*ConfidenceCalibrationAttack) Name

func (*ConfidenceCalibrationAttack) RequiredQueries

func (c *ConfidenceCalibrationAttack) RequiredQueries() int

type ContextWindowEstimator

type ContextWindowEstimator struct{}

ContextWindowEstimator estimates from context handling

func (*ContextWindowEstimator) Estimate

func (ce *ContextWindowEstimator) Estimate(results []ProbeResult) int64

func (*ContextWindowEstimator) Name

func (ce *ContextWindowEstimator) Name() string

type CredentialDetector

type CredentialDetector struct{}

CredentialDetector detects credentials

func (*CredentialDetector) Detect

func (c *CredentialDetector) Detect(content string) *DataLeak

func (*CredentialDetector) Name

func (c *CredentialDetector) Name() string

type DataLeak

type DataLeak struct {
	Type       string
	Content    string
	Severity   string
	Source     string
	Confidence float64
	Mitigation string
}

DataLeak represents a detected data leak

type DataLeakageAnalyzer

type DataLeakageAnalyzer struct {
	// contains filtered or unexported fields
}

DataLeakageAnalyzer analyzes for data leaks

func NewDataLeakageAnalyzer

func NewDataLeakageAnalyzer() *DataLeakageAnalyzer

NewDataLeakageAnalyzer creates a data leakage analyzer

func (*DataLeakageAnalyzer) Analyze

func (dla *DataLeakageAnalyzer) Analyze(result ExtractionResult) []DataLeak

Analyze checks for data leaks

type DifferentialExtractionStrategy

type DifferentialExtractionStrategy struct {
	// contains filtered or unexported fields
}

DifferentialExtractionStrategy uses variations to extract

func (*DifferentialExtractionStrategy) Confidence

func (d *DifferentialExtractionStrategy) Confidence() float64

func (*DifferentialExtractionStrategy) Extract

func (d *DifferentialExtractionStrategy) Extract(target interface{}, topic string) (ExtractionResult, error)

func (*DifferentialExtractionStrategy) Name

type DirectExtractionStrategy

type DirectExtractionStrategy struct {
	// contains filtered or unexported fields
}

DirectExtractionStrategy directly asks for training data

func (*DirectExtractionStrategy) Confidence

func (d *DirectExtractionStrategy) Confidence() float64

func (*DirectExtractionStrategy) Extract

func (d *DirectExtractionStrategy) Extract(target interface{}, topic string) (ExtractionResult, error)

func (*DirectExtractionStrategy) Name

func (d *DirectExtractionStrategy) Name() string

type EstimationTechnique

type EstimationTechnique interface {
	Name() string
	Estimate(results []ProbeResult) int64
}

EstimationTechnique estimates parameters using specific approach

type Evidence added in v0.8.0

type Evidence struct {
	Type        string
	Description string
	Data        interface{}
	Confidence  float64
}

Evidence represents supporting evidence

type ExtractionResult

type ExtractionResult struct {
	Topic      string
	Content    []string
	Confidence float64
	Source     string
	Metadata   map[string]interface{}
	Timestamp  time.Time
}

ExtractionResult contains extracted knowledge

type ExtractionStrategy

type ExtractionStrategy interface {
	Name() string
	Extract(target interface{}, topic string) (ExtractionResult, error)
	Confidence() float64
}

ExtractionStrategy defines a knowledge extraction approach

type ExtractorConfig

type ExtractorConfig struct {
	ProbeTimeout     time.Duration
	MaxProbesPerType int
	ParallelProbes   int
	AdaptiveProbing  bool
	StealthMode      bool
}

ExtractorConfig configures the extractor

type Finding

type Finding struct {
	Property   string
	Value      interface{}
	Confidence float64
	Supporting []string
}

Finding represents a discovered property

type InferenceAttack

type InferenceAttack interface {
	Name() string
	Execute(target interface{}, query Query) (InferenceResult, error)
	RequiredQueries() int
}

InferenceAttack defines an inference attack method

type InferenceAttacker

type InferenceAttacker struct {
	// contains filtered or unexported fields
}

InferenceAttacker performs model inference attacks

func NewInferenceAttacker

func NewInferenceAttacker(config InferenceConfig) *InferenceAttacker

NewInferenceAttacker creates an inference attacker

func (*InferenceAttacker) PerformInference

func (ia *InferenceAttacker) PerformInference(target interface{}) (*InferenceReport, error)

PerformInference executes comprehensive inference attacks

func (*InferenceAttacker) RegisterAttack

func (ia *InferenceAttacker) RegisterAttack(attack InferenceAttack)

RegisterAttack adds a new inference attack

type InferenceConfig

type InferenceConfig struct {
	MaxQueries         int
	QueryTimeout       time.Duration
	ParallelQueries    int
	PrecisionThreshold float64
	StealthMode        bool
}

InferenceConfig configures inference attacks

type InferenceReport

type InferenceReport struct {
	ID               string
	Timestamp        time.Time
	ModelSignature   string
	Architecture     ArchitectureInfo
	Capabilities     []Capability
	Vulnerabilities  []Vulnerability
	AttributionScore float64
	SimilarModels    []ModelMatch
}

InferenceReport contains comprehensive inference results

type InferenceResult

type InferenceResult struct {
	QueryID    string
	AttackType string
	Findings   []Finding
	Confidence float64
	Evidence   []Evidence
	Timestamp  time.Time
}

InferenceResult contains inference attack results

type KnowledgeConfig

type KnowledgeConfig struct {
	MaxExtractionDepth  int
	ParallelStrategies  int
	ConfidenceThreshold float64
	StealthMode         bool
	AdaptiveExtraction  bool
}

KnowledgeConfig configures knowledge extraction

type KnowledgeExtractor

type KnowledgeExtractor struct {
	// contains filtered or unexported fields
}

KnowledgeExtractor extracts training data and model knowledge

func NewKnowledgeExtractor

func NewKnowledgeExtractor(config KnowledgeConfig) *KnowledgeExtractor

NewKnowledgeExtractor creates a knowledge extractor

func (*KnowledgeExtractor) ExtractKnowledge

func (ke *KnowledgeExtractor) ExtractKnowledge(target interface{}, topics []string) (*KnowledgeReport, error)

ExtractKnowledge performs comprehensive knowledge extraction

func (*KnowledgeExtractor) RegisterStrategy

func (ke *KnowledgeExtractor) RegisterStrategy(strategy ExtractionStrategy)

RegisterStrategy adds a new extraction strategy

type KnowledgeMapper

type KnowledgeMapper struct {
	// contains filtered or unexported fields
}

KnowledgeMapper builds knowledge relationships

func NewKnowledgeMapper

func NewKnowledgeMapper() *KnowledgeMapper

NewKnowledgeMapper creates a knowledge mapper

func (*KnowledgeMapper) BuildMap

func (km *KnowledgeMapper) BuildMap(extractions []ExtractionResult) map[string][]string

BuildMap creates a knowledge map from extractions

type KnowledgeReport

type KnowledgeReport struct {
	ID           string
	Timestamp    time.Time
	Topics       []string
	Extractions  []ExtractionResult
	Memorization []MemorizationInstance
	DataLeaks    []DataLeak
	KnowledgeMap map[string][]string
	Summary      string
}

KnowledgeReport contains extraction results

type LeakageDetector

type LeakageDetector interface {
	Name() string
	Detect(content string) *DataLeak
}

LeakageDetector identifies data leaks

type MembershipInferenceStrategy

type MembershipInferenceStrategy struct {
	// contains filtered or unexported fields
}

MembershipInferenceStrategy infers training data membership

func (*MembershipInferenceStrategy) Confidence

func (m *MembershipInferenceStrategy) Confidence() float64

func (*MembershipInferenceStrategy) Extract

func (m *MembershipInferenceStrategy) Extract(target interface{}, topic string) (ExtractionResult, error)

func (*MembershipInferenceStrategy) Name

type MemorizationDetector

type MemorizationDetector struct {
	// contains filtered or unexported fields
}

MemorizationDetector detects memorized content

func NewMemorizationDetector

func NewMemorizationDetector() *MemorizationDetector

NewMemorizationDetector creates a memorization detector

func (*MemorizationDetector) Detect

Detect checks for memorization

type MemorizationInstance

type MemorizationInstance struct {
	Content    string
	Source     string
	Confidence float64
	Type       string
	Evidence   []string
}

MemorizationInstance represents detected memorization

type MemorizationPattern

type MemorizationPattern struct {
	Name       string
	Detector   func(string) bool
	Confidence float64
}

MemorizationPattern identifies memorization

type ModelComparator

type ModelComparator struct {
	// contains filtered or unexported fields
}

ModelComparator compares with known models

func NewModelComparator

func NewModelComparator() *ModelComparator

NewModelComparator creates a model comparator

func (*ModelComparator) FindSimilar

func (mc *ModelComparator) FindSimilar(signature string) []ModelMatch

type ModelExtractor

type ModelExtractor struct {
	// contains filtered or unexported fields
}

ModelExtractor extracts model information and parameters

func NewModelExtractor

func NewModelExtractor(config ExtractorConfig) *ModelExtractor

NewModelExtractor creates a new model extractor

func (*ModelExtractor) ExtractModelInfo

func (me *ModelExtractor) ExtractModelInfo(target interface{}) (*ModelInfo, error)

ExtractModelInfo performs comprehensive model extraction

func (*ModelExtractor) RegisterProbe

func (me *ModelExtractor) RegisterProbe(probe Probe)

RegisterProbe adds a new probe

type ModelFingerprinter

type ModelFingerprinter struct {
	// contains filtered or unexported fields
}

ModelFingerprinter generates unique model fingerprints

func NewModelFingerprinter

func NewModelFingerprinter() *ModelFingerprinter

NewModelFingerprinter creates a new fingerprinter

func (*ModelFingerprinter) GenerateFingerprint

func (mf *ModelFingerprinter) GenerateFingerprint(results map[string][]ProbeResult) string

GenerateFingerprint creates a fingerprint from probe results

type ModelInfo

type ModelInfo struct {
	ModelFamily      string
	ModelVersion     string
	Architecture     string
	ParameterCount   int64
	TrainingData     []string
	Capabilities     []string
	Limitations      []string
	SecurityFeatures []string
	Confidence       float64
}

ModelInfo contains extracted model information

type ModelInversionAttack

type ModelInversionAttack struct {
	// contains filtered or unexported fields
}

ModelInversionAttack attempts to invert model layers

func (*ModelInversionAttack) Execute

func (m *ModelInversionAttack) Execute(target interface{}, query Query) (InferenceResult, error)

func (*ModelInversionAttack) Name

func (m *ModelInversionAttack) Name() string

func (*ModelInversionAttack) RequiredQueries

func (m *ModelInversionAttack) RequiredQueries() int

type ModelMatch

type ModelMatch struct {
	ModelID    string
	Similarity float64
	Matches    []string
}

ModelMatch represents a similarity match

type ModelProfile

type ModelProfile struct {
	Family      string
	Version     string
	Fingerprint string
	Behaviors   []string
	KnownVulns  []string
}

ModelProfile represents a known model profile

type ModelSignature

type ModelSignature struct {
	Family          string
	Version         string
	Characteristics map[string]interface{}
}

ModelSignature represents a model's unique signature

type OutputLengthAttack

type OutputLengthAttack struct {
	// contains filtered or unexported fields
}

OutputLengthAttack analyzes output length patterns

func (*OutputLengthAttack) Execute

func (o *OutputLengthAttack) Execute(target interface{}, query Query) (InferenceResult, error)

func (*OutputLengthAttack) Name

func (o *OutputLengthAttack) Name() string

func (*OutputLengthAttack) RequiredQueries

func (o *OutputLengthAttack) RequiredQueries() int

type PIIDetector

type PIIDetector struct{}

PIIDetector detects personally identifiable information

func (*PIIDetector) Detect

func (p *PIIDetector) Detect(content string) *DataLeak

func (*PIIDetector) Name

func (p *PIIDetector) Name() string

type ParameterExtractor

type ParameterExtractor struct {
	// contains filtered or unexported fields
}

ParameterExtractor estimates model parameters

func NewParameterExtractor

func NewParameterExtractor() *ParameterExtractor

NewParameterExtractor creates a parameter extractor

func (*ParameterExtractor) EstimateParameters

func (pe *ParameterExtractor) EstimateParameters(results map[string][]ProbeResult) ParameterInfo

EstimateParameters estimates model parameter count

type ParameterInfo

type ParameterInfo struct {
	EstimatedCount int64
	Confidence     float64
	Techniques     []string
}

ParameterInfo contains parameter estimation results

type ParameterProbe

type ParameterProbe struct {
	// contains filtered or unexported fields
}

ParameterProbe estimates parameter count

func (*ParameterProbe) Analyze

func (pp *ParameterProbe) Analyze(results []ProbeResult) ModelInfo

func (*ParameterProbe) Execute

func (pp *ParameterProbe) Execute(target interface{}) (ProbeResult, error)

func (*ParameterProbe) Name

func (pp *ParameterProbe) Name() string

type ParameterRange

type ParameterRange struct {
	Min int64
	Max int64
}

ParameterRange estimates parameter count range

type Probe

type Probe interface {
	Name() string
	Execute(target interface{}) (ProbeResult, error)
	Analyze(results []ProbeResult) ModelInfo
}

Probe represents a model probing technique

type ProbeResult

type ProbeResult struct {
	ProbeID   string
	Timestamp time.Time
	Input     string
	Output    string
	Metadata  map[string]interface{}
	Latency   time.Duration
}

ProbeResult contains probe execution results

type ProprietaryDetector

type ProprietaryDetector struct{}

ProprietaryDetector detects proprietary information

func (*ProprietaryDetector) Detect

func (p *ProprietaryDetector) Detect(content string) *DataLeak

func (*ProprietaryDetector) Name

func (p *ProprietaryDetector) Name() string

type Query

type Query struct {
	ID       string
	Type     QueryType
	Content  string
	Variants []string
	Metadata map[string]interface{}
}

Query represents an inference query

type QueryType

type QueryType string

QueryType defines the type of inference query

const (
	QueryTypeArchitecture  QueryType = "architecture"
	QueryTypeTraining      QueryType = "training"
	QueryTypeCapability    QueryType = "capability"
	QueryTypeVulnerability QueryType = "vulnerability"
)

type ResponseAnalyzer

type ResponseAnalyzer struct {
	// contains filtered or unexported fields
}

ResponseAnalyzer analyzes model responses

func NewResponseAnalyzer

func NewResponseAnalyzer() *ResponseAnalyzer

NewResponseAnalyzer creates a response analyzer

type ResponseMetric

type ResponseMetric interface {
	Name() string
	Analyze(response string) float64
}

ResponseMetric analyzes specific response characteristics

type StyleMetric

type StyleMetric struct{}

StyleMetric analyzes writing style

func (*StyleMetric) Analyze

func (s *StyleMetric) Analyze(response string) float64

func (*StyleMetric) Name

func (s *StyleMetric) Name() string

type TemplateExtractionStrategy

type TemplateExtractionStrategy struct {
	// contains filtered or unexported fields
}

TemplateExtractionStrategy uses templates to extract data

func (*TemplateExtractionStrategy) Confidence

func (t *TemplateExtractionStrategy) Confidence() float64

func (*TemplateExtractionStrategy) Extract

func (t *TemplateExtractionStrategy) Extract(target interface{}, topic string) (ExtractionResult, error)

func (*TemplateExtractionStrategy) Name

type TimingAttack

type TimingAttack struct {
	// contains filtered or unexported fields
}

TimingAttack measures response timing

func (*TimingAttack) Execute

func (t *TimingAttack) Execute(target interface{}, query Query) (InferenceResult, error)

func (*TimingAttack) Name

func (t *TimingAttack) Name() string

func (*TimingAttack) RequiredQueries

func (t *TimingAttack) RequiredQueries() int

type TrainingDataProbe

type TrainingDataProbe struct {
	// contains filtered or unexported fields
}

TrainingDataProbe probes for training data information

func (*TrainingDataProbe) Analyze

func (td *TrainingDataProbe) Analyze(results []ProbeResult) ModelInfo

func (*TrainingDataProbe) Execute

func (td *TrainingDataProbe) Execute(target interface{}) (ProbeResult, error)

func (*TrainingDataProbe) Name

func (td *TrainingDataProbe) Name() string

type VersionProbe

type VersionProbe struct {
	// contains filtered or unexported fields
}

VersionProbe probes for version information

func (*VersionProbe) Analyze

func (vp *VersionProbe) Analyze(results []ProbeResult) ModelInfo

func (*VersionProbe) Execute

func (vp *VersionProbe) Execute(target interface{}) (ProbeResult, error)

func (*VersionProbe) Name

func (vp *VersionProbe) Name() string

type VocabularyEstimator

type VocabularyEstimator struct{}

VocabularyEstimator estimates parameters from vocabulary usage

func (*VocabularyEstimator) Estimate

func (ve *VocabularyEstimator) Estimate(results []ProbeResult) int64

func (*VocabularyEstimator) Name

func (ve *VocabularyEstimator) Name() string

type Vulnerability added in v0.8.0

type Vulnerability struct {
	ID          string
	Type        string
	Severity    string
	Description string
	Discovered  time.Time
}

Vulnerability represents a discovered vulnerability

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL